Submission #596020

# Submission time Handle Problem Language Result Execution time Memory
596020 2022-07-14T09:21:20 Z chinmoy_101 Labels (NOI20_labels) C++14
0 / 100
82 ms 8152 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    ll n, pre=0;
    cin>>n;
    ll d[n];
    ll a[n];
    for(ll i=1; i<=n-1; i++)
    {
        cin>>d[i];
        pre+=d[i];
    }
    a[n]=pre+1;
    for(ll i=n-1; i>=1; i--)
    {
        a[i]=a[i+1] - d[i];
    }
    for(ll i=1; i<=n-1; i++)
    {
        if(a[i]==a[i+1])
        {
            cout<<"-1";
            return 0;
        }
    }
    for(ll i=1; i<=n; i++)
        cout<<a[i] <<" ";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 66 ms 7488 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 82 ms 8152 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -