Submission #284855

#TimeUsernameProblemLanguageResultExecution timeMemory
284855akobiLabels (NOI20_labels)C++98
100 / 100
88 ms3576 KiB
#include <bits/stdc++.h> #define ll int using namespace std; ll n,mx,mn,a[300005]; int main() { ios_base::sync_with_stdio(false); cin>>n; mn=0; mx=0; for (int i=1; i<n; i++) { cin>>a[i]; a[i]+=a[i-1]; mn=min(mn,a[i]); mx=max(mx,a[i]); } if (mx-mn!=n-1) { cout<<-1<<endl; return 0; } for (int i=0; i<n; i++) printf("%d ",a[i]-mn+1); // cout<<a[i]-mn+1<<" "; printf("\n"); // cout<<endl; 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...