# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301169 | 2020-09-17T17:14:02 Z | beso123 | Labels (NOI20_labels) | C++14 | 36 ms | 1664 KB |
#include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define x first #define y second using namespace std; int n; int a[100005]; main(){ cin>>n; a[1]=1; for(int k=2;k<=n;k++){ cin>>a[k]; a[k]+=a[k-1]; } int ad=0; for(int k=1;k<=n;k++){ if(a[k]<0) ad=max(ad,abs(a[k])); } for(int k=1;k<=n;k++) a[k]+=ad; int mx=0; for(int k=1;k<=n;k++){ mx=max(mx,a[k]); } if(mx!=n) cout<<-1; else{ for(int k=1;k<=n;k++) cout<<a[k]<<' '; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 36 ms | 1664 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |