QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#404658 | #7757. Palm Island | AE12 | WA | 1ms | 7844kb | C++14 | 1.0kb | 2024-05-04 12:53:40 | 2024-05-04 12:53:40 |
Judging History
answer
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define endl "\n"
//#define x first
//#define y second
//#define int long long
using namespace std;
typedef long long ll;
typedef pair<int , int> pii;
const int mod = 1e9 + 7;
const int N = 3e5 + 10;
int n, m;
int a[N], b[N], st[N], ne[N], pr[N], idx;
inline void sovle(){
cin >> n;
vector<int> o;
for(int i = 1; i <= n; i ++) {
cin >> a[i];
o.push_back(a[i]);
}
for(int i = 1; i <= n; i ++) {
cin >> b[i];
st[b[i]] = i;
}
int s = 0;
for(int k = 1; k <= n * n; k ++) {
if(s >= n && st[o[0]] == 1) break;
if(st[o[0]] == n || b[st[o[0]] + 1] == o[1]) {
o.push_back(o[0]);
o.erase(o.begin());
cout << 1;
s ++;
} else {
cout << 2;
o.push_back(o[1]);
o.erase(o.begin() + 1);
s = 0;
}
}
// cout << endl;
// for(auto i : o) {
// cout << i << " ";
// }
// cout << endl;
}
signed main(void){
IOS;
int t = 1;
cin >> t;
while(t --) sovle();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 7844kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
111121111111
result:
wrong answer On Case#1: The lenght of your output is 12(exceed n*n = 9). (test case 1)