Submission #1022833

# Submission time Handle Problem Language Result Execution time Memory
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";
    }


}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -