답안 #610973

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
610973 2022-07-28T20:53:34 Z Plurm 송금 (JOI19_remittance) C++11
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

int a[1000005];
int b[1000005];
int main() {
  int n;
  scanf("%d", &n);
  bool idenzero = true;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", a + i, b + i);
    if (b[i])
      idenzero = false;
  }
  for (int it = 0; it < 100; it++) {
    for (int i = 1; i <= n; i++) {
      if (a[i] > b[i]) {
        int transfer = (a[i] - b[i] + 1) / 2;
        a[i] -= 2 * transfer;
        a[i % n + 1] += transfer;
      }
    }
  }
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    if (a[i] != b[i])
      ok = false;
  }
  printf(ok ? "Yes\n" : "No\n");
  return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:9:8: warning: variable 'idenzero' set but not used [-Wunused-but-set-variable]
    9 |   bool idenzero = true;
      |        ^~~~~~~~
remittance.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d", &n);
      |   ~~~~~^~~~~~~~~~
remittance.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%d%d", a + i, b + i);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Incorrect 1 ms 308 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Incorrect 1 ms 308 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 308 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 308 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 312 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Incorrect 1 ms 308 KB Output isn't correct
21 Halted 0 ms 0 KB -