Submission #853416

#TimeUsernameProblemLanguageResultExecution timeMemory
853416annabeth9680Labels (NOI20_labels)C++17
100 / 100
48 ms6908 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int MAXN = 3e5+5; ll dp[MAXN]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; ll mn = 0, mx = 0; for(int i = 1;i<N;++i){ ll d; cin >> d; dp[i] = dp[i-1] + d; mn = min(mn,dp[i]); mx = max(mx,dp[i]); } if(mx-mn < N-1){ cout << -1 << "\n"; return 0; } for(int i = 0;i<N;++i) cout << dp[i]-mn+1 << " "; cout << "\n"; }
#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...