Submission #284836

#TimeUsernameProblemLanguageResultExecution timeMemory
284836wildturtleLabels (NOI20_labels)C++14
100 / 100
250 ms4856 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,i,e,f,g,n,m,k,l,A[500005],minn,maxx; int main() { cin>>n; A[1]=1; for(long long i=1;i<n;i++) { cin>>a; A[i+1]=A[i]+a; } minn=A[1]; for(long long i=1;i<=n;i++) { minn=min(minn,A[i]); } for(long long i=1;i<=n;i++) { A[i]+=(1-minn); maxx=max(maxx,A[i]); } if(maxx!=n) { cout<<-1; return 0; } for(long long i=1;i<=n;i++) { cout<<A[i]<<" "; } }
#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...