Submission #891787

#TimeUsernameProblemLanguageResultExecution timeMemory
891787vjudge1Labels (NOI20_labels)C++14
100 / 100
59 ms6748 KiB
#include<bits/stdc++.h> using namespace std; const int N=3e5+1; int n, d[N], a[N]; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n; for (int i=2; i<=n; ++i) cin >> d[i]; partial_sum(d, d+n+1, a); int m=*min_element(a+1, a+n+1); for (int i=1; i<=n; ++i) a[i]=a[i]+1-m; m=*max_element(a+1, a+n+1); if (m!=n){ cout << -1; return 0; } for (int i=1; i<=n; ++i) cout << a[i] << " \n"[i==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...