| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1330021 | michael12 | Labels (NOI20_labels) | C++20 | 59 ms | 4576 KiB |
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define endl '\n'
#define int long long
using namespace std;
const int maxn = 1e6 + 5;
const int inf = 1e9 + 5;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> a(n, 0);
for(int i = 1; i < n; i++){
cin >> a[i];
}
for(int i = 2; i < n; i++){
a[i] += a[i - 1];
}
int mx = - inf, mn = inf;
for(int i = 1; i < n; i++){
mx = max(mx, a[i]);
mn = min(mn, a[i]);
}
int cnt = 0, ans = 0;
for(int i = 1; i <= n; i++){
if(i + mx <= n && i + mn >= 1){
cnt += 1;
ans = i;
}
}
if(!cnt || cnt > 1){
cout << "-1";
}
else{
for(int i = 0; i < n; i++){
cout << ans + a[i] << " ";
}
}
}| # | 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... | ||||
