Submission #1122766

#TimeUsernameProblemLanguageResultExecution timeMemory
1122766ChocoLabels (NOI20_labels)C++20
0 / 100
39 ms7088 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; fori(i,1,n-1){ ll a; cin>>a; sum+=a; d[i]=sum; minimum=min(d[i],minimum); } vector<ll>ans; if(minimum<0){ minimum=abs(minimum)+1; ans.pb(minimum); fori(i,1,n-1){ ans.pb(d[i]+minimum); } } else{ minimum=1; ans.pb(minimum); fori(i,1,n-1){ ans.pb(d[i]+minimum); } } 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...