Submission #892956

#TimeUsernameProblemLanguageResultExecution timeMemory
892956votranngocvyLabels (NOI20_labels)C++14
100 / 100
45 ms5972 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int a[N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int Min = 0,Max = 0; bool ok = true; for (int i = 2; i <= n; i++) { cin >> a[i]; a[i] += a[i - 1]; Min = min(Min,a[i]); Max = max(Max,a[i]); } Min = abs(Min) + 1; if (Min + Max < n) { cout << -1 << "\n"; return 0; } for (int i = 1; i <= n; i++) cout << Min + a[i] << " "; cout << "\n"; }

Compilation message (stderr)

Labels.cpp: In function 'int main()':
Labels.cpp:13:10: warning: unused variable 'ok' [-Wunused-variable]
   13 |     bool ok = true;
      |          ^~
#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...