QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#642155 | #7757. Palm Island | AuroraKelsey | WA | 1ms | 5664kb | C++14 | 941b | 2024-10-15 11:11:51 | 2024-10-15 11:11:53 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <vector>
#include <map>
#include <climits>
using namespace std;
const int N = 1000001;
int n;
int a[N], b[N];
map<int, int> mp;
bool check() {
for(int i=1;i<=n;i++)
if(a[i]!=b[i])
return 0;
return 1;
}
int main() {
int t;
cin >> t;
while (t--) {
cin >> n;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= n; i++)
cin>>b[i],mp[b[i]]=i;
int j;
int tmp;
while(1){
if(mp[a[1]]<mp[a[2]]) {
tmp=a[2];
j=2;
cout<<2;
}else{
tmp=a[1];
cout<<1;
j=1;
}
for(int i=j;i<n;i++)
a[i]=a[i+1];
a[n]=tmp;
if(check())break;
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5664kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
1122
result:
wrong answer On Case#1: After your operations, a[1] = 3 but a[1] = 2. (test case 1)