QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519074#7757. Palm IslandLuCiiiD#WA 0ms3648kbC++231.1kb2024-08-14 15:59:432024-08-14 15:59:43

Judging History

你现在查看的是最新测评结果

  • [2024-08-14 15:59:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-08-14 15:59:43]
  • 提交

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 = 1e6 + 10, mod = 1;
ll n, m, k,a[N], ans = 0, maxx = 0, sum = 0, sum2 = 0;
queue<int>q;
void solve()
{
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>m;
		a[m]=1;
	}
	for(int i=1;i<=n;i++){
		cin>>m;
		a[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;
		}
	}
	cout<<endl;
}

int main()
{
	ios::sync_with_stdio(false),
		cin.tie(0),
		cout.tie(0);
	int T = 1, hhyy;
	cin >> T;
	while (T--)
	{
		solve();
	}
}

详细

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:

121111111
1221221121111111

result:

wrong answer On Case#1: After your operations, a[1] = 1 but a[1] = 2. (test case 1)