萌新 mz 站外题 Segmentation Fault 求调 qwq
查看原帖
萌新 mz 站外题 Segmentation Fault 求调 qwq
511609
无钩七不改名楼主2023/3/19 10:13
#include<bits/stdc++.h>
using namespace std;

int t,n;
int a[1000010];
queue<int> q,p[1010],q1;

int main(){
	while(1){
		n++;
		scanf("%d",&t);
		if(!t)return puts(""),0;
		printf("Scenario #%d\n",n);
		q=q1;
		for(int i=0;i<t;i++){
			int x,y;p[t]=q1;
			scanf("%d",&x);
			while(x--){
				scanf("%d",&y);
				a[y]=i;
			}
		}
		char c[15];
		while(1){
			scanf(" %s",&c);
			//cout<<c[0]<<endl;
			if(c[0]=='S'){
				puts("");
				break;
			}
			if(c[0]=='E'){
			//cout<<1<<endl;
				int x;
				scanf("%d",&x);
				if(p[a[x]].empty())q.push(a[x]);
				p[a[x]].push(x);
			}
			else{
				printf("%d\n",p[q.front()].front());
				p[q.front()].pop();
				if(p[q.front()].empty())q.pop();
			}
		}
	}
}

题目

蟹蟹泥门 qwq

2023/3/19 10:13
加载中...