QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#519151 | #7757. Palm Island | QF_love_younger_sister | WA | 1ms | 3640kb | C++23 | 1.1kb | 2024-08-14 16:46:17 | 2024-08-14 16:46:18 |
Judging History
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;
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){
break;
}
}
czs++;
}
int len2=cz.size();
for(int i=0;i<len2;i++){
cout << cz[i];
}
cout << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
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: 3640kb
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 2222222222222222 2122222222222 2122222222222222222222222 2122222222222222222222222 2122222222222222 2122222 2122222222222222 22222222222222 2122222 1122222 2122222222222 2222222 122222 2212222222222222222222222 2122222222222222 1112222222222222 1222222 222222222222 1212222222222222222222 211...
result:
wrong answer On Case#2: After your operations, a[3] = 3 but a[3] = 4. (test case 2)