QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#372221 | #7933. Build Permutation | ccinx# | WA | 0ms | 3912kb | C++14 | 522b | 2024-03-31 05:16:15 | 2024-03-31 05:16:16 |
Judging History
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