蒟蒻求助
查看原帖
蒟蒻求助
269085
Iceturky楼主2021/4/2 15:13

自己的数据都过了,可3个点WA,其他全RE

#include<iostream>
#include<queue>
using namespace std;
queue<int> q[305];
int b[100005];
int main()
{
	queue<int> all;
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
		cin>>b[i];
	int t;
	cin>>t;
	while(t--)
	{
		string temp;
		cin>>temp;
		if(temp=="pop")
		{
			if(q[all.front()].empty())
				all.pop();
			cout<<q[all.front()].front()<<endl;
			q[all.front()].pop();
		}
		else
		{
			int x;
			cin>>x;
			if(q[b[x]].empty())
				all.push(b[x]);
			q[b[x]].push(x);
		}
	}
	return 0;
}
2021/4/2 15:13
加载中...