1 条题解

  • 1
    @ 2026-3-8 10:18:35

    STL模拟

    #include<bits/stdc++.h>
    using namespace std;
    set<int>pre,now;
    int main()
    {
    	int n,q;scanf("%d%d",&n,&q);
    	for(int i=1;i<=n;i++)pre.insert(i); 
    	while(q--)
    	{
    		int op,x;scanf("%d",&op);
    		if(op==1)
    		{
    			now.insert(*pre.begin());
    			pre.erase(pre.begin());
    		}
    		else if(op==2)
    		{
    			scanf("\%d",&x);
    			now.erase(x);
    		}
    		else printf("%d\n",*now.begin());
    	}
    	return 0;
    }
    
    
    • 1

    信息

    ID
    1205
    时间
    2000ms
    内存
    1024MiB
    难度
    10
    标签
    递交数
    2
    已通过
    2
    上传者