Submission #709023

# Submission time Handle Problem Language Result Execution time Memory
709023 2023-03-13T04:21:21 Z awu Labels (NOI20_labels) C++14
0 / 100
35 ms 7528 KB
#include <bits/extc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

#define int long long
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) do{auto y = x; cout << #x << " = " << y << endl;}while(0)
// #define endl "\n"
#define unordered_map __gnu_pbds::gp_hash_table
using pii = pair<int, int>;

const int inf = 1ll << 60;
const int MOD = 1e9 + 7;

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n; cin >> n;
  vector<int> d(n - 1);
  for(int i = 0; i < n - 1; i++) {
    cin >> d[i];
  }
  vector<int> r(n);
  for(int i = 0; i < n - 1; i++) {
    r[i + 1] = r[i] + d[i];
  }
  int m = *min_element(all(r));
  for(int i = 0; i < n; i++) {
    r[i] += m;
  }
  if(*max_element(all(r)) == n - 1) {
    for(auto x : r) {
      cout << x + 1 << " ";
    }
    cout << endl;
  } else {
    cout << -1 << endl;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 7528 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Incorrect 27 ms 5860 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -