Submission #320547

#TimeUsernameProblemLanguageResultExecution timeMemory
320547ishi_10Labels (NOI20_labels)C++14
0 / 100
51 ms7016 KiB
#include<iostream> #include<cmath> #include<bits/stdc++.h> #include<string.h> using namespace std; typedef long long int ll; const ll maxn=1e5+2; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll n; cin>>n; ll a[n-1],i; for(i=0;i<n-1;i++) cin>>a[i]; ll s=0,f=0; for(i=0;i<n-1;i++) { s=s+a[i]; if(s==n-1) { f=1; //cout<<i<<"\n"; break; } } if(f==0) cout<<"-1"<<"\n"; else { //cout<<i<<"\n"; ll ans[n+1]; ans[i+1]=n; ll j; for(j=i;j>=0;j--) { ans[j]=ans[j+1]-a[j]; //cout<<ans[j]<<" "; } for(j=i+2;j<n;j++) { ans[j]=ans[j-1]+a[j-1]; } for(i=0;i<n;i++) cout<<ans[i]<<" "; cout<<"\n"; } cerr<<"\nTime elapsed:"<< 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; 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...