# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
872920 |
2023-11-14T04:53:00 Z |
vjudge1 |
Labels (NOI20_labels) |
C++17 |
|
47 ms |
3408 KB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
int D[N-1];
int diff=1;
int mini=INT_MAX,maxe=-INT_MAX;
for(int i=0; i<N-1; i++){
cin>>D[i];
diff+=D[i];
if(diff>maxe){
maxe=diff;
}
if(diff<mini){
mini=diff;
}
}
if(abs(mini-maxe)>=N-1){
int soln=N-maxe;
for(int i=0; i<N-1; i++){
cout<<soln<<' ';
soln+=D[i];
}
cout<<soln;
}
else if(mini==1-N&&maxe<=1){
int soln=N;
for(int i=0; i<N-1; i++){
cout<<soln<<' ';
soln+=D[i];
}
cout<<soln;
}
else if(maxe==N&&mini>=1){
int soln=1;
for(int i=0; i<N-1; i++){
cout<<soln<<' ';
soln+=D[i];
}
cout<<soln;
}
else{
cout<<-1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
3408 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
37 ms |
1372 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |