POJ - 2259 Team Queue(队列模拟)
#include
#include
using namespace std;
const int N = 1010, M = 1000010;
int teamid[M];
int main()
{
int n,C=1;
while(cin>>n,n)
{
for(int i=0;i>cnt;
while(cnt--)
{
int x;cin>>x;
teamid[x]=i;
}
}
cout<<"Scenario #"< team,person[N];
string command;
while(cin>>command,command!="STOP")
{
if(command=="ENQUEUE")
{
int x;cin>>x;
int tid=teamid[x];
if(person[tid].empty()) team.push(tid);
person[tid].push(x);
}
if(command=="DEQUEUE")
{
int tid=team.front();
queue &q=person[tid];
cout<