Submission #1019330

# Submission time Handle Problem Language Result Execution time Memory
1019330 2024-07-10T17:42:00 Z overwatch9 Labels (NOI20_labels) C++17
0 / 100
41 ms 5200 KB
#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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 41 ms 5200 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 31 ms 3512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -