希望大佬们能给个 Hack 或者帮看看/kk
#include<bits/stdc++.h>
#define DE cout<<"qwq\n"
using namespace std;
const int N=1e5+7;
map<string,int> mp;
string name[N];
queue<int>q,q2;//队列/游戏
int a[N],b[N];//队列中/玩游戏
int n;
int cnt;
bool out[N];//是否出队
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
string str;
cin>>str;
if(str=="start"){
while(!q2.empty()){
int u=q2.front();q2.pop();
a[u]=1,b[u]=0;q.push(u);
}
if(!q.size()) cout<<"Error\n";
else{
int u=q.front();q.pop();
while(out[u]&&q.size()) u=q.front(),q.pop();
if(out[u]!=1){
a[u]=1;
b[u]=1;
q2.push(u);
cout<<name[u];
if(!q.empty()){
u=q.front();
q.pop();
while(out[u]&&q.size()) u=q.front(),q.pop();
if(out[u]!=1){
a[u]=1,b[u]=1;
q2.push(u);
cout<<" "<<name[u];
}
}
cout<<"\n";
}
else
cout<<"Error\n";
}
}
if(str=="arrive"){
cin>>str;
int p=mp[str];
if(p&&out[p]){
q.push(p),out[p]=0;a[p]=1;
cout<<"OK\n";
}
else if(!p){
mp[str]=++cnt,name[cnt]=str;
//cout<<cnt<<"::"<<"\n";
q.push(cnt),out[cnt]=0;a[cnt]=1;
cout<<"OK\n";
}
else cout<<"Error\n";
}
if(str=="leave"){
cin>>str;
int p=mp[str];
//if(str=="D") cout<<"qwq"<<b[p]<<"\n";
if(a[p]&&!b[p]&&!out[p]){
a[p]=b[p]=0,out[p]=1;
cout<<"OK\n";
}
else cout<<"Error\n";
}
}
return 0;
}