Submission #1084232

#TimeUsernameProblemLanguageResultExecution timeMemory
1084232_rain_Labels (NOI20_labels)C++14
100 / 100
42 ms5612 KiB
#include<bits/stdc++.h> using namespace std; #define fixbug true #define ll long long const int maxn = 3e5; int D[maxn+2] , sum = 0; int n; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define name "main" //freopen(name".inp","r",stdin); //freopen(name".out","w",stdout); cin >> n; ll mn = n + 1 , mx = 0 , sum = 0; for (int i = 1; i < n; ++i){ cin >> D[i]; sum += D[i]; mn = min(mn , sum); mx = max(mx , sum); } int p = -1; for (int i = 1; i <= n; ++i){ if (mn + i > 0 && mx + i <= n){ if (p!=-1){ cout << -1; exit(0); } p = i; } } if (p==-1){ cout << -1; exit(0);} cout << p << ' '; for (int i = 1; i < n; ++i) { p += D[i]; cout << p << ' '; } exit(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...