Submission #872921

#TimeUsernameProblemLanguageResultExecution timeMemory
872921vjudge1Labels (NOI20_labels)C++17
0 / 100
49 ms3408 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int N; cin>>N; int D[N-1]; int diff=1; int mini=INT_MAX,maxe=-INT_MAX; for(int i=0; i<N-1; i++){ cin>>D[i]; diff+=D[i]; if(diff>maxe){ maxe=diff; } if(diff<mini){ mini=diff; } } if(abs(mini-maxe)>=N-1){ int soln=N-maxe; for(int i=0; i<N-1; i++){ cout<<soln<<' '; soln+=D[i]; } cout<<soln; } else if(mini==1-N){ int soln=N; for(int i=0; i<N-1; i++){ cout<<soln<<' '; soln+=D[i]; } cout<<soln; } else if(maxe==N){ int soln=1; for(int i=0; i<N-1; i++){ cout<<soln<<' '; soln+=D[i]; } cout<<soln; } else{ cout<<-1; } }
#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...