# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
836302 |
2023-08-24T09:59:00 Z |
exodus_ |
Labels (NOI20_labels) |
C++14 |
|
5 ms |
1620 KB |
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int D[maxn], A[maxn], B[maxn];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N;
cin >> N;
A[1] = 1;
for(int i=1; i<N; i++) {
cin >> D[i];
}
for(int i=1; i<N; i++) {
A[i+1] = A[i]+D[i];
}
bool onlyone = false;
for(int i=2; i<=N; i++) {
B[1] = i;
for(int j=2; j<N; j++) {
B[j] = B[j-1]+D[j-1];
if(B[j]>N || B[j]<1) {
onlyone = true;
break;
}
}
if(i>=2 && onlyone==false) {
break;
}
}
if(onlyone==true) {
for(int i=1; i<=N; i++) {
cout << A[i] << " ";
}
} else {
cout << "-1" << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
1620 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |