# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
487565 |
2021-11-16T08:11:26 Z |
Biaz |
Labels (NOI20_labels) |
C++17 |
|
4 ms |
972 KB |
#include <bits/stdc++.h>
#define int long long
#define Nanase_Kurumi_aka_menhera_chan_is_mine ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb push_back
#define pi pair<int, int>
#define ALL(i) i.begin(),i.end()
#define gcd(i,j) __gcd(i,j)
#define fi first
#define se second
#define INF 10000000000
#define eps 0.00000001
#define ist insert
//#define mod 1000000007
#define N 100005
#define M 1000005
#define DNE nullptr
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC optimize("O2")
using namespace std;
typedef long long ll;
int min(int a, int b){return a < b ? a : b;}
int max(int a, int b){return a > b ? a : b;}
bool isprime(int k){bool is=1 ; for ( int i = 2 ; i*i <= k ; i++ ) if ( k % i == 0 ) is = 0 ; return k>1?is:0;}
const double PI=acos(-1);
/*int read(){
int s=0,w=1;
char c=getchar();
while (c<'0'||c>'9'){if (c=='-')w=-1;c=getchar();}
while (c>='0'&&c<='9') s=s*10+c-'0',c=getchar();
return s*w;
}*/
int n;
int a[N];
void sol(){
cin >>n;
int sum=0,mx=-INF,mn=INF;
for (int i=1;i<n;i++)
cin >>a[i];
for (int i=1;i<n;i++){
sum+=a[i];
mx=max(mx,sum);
mn=min(mn,sum);
}
mn=min(mn,0);
if (mx-mn!=(n-1)) cout <<"-1";
else{
int d=n-mx;
cout <<d<<" ";
for (int i=1;i<n;i++)
a[i]+=a[i-1],cout <<d+a[i]<<" ";
}
}
signed main(){
Nanase_Kurumi_aka_menhera_chan_is_mine
int _=1;
//cin >>_;
while (_--)sol();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
972 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |