Submission #833656

#TimeUsernameProblemLanguageResultExecution timeMemory
833656HollaFoilLabels (NOI20_labels)C++14
100 / 100
118 ms4588 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> delta(n-1); vector<int> nums(n); for (int i = 0; i < n-1; i++) cin >> delta[i]; nums[0] = 1; int mini = 1; int maxi = 1; for (int i = 0; i < n-1; i++) { nums[i+1] = nums[i] + delta[i]; mini = min(nums[i+1], mini); maxi = max(nums[i+1], maxi); } int shift = 1 - mini; maxi += shift; if (maxi != n) { cout << "-1"; return 0; } for (int i = 0; i < n; i++) { cout << nums[i]+shift << " "; } 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...