QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519205#7757. Palm IslandQF_love_younger_sisterWA 0ms3628kbC++232.0kb2024-08-14 17:23:402024-08-14 17:23:40

Judging History

你现在查看的是最新测评结果

  • [2024-08-14 17:23:40]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-08-14 17:23:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N=1e3+10;
int a[N],b[N],c[N];
int que[N*N];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,t;
	cin >> t;
	while(t--){
		vector<int> cz;
		cin >> n;
		for(int i=1;i<=n;i++){
			cin >> a[i];
		}
		for(int i=1;i<=n;i++){
			cin >> b[i];
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(b[i]==a[j]){
					c[j]=i;
					que[j]=i;
				}
			}
		}
		for(int i=1;i<=n;i++){
			cout << que[i] << " ";
		}
		cout << "\n";
		int czs=1,st=1,en=n,flag1=1,mu=1;
		while(czs<=n*n){
			if((que[st]!=mu+1 && que[st+1]!=mu+1)){
				if(que[st]<que[st+1]){
					cz.push_back(2);
					en++;
					que[en]=que[st+1];
					que[st+1]=que[st];
					st++;
				}
				else{
					cz.push_back(1);
					en++;
					que[en]=que[st];
					st++;
				}
			}
			else{
				if(que[st]==mu+1){
					if(que[st+1]==mu){
						cz.push_back(2);
						cz.push_back(1);
						que[en+1]=que[st+1];
						que[en+2]=que[st];
						st+=2;
						en+=2;
						czs++;
						mu++;
						if(mu==n){
							break;
						}
					}
					else{
						cz.push_back(2);
						en++;
						que[en]=que[st+1];
						que[st+1]=que[st];
						st++;
					}
				}
				if(que[st+1]==mu+1){
					if(que[st]==mu){
						cz.push_back(1);
						cz.push_back(2);
						que[en+1]=que[st];
						que[en+2]=que[st+1];
						st+=2;
						en+=2;
						czs++;
						mu++;
						if(mu==n){
							break;
						}
					}
					else{
						cz.push_back(1);
						en++;
						que[en]=que[st];
						st++;
					}
				}
			}
//			if(czs>=n*(n-1)){
//				int flag=1;
//				for(int i=st;i<=en;i++){
//					if(que[i]!=i-st+1){
//						flag=0;
//						break;
//					}
//				}
//				if(flag){
//					flag1=1;
//					break;
//				}
//			}
			czs++;
		}
//		cout << mu << "\n";
		if(flag1==1){
			int len2=cz.size();
			for(int i=0;i<len2;i++){
				cout << cz[i];
			}
			cout << "\n";
		}
		else{
			cout << "Wrong Answer\n";
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3628kb

input:

2
3
1 2 3
2 3 1
4
1 2 3 4
2 1 3 4

output:

3 1 2 
112221
2 1 3 4 
2122212221

result:

wrong answer Line [name=s] equals to "3 1 2 ", doesn't correspond to pattern "[1-2]{0,1000000}" (test case 1)