# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
602260 | 2022-07-22T19:24:22 Z | Devigo | Labels (NOI20_labels) | C++14 | 41 ms | 5932 KB |
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair const int siz = 0; const int mod = 0; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<int> v(n-1); for(int i=0; i<n-1; i++) { cin >> v[i]; } bool ok = 0; int sum = 1; vector<int> ans; ans.pb(sum); for(int i=0; i<n-1; i++) { sum += v[i]; ans.pb(sum); } vector<int> an = ans; sort(ans.begin(), ans.end()); if(ans[n-1] == n && ans[0] == 1) { ok = 1; } if(!ok) { cout << "-1\n"; } else { int x = 1; for(int j: an) cout << j << " "; cout << "\n"; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 5932 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 21 ms | 3924 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |