QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#670815 | #7933. Build Permutation | maelys | WA | 0ms | 3600kb | C++17 | 782b | 2024-10-24 03:27:55 | 2024-10-24 03:27:56 |
Judging History
answer
#include <iostream>
#include <vector>
#include <cmath>
#include <limits>
using namespace std;
int main() {
int n;
cin>>n;
vector<int> v(n);
long long int sum;
for(int i = 0; i < n; i++){
long long int num;
cin>>num;
v[i] = num;
sum+=num;
}
sum = sum*2 / v.size();
vector<int> s(n);
bool f = false;
for(int i = 0; i < n; i++){
int search = sum - v[i];
for(int j = i; j < n; j++){
if(v[j] == search){
s[i] = j;
f = true;
}
if(!f) break;
}
}
if(!f) cout<<-1;
else{
for (int i : s)
{
cout<<i << ' ';
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
5 4 2 5 1 3
output:
0 0 0 0 4
result:
wrong answer Integer 0 violates the range [1, 5]