답안 #863207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863207 2023-10-19T18:28:01 Z sq00 Labels (NOI20_labels) C++14
7 / 100
32 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<int>d(n - 1);
    int x = 1e6, diff = 0;
    map<int, int>mp;
    for(int i = 0; i < n - 1; i++) {
        cin >> d[i];
        diff += d[i];
        x = min(x, diff);
        mp[x]++;
    }
    if(x < 0) x = abs(x) + 1;
    if(mp[x] > 1 || (n == 2 && x == 0)) {
        cout << -1;
        return 0;
    }
    cout << x << " ";
    int curVal = x;
    for(int i = 0; i < n - 1; i++) {
        curVal += d[i];
        cout << curVal << " ";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 432 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -