Submission #1019330

#TimeUsernameProblemLanguageResultExecution timeMemory
1019330overwatch9Labels (NOI20_labels)C++17
0 / 100
41 ms5200 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector <int> d(n-1); for (int i = 0; i < n-1; i++) cin >> d[i]; vector <int> nums(n); nums[0] = 1; bool possible = true; for (int i = 0; i < n; i++) { nums[i+1] = nums[i] + d[i]; if (nums[i+1] <= 0) possible = false; } if (!possible || *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...