답안 #320563

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320563 2020-11-09T05:57:03 Z strawberry2005 Labels (NOI20_labels) C++14
25 / 100
50 ms 4708 KB
#include<bits/stdc++.h>
#define deb(x) cout << #x << ": " << x << endl
using namespace std;


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long n;
    cin>>n;
    long long f[n-1];
    for(int i=0;i<n-1;i++) cin>>f[i];
    long long sum=0,status=0;

    for(int i=0;i<n-1;i++){
        sum+=f[i];
        if(abs(sum)>n-1){
            status=2;
            break;
        }
    }

    if(status!=2){
        sum=0;
        for(int i=0;i<n-1;i++){
            sum+=f[i];
            if(abs(sum)==n-1){
                status=1;
                break;
            }
        }
    }
    if(status==0||status==2) cout<<"-1";
    else{
        
        if(sum==n*-1+1){
            long long l=n;
            cout<<n<<" ";
            for(int i=0;i<n-1;i++){
                cout<<l+f[i]<<" ";
                l+=f[i];
            }
        }
        else{
            long long l=1;
            cout<<"1 ";
            for(int i=0;i<n-1;i++){
                cout<<l+f[i]<<" ";
                l+=f[i];
            }
        }
    }


    return(0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Incorrect 0 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Incorrect 0 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 4708 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 50 ms 4708 KB Output is correct
4 Correct 20 ms 2668 KB Output is correct
5 Correct 23 ms 2668 KB Output is correct
6 Correct 24 ms 2668 KB Output is correct
7 Correct 22 ms 2660 KB Output is correct
8 Correct 23 ms 2660 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Incorrect 0 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -