QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519530#7757. Palm IslandNevllWA 0ms3616kbC++14721b2024-08-14 20:51:362024-08-14 20:51:36

Judging History

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

  • [2024-08-14 20:51:36]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-08-14 20:51:36]
  • 提交

answer

# include <bits/stdc++.h>
# define ll long long
# define ld long double
# define pii pair<int, int>
# define fi first
# define se second
using namespace std;

int arr[1000001], pos[1001];

int main() {
	int cases;
	cin>>cases;
	while(cases--) {
		int N;
		cin>>N;
		
		for(int i=1;i<=N;i++) cin>>arr[i];
		for(int c=0;c<N;c++) {
			int x;
			cin>>x;
			pos[x] = c;
		}
		
		int ls = 1;
		for(int k=0;k<N*(N - 1);k++) {
	//		cout<<"arr : "<<arr[ls]<<" "<<arr[ls + 1]<<endl;
			if(pos[arr[ls]] < pos[arr[ls + 1]]) {
				cout<<"1";
				arr[ls + N] = arr[ls];
			} else {
				cout<<"2";
				arr[ls + N] = arr[ls + 1];
				swap(arr[ls], arr[ls + 1]);
			}
			ls++;
		}
		cout<<"\n";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

222222
211222222222

result:

wrong answer On Case#1: After your operations, a[1] = 1 but a[1] = 2. (test case 1)