QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#630290#8837. Increasing Incomeucup-team4352#WA 0ms3648kbC++23738b2024-10-11 17:34:402024-10-11 17:34:41

Judging History

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

  • [2024-10-11 17:34:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-10-11 17:34:40]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define lowbit(x) (x&-x)
#define log(x) (31^__builtin_clz(x))
using namespace std;
int a[200005],b[200005];
void solve(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int mx=0,cnt=n,nans=n;
	for(int i=1;i<=n;i++){
		if(a[i]>mx)mx=a[i],nans++;
	}
	for(int i=1;i<=n;i++){
		b[a[i]]=i;
	}
	mx=0;
	for(int i=1;i<=n;i++){
		if(b[i]>mx)mx=b[i],cnt++;
	}
	if(nans>cnt){
		for(int i=1;i<=n;i++)cout<<i<<" ";
		cout<<"\n";
		return;
	}
	for(int i=1;i<=n;i++)cout<<b[i]<<" ";
	cout<<"\n";
}
int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int t=1;
	cin>>t;
	while(t--)solve();
	return 0;
}
/*
p_qi=i

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

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

output:

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

result:

ok Correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3596kb

input:

153
4
2 4 3 1
4
1 4 2 3
5
2 1 4 5 3
5
1 4 5 3 2
4
1 3 2 4
5
1 5 2 4 3
5
5 3 1 2 4
5
4 1 2 5 3
5
1 2 5 3 4
5
3 1 4 2 5
5
5 4 2 3 1
5
2 1 5 4 3
5
3 4 1 5 2
5
1 4 3 5 2
5
5 1 3 4 2
5
5 3 2 4 1
5
1 5 3 2 4
5
2 4 3 1 5
5
1 5 4 3 2
5
1 2 4 5 3
5
4 2 5 3 1
5
1 3 5 2 4
5
3 1 4 5 2
3
2 1 3
5
1 2 4 3 5
5
5 1 ...

output:

1 2 3 4 
1 3 4 2 
1 2 3 4 5 
1 2 3 4 5 
1 3 2 4 
1 3 5 4 2 
3 4 2 5 1 
2 3 5 1 4 
1 2 4 5 3 
2 4 1 3 5 
5 3 4 2 1 
2 1 5 4 3 
1 2 3 4 5 
1 2 3 4 5 
2 5 3 4 1 
5 3 2 4 1 
1 4 3 5 2 
1 2 3 4 5 
1 5 4 3 2 
1 2 3 4 5 
1 2 3 4 5 
1 4 2 5 3 
1 2 3 4 5 
2 1 3 
1 2 4 3 5 
2 3 5 4 1 
3 4 1 5 2 
3 5 4 2 1 
3 ...

result:

wrong answer Jury found better answer than participant (test case 11)