답안 #1022833

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1022833 2024-07-14T05:59:44 Z spensa Labels (NOI20_labels) C++17
0 / 100
28 ms 5172 KB
#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i=(signed)(a); i<=(signed)(b); i++)
#define F0R(i, a) for(int i=(signed)(0); i<(signed)(a); i++)

const int MXN = 3e5 + 10;
int diff[MXN] = {0};
int ps[MXN] = {0};

int main(){
    //faster io
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int N;
    cin>>N;

    FOR(i, 2, N){
        cin>>diff[i];
    }
    ps[1] = 1;
    int mx = 1;
    FOR(i, 2, N){
        ps[i] = ps[i-1] + diff[i];
        mx = max(mx, ps[i]);
    }

    if(mx==N){
        FOR(i, 1, N) cout<<ps[i]<<" ";
        cout<<"\n";
    }
    else{
        cout<<"-1\n";
    }


}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 460 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 460 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 460 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 5172 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 16 ms 3476 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 460 KB Output isn't correct
3 Halted 0 ms 0 KB -