QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#627915 | #7757. Palm Island | 53Dawns | WA | 0ms | 3620kb | C++23 | 1.1kb | 2024-10-10 17:37:52 | 2024-10-10 17:37:52 |
Judging History
answer
#include <bits/stdc++.h>
// #include <bits/extc++.h>
#pragma GCC optimize (1)
#pragma GCC optimize (2)
#pragma GCC optimize (3)
// #define int long long
#define IOS ios::sync_with_stdio(0),cin.tie(0)
// using namespace __gnu_pbds;
using namespace std;
const int N=2e5+10,M=1e6+10,mod=1e9+7;
void sol(int cases) {
int n;
cin >> n;
map<int,int>mp;
std::vector<int> ans;
std::vector<int> a(n+1);
std::vector<int> b(n+1);
for(int i = 1; i <= n; i++)
cin >> a[i];
for(int i = 1; i <= n; i++){
cin >> b[i];
mp[b[i]] = i;
}
for(int i = 1;i <= n; i++){
for(int j = 1; j <= n - 1; j++){
if(mp[a[j]] > mp[a[j + 1]]){
ans.push_back(2);
swap(a[j],a[j + 1]);
}
ans.push_back(1);
}
ans.push_back(1);
}
for(auto x : ans) {
cout << x;
}
cout << endl;
}
signed main(){
IOS;
int t=1;
cin>>t;
for(int i=1;i<=t;++i){
sol(i);
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3620kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
21211111111 21111111111111111
result:
wrong answer On Case#1: The lenght of your output is 11(exceed n*n = 9). (test case 1)