답안 #833659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833659 2023-08-22T07:34:23 Z Liudas Labels (NOI20_labels) C++17
0 / 100
106 ms 21004 KB
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <climits>
#include <algorithm>
#define int long long
using namespace std;
signed main(){
    int N;
    cin >> N;
    vector<int> arr(N-1);
    for(int i = 0; i < N-1; i++){
        cin >> arr[i];
    }
    set<int> is;
    is.insert(1);
    vector<int> brr(1, 1);
    int last = 1;
    for(int i = 0; i < N-1; i ++){
        int a = arr[i] + last;
        last = a;
        is.insert(a);
        brr.push_back(a);
    }
    if(*is.begin() > 1 || *(--is.end()) < N){
        cout << -1 <<endl;
        return 0;
    }
    int shift = *is.begin() - 1;
    for(int i : brr){
        cout << i - shift << " ";
    }
    cout << endl;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 21004 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 94 ms 19000 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -