QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#632489 | #7757. Palm Island | tsai | WA | 0ms | 3684kb | C++14 | 848b | 2024-10-12 13:28:06 | 2024-10-12 13:28:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2005;
int n, a[N], b[N];
void solve(){
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
for(int i = 1; i <= n; i++){
int tmp; scanf("%d", &tmp);
b[tmp] = i;
}
deque<int>q;
for(int i = 1; i <= n; i++) q.push_back(b[a[i]]);
int rem = n % 2; n = n - n % 2;
for(int i = 1; i <= n; i+=2){
int fir = i, sec = i + 1;
while(q.front() != fir) q.push_back(q.front()), q.pop_front(), printf("1");
q.pop_front();
while(q.front() != sec) q.push_back(q.front()), q.pop_front(), printf("2");
q.pop_front();
printf("12"); q.push_back(1), q.push_back(2);
}
if(rem) printf("1");
}
int main(){
int t;
scanf("%d",&t);
while(t--){
solve();
if(t) printf("\n");
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3684kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
1121 1221212
result:
wrong answer On Case#1: After your operations, a[2] = 1 but a[2] = 3. (test case 1)