Submission #847355

#TimeUsernameProblemLanguageResultExecution timeMemory
847355annabeth9680Labels (NOI20_labels)C++17
100 / 100
94 ms6852 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int MAXN = 3e5+5; ll dp[MAXN]; int main() { int N; cin >> N; ll minn = 0, maxx = 0; for(int i = 2;i<=N;++i){ ll x; cin >> x; dp[i] = dp[i-1]+x; minn = min(dp[i],minn); maxx = max(dp[i],maxx); } if(maxx-minn < N-1){ cout << -1 << "\n"; return 0; } for(int i = 1;i<=N;++i) cout << dp[i]-minn+1 << " "; 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...