| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 383400 | MODDI | Labels (NOI20_labels) | C++14 | 52 ms | 3808 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
#define mnto(x, y) x = min(x, (__typeof__(x)) y)
#define mxto(x, y) x = max(x, (__typeof__(x)) y)
using namespace std;
int main(){
int n;
cin>>n;
vi d,pref(n), ori;
for(int i = 0; i < n-1; i++){
int a;
cin>>a;
d.pb(a);
}
int sm;
for(int i = 1; i < n; i++){
pref[i] = pref[i - 1] + d[i - 1];
mnto(sm, pref[i]);
}
int mx = 0;
for(int i = 0; i <n; i++){
pref[i]-=sm;
mxto(mx, pref[i]);
}
if(mx != n - 1)
cout<<-1<<endl;
else
{
for(int i = 0; i < n; i++)
cout<<pref[i] + 1<<" ";
}
return 0;
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
