Submission #264939

#TimeUsernameProblemLanguageResultExecution timeMemory
264939eohomegrownappsLabels (NOI20_labels)C++14
100 / 100
79 ms5628 KiB
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios_base::sync_with_stdio(0); int n; cin>>n; vector<int> v(n); int minv = 0; int maxv = 0; int cur = 0; for (int i = 1; i<n; i++){ cin>>v[i]; cur+=v[i]; minv=min(minv,cur); maxv=max(maxv,cur); } if (maxv-minv==n-1){ int cur = n-maxv; cout<<cur<<' '; for (int i = 1; i<n; i++){ cur+=v[i]; cout<<cur<<' '; } 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...