QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#519530 | #7757. Palm Island | Nevll | WA | 0ms | 3616kb | C++14 | 721b | 2024-08-14 20:51:36 | 2024-08-14 20:51:36 |
Judging History
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)