QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#372221#7933. Build Permutationccinx#WA 0ms3912kbC++14522b2024-03-31 05:16:152024-03-31 05:16:16

Judging History

This is the latest submission verdict.

  • [2024-03-31 05:16:16]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3912kb
  • [2024-03-31 05:16:15]
  • Submitted

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");
}


详细

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