Submission #288222

#TimeUsernameProblemLanguageResultExecution timeMemory
288222someone_aaLabels (NOI20_labels)C++17
100 / 100
245 ms6776 KiB
#include <bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define sz(x) int(x.size()) using namespace std; const int maxn = 300100; ll n, d[maxn]; int main() { cin>>n; ll minpoint = INT_MAX, maxpoint = INT_MIN; ll sum = 0LL; for(int i=1;i<n;i++) { cin>>d[i]; sum += d[i]; minpoint = min(minpoint, sum); maxpoint = max(maxpoint, sum); } vector<int>starts; for(int i=1;i<=n;i++) { if(i + minpoint >= 1 && i + maxpoint <= n) starts.pb(i); } if(sz(starts) != 1) { cout<<"-1\n"; return 0; } int curr = starts[0]; cout<<curr<<" "; for(int i=1;i<n;i++) { curr += d[i]; cout<<curr<<" "; } cout<<"\n"; return 0; }
#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...