답안 #495549

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495549 2021-12-19T10:38:13 Z 600Mihnea 송금 (JOI19_remittance) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int N = (int) 1e6 + 7;
int n;
int a[N];
int b[N];

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

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

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  while (true) {
    bool change = false;
    for (int i = 0; i < n; i++) {
      int j = (i + 1) % n;
      int extra = a[i] - b[i];
      if (extra >= 1) {
        change = true;
        a[i] -= (extra + 1) / 2 * 2;
        a[j] += (extra + 1) / 2;
      }
    }
    if (!change) {
      break;
    }
  }

  for (int i = 0; i < n; i++) {
    if (a[i] != b[i]) {
      cout << "No\n";
      exit(0);
    }
  }

  cout << "Yes\n";




  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 328 KB Output is correct
15 Correct 0 ms 308 KB Output is correct
16 Correct 0 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Incorrect 0 ms 208 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 328 KB Output is correct
15 Correct 0 ms 308 KB Output is correct
16 Correct 0 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Incorrect 0 ms 208 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 ms 324 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 328 KB Output is correct
15 Correct 0 ms 308 KB Output is correct
16 Correct 0 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Incorrect 0 ms 208 KB Output isn't correct
21 Halted 0 ms 0 KB -