Submission #320518

# Submission time Handle Problem Language Result Execution time Memory
320518 2020-11-09T03:13:05 Z strawberry2005 Labels (NOI20_labels) C++14
25 / 100
52 ms 3576 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);
    int n;
    cin>>n;
    int 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=1;
            break;
        }
    }
    if(status==0) cout<<"-1";
    else{
        
        if(sum==n*-1+1){
            int l=n;
            cout<<n<<" ";
            for(int i=0;i<n-1;i++){
                cout<<l+f[i]<<" ";
                l+=f[i];
            }
        }
        else{
            int l=1;
            cout<<"1 ";
            for(int i=0;i<n-1;i++){
                cout<<l+f[i]<<" ";
                l+=f[i];
            }
        }
    }


    return(0);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 3556 KB Output is correct
2 Correct 1 ms 492 KB Output is correct
3 Correct 52 ms 3576 KB Output is correct
4 Correct 20 ms 1508 KB Output is correct
5 Correct 22 ms 1508 KB Output is correct
6 Correct 23 ms 1516 KB Output is correct
7 Correct 21 ms 1516 KB Output is correct
8 Correct 23 ms 1508 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -