Submission #739179

#TimeUsernameProblemLanguageResultExecution timeMemory
739179UnforgettableplLabels (NOI20_labels)C++17
100 / 100
54 ms9040 KiB
/* ID: samikgo1 TASK: LANG: C++ */ #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> pii; #define all(x) x.begin(),x.end() #define allr(x) x.rbegin(),x.rend() //#define f first //#define s second //#define x first //#define y second const int INF = INT32_MAX; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); // freopen("measurement.in","r",stdin); // freopen("measurement.out","w",stdout); int n; cin >> n; vector<ll> arr(n-1); for(ll&i:arr)cin>>i; vector<ll> prefix(n); ll min_p = 0; ll max_p = 0; for (int i = 1; i < n; i++) { prefix[i] = prefix[i - 1] + arr[i - 1]; min_p = min(min_p,prefix[i]); max_p = max(max_p,prefix[i]); } if(n-max_p!=1-min_p){cout<<"-1";return 0;} for(ll&i:prefix){ cout << i+1-min_p << ' '; } }
#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...