QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#519089 | #7757. Palm Island | LuCiiiD# | WA | 0ms | 3648kb | C++23 | 1.1kb | 2024-08-14 16:14:18 | 2024-08-14 16:14:20 |
Judging History
answer
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <set>
#include <fstream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <bitset>
#define ll long long
#define endl '\n'
#define inf 0x3f3f3f3f3f3f3f3f
using namespace std;
const ll N = 1020, mod = 1;
ll n, m, k,a[N], ans = 0, maxx = 0, sum = 0, sum2 = 0;
queue<int>q;
map<int,int>mp;
void solve()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>m;
mp[m]=i;
}
for(int i=1;i<=n;i++){
cin>>m;
a[mp[m]]=i;
}
for(int i=1;i<=n;i++){
q.push(a[i]);
}
for(int i=1;i<n;i++){
m=q.front();
q.pop();
for(int j=1;j<=n-i;j++){
k=q.front();
q.pop();
if(m<k){
q.push(k);
cout<<2;
}
else{
q.push(m);
m=k;
cout<<1;
}
}
for(int j=1;j<=i;j++){
cout<<1;
}
}
q.pop();
for(int i=1;i<n;i++){
cout<<1;
}
cout<<endl;
}
int main()
{
ios::sync_with_stdio(false),
cin.tie(0),
cout.tie(0);
int T = 1, hhyy;
cin >> T;
while (T--)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
input:
2 3 1 2 3 2 3 1 4 1 2 3 4 2 1 3 4
output:
12111111 122122112111111
result:
wrong answer On Case#1: After your operations, a[2] = 1 but a[2] = 3. (test case 1)