Submission #1122783

#TimeUsernameProblemLanguageResultExecution timeMemory
1122783ChocoLabels (NOI20_labels)C++20
7 / 100
37 ms7344 KiB
#include<bits/stdc++.h> using namespace std; #define Study ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define ll long long #define ull unsigned long long #define pb push_back #define ff first #define ss second #define ins insert #define all(x) x.begin(),x.end() #define fori(x,y,z) for(ll x=y;x<=z;x++) const ll INF=1e9; const ll sz=2e5+10; const ll mod=1e9+7; void work(){ ll n; cin>>n; vector<ll>d(n+10); ll sum=0; ll minimum=INF,maximum=-INF; bool have=0; fori(i,1,n-1){ ll a; cin>>a; sum+=a; d[i]=sum; if(a==0) have=1; minimum=min(d[i],minimum); maximum=max(maximum,d[i]); } vector<ll>ans; if(have==1){ cout<<-1; return; } ll s=n-maximum; if(maximum<=0) s=n; ans.pb(s); have=0; fori(i,1,n-1){ //cout<<d[i]<<" "; ans.pb(d[i]+s); if(d[i]+s<=0) have=1; } if(have==1){ cout<<-1; return; } fori(i,0,n-1) cout<<ans[i]<<' '; } int main(){ Study; ll t=1; //cin>>t; while(t--){ work(); } }
#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...