Submission #261265

#TimeUsernameProblemLanguageResultExecution timeMemory
261265BertedLabels (NOI20_labels)C++14
100 / 100
101 ms6888 KiB
#include <iostream> #define ll long long using namespace std; int n; long long pref[300001]; int main() { ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; ll mn = 0, mx = 0; for (int i = 1; i < n; i++) { int x; cin >> x; pref[i] = pref[i - 1] + x; mn = min(mn, pref[i]); mx = max(mx, pref[i]); } if (mx - mn + 1 == n) { ll sft = -mn + 1; for (int i = 0; i < n; i++) { cout << pref[i] + sft; if (i < n) cout << " "; } cout << "\n"; } else {cout << "-1\n";} return 0; }
#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...