QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#372221#7933. Build Permutationccinx#WA 0ms3912kbC++14522b2024-03-31 05:16:152024-03-31 05:16:16

Judging History

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

  • [2024-03-31 05:16:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3912kb
  • [2024-03-31 05:16:15]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,arr[200005],mn;
map<int,int>mp;
int main(){
    mn=INT_MAX;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&arr[i]);
        mn=min(mn,arr[i]);
    }
    bool p=true;
    for(int i=1;i<=n;i++){
        arr[i]-=mn;
        if(arr[i]>=n)p=false;
        if(mp[arr[i]]==1)p=false;
        mp[arr[i]]=1;
    }
    if(p){
        for(int i=1;i<=n;i++){
            printf("%d ",n-arr[i]);
        }
    }
    else printf("-1");
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
4 2 5 1 3

output:

2 4 1 5 3 

result:

wrong answer