QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#368484 | #7933. Build Permutation | bradythebest27 | WA | 226ms | 31264kb | C++23 | 897b | 2024-03-27 09:23:37 | 2024-03-27 09:23:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
long t;
cin>>t;
double t2 = (double)(t);
double sum = 0;
long x;
vector<long> nums;
map<long, long> myMap;
long c = 0;
while (t--){
c++;
cin>>x;
nums.push_back(x);
myMap.insert(pair<long,long>(x,c));
sum+=(2*((double)(x)/t2));
}
long av = (long) sum+0.1;
if (sum - (int)sum > 0.05){
cout<<-1<<endl;
return 0;
}
vector<long> ans;
double newSum = 0;
for (long curr: nums){
ans.push_back(av-curr);
newSum+=2*(double)(av-curr)/t2;
}
if (newSum - sum < 0.01){
for (long i = 0; i < ans.size() - 1; i++){
cout<<myMap[ans[i]]<<" ";
}
cout<<myMap[ans[ans.size()-1]]<<endl;
} else{
cout<<-1<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
5 4 2 5 1 3
output:
2 1 4 3 5
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 2 2 3
output:
-1
result:
ok
Test #3:
score: -100
Wrong Answer
time: 226ms
memory: 31264kb
input:
199528 581552649 419782901 924554494 589802859 878336763 659984178 419820729 521791999 956262027 523946290 442086405 808419260 875183942 860794919 584899704 494193909 687014591 794119827 641706288 734029639 795387770 803653459 889799156 455122734 655375888 757642629 427654115 987811208 593072829 584...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer Integer 0 violates the range [-1, -1]