Submission #284835

#TimeUsernameProblemLanguageResultExecution timeMemory
284835achibasadzishviliLabels (NOI20_labels)C++14
100 / 100
66 ms5300 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define s second #define pb push_back using namespace std; ll n,d[2000005],p; int main(){ ios::sync_with_stdio(false); cin >> n; ll l = 1 , r = n; for(int i=1; i<n; i++){ cin >> d[i]; p += d[i]; l += d[i]; r += d[i]; if(l < 1)l = 1; if(l > n)l = n; if(r < 1)r = 1; if(r > n)r = n; } if(l != r){ cout << -1; return 0; } l -= p; cout << l << " "; for(int i=1; i<n; i++){ l += d[i]; cout << l << " "; } 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...