Submission #287089

#TimeUsernameProblemLanguageResultExecution timeMemory
287089sabamakuLabels (NOI20_labels)C++14
100 / 100
257 ms8320 KiB
#include<bits/stdc++.h> using namespace std; long long n,d[2000005],man,mix,ans,x,cur,a[200005]; int main(){ cin >> n; man = 1e18; for(int i = 1; i < n; i++){ cin >> d[i]; ans += d[i]; mix = max(mix,ans); man = min(man,ans); } for(int i = 1; i <= n; i++){ if(i + ans >= 1 && i + ans <= n && i + mix >= 1 && i + mix <= n && i + man >= 1 && i + man <= n){ x++; cur = i; } } if(x == 1){ a[1] = cur; for(int i = 1; i < n; i++){ a[i + 1] = a[i] + d[i]; cout << a[i] << " "; } cout << a[n]; } else cout << -1 << endl; }
#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...