Submission #970327

#TimeUsernameProblemLanguageResultExecution timeMemory
970327VMaksimoski008Labels (NOI20_labels)C++17
100 / 100
109 ms6992 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll n, mx=0, mn=1e9, cnt=0, a=0; cin >> n; vector<ll> d(n); for(int i=1; i<n; i++) cin >> d[i], d[i] += d[i-1]; for(int i=0; i<n; i++) mn = min(mn, d[i]), mx = max(mx, d[i]); for(int i=1; i<=n; i++) if(i + mn >= 1 && i + mn <= n && i + mx >= 1 && i + mx <= n) cnt++, a = i; if(cnt != 1) { cout << -1 << '\n'; return 0; } for(ll &x : d) cout << a + x << " "; 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...