Submission #1019336

#TimeUsernameProblemLanguageResultExecution timeMemory
1019336overwatch9Labels (NOI20_labels)C++17
100 / 100
105 ms9044 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; vector <ll> d(n-1); for (int i = 0; i < n-1; i++) cin >> d[i]; vector <ll> nums(n); nums[0] = 0; for (int i = 0; i < n; i++) { nums[i+1] = nums[i] + d[i]; } ll x = *min_element(nums.begin(), nums.end()); x--; for (int i = 0; i < n; i++) nums[i] += (-x); if (*max_element(nums.begin(), nums.end()) < n) cout << -1 << '\n'; else { for (auto i : nums) cout << i << ' '; cout << '\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...