QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519532#7757. Palm IslandNevllWA 1ms3692kbC++14715b2024-08-14 20:52:162024-08-14 20:52:17

Judging History

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

  • [2024-08-14 20:52:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3692kb
  • [2024-08-14 20:52:16]
  • 提交

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;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: 1ms
memory: 3692kb

input:

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

output:

222222222
2112222222222222

result:

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