懵逼了~~~
谁能帮帮我???
#include<bits/stdc++.h>
using namespace std;
deque<string> q;
int main(){
int n;
string nowplayinga="",nowplayingb="";
cin>>n;
while(n--){
string cmd;
cin>>cmd;
if(cmd=="start"){
if(q.empty()){
cout<<"Error\n";
}else{
if(nowplayinga!=""){
q.push_back(nowplayinga);
}
if(nowplayingb!=""){
q.push_back(nowplayingb);
}
nowplayinga=nowplayingb="";
cout<<q.front()<<" ";
nowplayinga=q.front();
q.pop_front();
if(!q.empty()){
cout<<q.front();
nowplayingb=q.front();
q.pop_front();
}
cout<<endl;
}
}else if(cmd=="arrive"){
string x;
cin>>x;
if(find(q.begin(),q.end(),x)!=q.end()||nowplayinga==x||nowplayingb==x){
cout<<"Error\n";
}else{
q.push_back(x);
cout<<"OK\n";
}
}else{
string x;
cin>>x;
deque<string>::iterator it=find(q.begin(),q.end(),x);
if(it==q.end()){
cout<<"Error\n";
}else{
q.erase(it);
cout<<"OK\n";
}
}
}
return 0;
}