QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519157#7757. Palm IslandQF_love_younger_sisterWA 1ms3652kbC++231.2kb2024-08-14 16:49:182024-08-14 16:49:18

Judging History

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

  • [2024-08-14 16:49:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3652kb
  • [2024-08-14 16:49:18]
  • 提交

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=0;
		while(czs<=n*n){
			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++;
			}
			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++;
		}
		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: 100
Accepted
time: 0ms
memory: 3624kb

input:

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

output:

1222222
122222222222

result:

ok Correct. (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3652kb

input:

200
3
3 1 2
2 3 1
4
2 4 1 3
2 1 4 3
4
1 4 2 3
2 1 3 4
5
4 3 2 1 5
2 4 5 3 1
5
2 1 5 4 3
5 2 4 1 3
4
4 3 1 2
1 2 4 3
3
1 2 3
3 1 2
4
1 4 2 3
2 1 4 3
4
1 3 2 4
1 4 3 2
3
3 2 1
1 3 2
3
2 3 1
1 3 2
4
1 4 3 2
3 1 2 4
3
1 2 3
1 3 2
3
3 2 1
2 3 1
5
5 1 3 2 4
2 4 5 1 3
4
4 3 1 2
1 4 3 2
4
1 3 4 2
2 4 3 1
3
...

output:

2122222
Wrong Answer
2122222222222
Wrong Answer
Wrong Answer
Wrong Answer
2122222
Wrong Answer
22222222222222
2122222
1122222
2122222222222
2222222
122222
Wrong Answer
Wrong Answer
Wrong Answer
1222222
222222222222
1212222222222222222222
Wrong Answer
Wrong Answer
12122222222222
Wrong Answer
Wrong An...

result:

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