QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#742656 | #7757. Palm Island | qikala7777 | WA | 1ms | 5600kb | C++23 | 1.2kb | 2024-11-13 17:01:21 | 2024-11-13 17:01:22 |
Judging History
answer
//16:35
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef tuple<int,LL,LL> TPL;
typedef pair<LL,LL> PII;
const int N=1e6+7,inf=0x3f3f3f3f;const LL Linf=0x3f3f3f3f3f3f3f3fLL;
LL qsm(LL a,LL b,LL p){LL res=1;while(b){if(b&1)res=res*a%p;a=a*a%p;b>>=1;}return res;}
LL lowbit(LL x){return x&-x;}
int n;
int a[N],b[N];
deque<int>q;
string ans;
void op1(){
int x=q.front();
q.pop_front();
q.push_back(x);
ans+='1';
}
void op2(){
int x=q.front();
q.pop_front();
int y=q.front();
q.pop_front();
q.push_back(y);
q.push_front(x);
ans+='2';
}
void solve(){
cin>>n;
q.clear();
for(int i=1;i<=n;i++)cin>>a[i],q.push_back(a[i]);
for(int i=1;i<=n;i++)cin>>b[i];
for(int i=1;i<=n;i+=2){
while(q.front()!=b[i]){
op1();
}
while(i+1<=n&&q[1]!=b[i+1]){
op2();
}
op1();
if(i+1<=n)op1();
}
while(q[0]!=b[1]){
op1();
}
cout<<ans<<endl;
}
int main(){
IOS
int T=1;
cin>>T;
while(T--)solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5584kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
1111 11111221111
result:
ok Correct. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 5600kb
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:
11111 1111121112211 11111211122111121112211 111112111221111211122111122111122111 1111121112211112111221111221111221111122111222111 1111121112211112111221111221111221111122111222111111111 111112111221111211122111122111122111112211122211111111111111 1111121112211112111221111221111221111122111222111111...
result:
wrong answer On Case#2: After your operations, a[1] = 4 but a[1] = 2. (test case 2)