QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#667016#7757. Palm IslandmikuWA 0ms5544kbC++20964b2024-10-22 20:45:322024-10-22 20:45:52

Judging History

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

  • [2024-10-22 20:45:52]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5544kb
  • [2024-10-22 20:45:32]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define endl '\n'
using namespace std;
using ll =long long ;
using pii =pair<int,int>;
using pll=pair<ll,ll>;
const int N=5e5+10;
ll a[N];
ll b[N];
void solve(){
	int n;
	cin>>n;
	map<int,int>mp;
	map<pii,int>mpx;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int idx=0;deque<ll>dq;
	for(int i=1;i<=n;i++){
		cin>>b[i];
		mp[b[i]]=++idx;
	}
	for(int i=1;i<=n;i++){
		a[i]=mp[a[i]];dq.pb(a[i]);
	}
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			if(a[i]>a[j])mpx[{a[i],a[j]}]=1;
		}
	}	
	for(int i=1;i<=n*(n-1);i++){
		if(mpx[{dq[0],dq[1]}]){
			mpx[{dq[0],dq[1]}]=0;
			dq.pb(dq[1]);cout<<2;
		}
		else dq.pb(dq[0]);
		cout<<1;
		dq.pop_front();
	}
	for(int i=0;i<n;i++){
		if(dq[i]!=1)cout<<1;
		else break;
	}
	cout<<endl;
}
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	int _=1;
	cin>>_;
	while(_--)solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5544kb

input:

2
3
1 2 3
2 3 1
4
1 2 3 4
2 1 3 4

output:

2111111
2111111111111

result:

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