Submission #1022836

#TimeUsernameProblemLanguageResultExecution timeMemory
1022836spensaLabels (NOI20_labels)C++17
0 / 100
25 ms4608 KiB
#include <iostream> #include <cmath> using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define FOR(i, a, b) for(int i=(signed)(a); i<=(signed)(b); i++) #define F0R(i, a) for(int i=(signed)(0); i<(signed)(a); i++) const int MXN = 3e5 + 10; int diff[MXN] = {0}; int ps[MXN] = {0}; int main(){ //faster io ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin>>N; FOR(i, 2, N){ cin>>diff[i]; } ps[1] = 1; int mx = 1; int mn = 1; FOR(i, 2, N){ ps[i] = ps[i-1] + diff[i]; mx = max(mx, ps[i]); mn = min(mn, ps[i]); } if(mn<1){ ps[1] += 1-mn; } FOR(i, 2, N){ ps[i] = ps[i-1] + diff[i]; mx = max(mx, ps[i]); mn = min(mn, ps[i]); } if(mx==N){ FOR(i, 1, N) cout<<ps[i]<<" "; cout<<"\n"; } else{ cout<<"-1\n"; } }
#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...