제출 #1122788

#제출 시각아이디문제언어결과실행 시간메모리
1122788ChocoLabels (NOI20_labels)C++20
0 / 100
37 ms4796 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; int mx=0; vector<int> d(n-1,0); int sum=0; for(int i =0;i<n-1;i++){ cin>>d[i]; mx=max(mx , sum+=d[i]); } vector<int> arr; int s=n - mx; arr.pb(s); int pref =s; for(auto v:d){ pref+=v; arr.pb(pref); } for(auto v:arr){ if(v<=0 && v>n){ cout<<"-1"<<endl; return; } } for(auto v:arr){ cout<<v<<" "; } cout<<endl; } 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...