Submission #892466

#TimeUsernameProblemLanguageResultExecution timeMemory
892466adaawfLabels (NOI20_labels)C++14
100 / 100
39 ms6772 KiB
#include <iostream> using namespace std; long long int a[300005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, c = 0, ma = 0, mi = 0; cin >> n; for (int i = 2; i <= n; i++) { cin >> a[i]; c += a[i]; ma = max(ma, c); mi = min(mi, c); } if (ma - mi == n - 1) { long long int c = 0, h = 1 - mi; for (int i = 1; i <= n; i++) { c += a[i]; cout << h + c << " "; } } else cout << -1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...