답안 #869118

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869118 2023-11-03T08:59:14 Z tvladm2009 Labels (NOI20_labels) C++17
0 / 100
29 ms 5204 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N = (int) 3e5 + 7;
int n, a[N], pre[N];

int main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

  // freopen("input", "r", stdin);

  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a[i];
  }
  int mx = 0, mn = 0;
  for (int i = 1; i < n; i++) {
    pre[i] = pre[i - 1] + a[i];
    mx = max(mx, pre[i]);
    mn = min(mn, pre[i]);
  }
  int low = mn + 1, high = n - mx;
  if (low == high) {
    cout << low << " ";
    for (int i = 1; i < n; i++) {
      low += a[i];
      cout << low << " ";
    }
    cout << "\n";
    return 0;
  }
  cout << "-1\n";
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 5204 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Incorrect 13 ms 3656 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Halted 0 ms 0 KB -