답안 #610974

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

int a[1000005];
int b[1000005];
int main() {
  int n;
  scanf("%d", &n);
  bool idenzeroa = true;
  bool idenzerob = true;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", a + i, b + i);
    if (a[i])
      idenzeroa = false;
    if (b[i])
      idenzerob = false;
  }
  if (idenzerob) {
    printf(idenzeroa ? "Yes\n" : "No\n");
    return 0;
  }
  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: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:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d", a + i, b + i);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 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 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 308 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 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 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 308 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 312 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 308 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 308 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 304 KB Output is correct
43 Correct 0 ms 304 KB Output is correct
44 Correct 1 ms 312 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 308 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 308 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 312 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 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 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 312 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 308 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 312 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 308 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 304 KB Output is correct
39 Correct 1 ms 308 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 304 KB Output is correct
43 Correct 0 ms 304 KB Output is correct
44 Correct 1 ms 312 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 308 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 308 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 1 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 312 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 291 ms 8336 KB Output is correct
64 Correct 245 ms 10408 KB Output is correct
65 Correct 276 ms 8340 KB Output is correct
66 Correct 213 ms 10408 KB Output is correct
67 Correct 229 ms 11192 KB Output is correct
68 Correct 229 ms 12724 KB Output is correct
69 Correct 265 ms 8376 KB Output is correct
70 Correct 223 ms 10364 KB Output is correct
71 Correct 209 ms 11184 KB Output is correct
72 Correct 223 ms 12660 KB Output is correct
73 Correct 284 ms 8348 KB Output is correct
74 Correct 215 ms 10312 KB Output is correct
75 Correct 218 ms 11240 KB Output is correct
76 Correct 225 ms 12616 KB Output is correct
77 Correct 280 ms 8228 KB Output is correct
78 Correct 182 ms 12832 KB Output is correct
79 Correct 188 ms 12716 KB Output is correct
80 Correct 238 ms 12652 KB Output is correct
81 Correct 243 ms 12716 KB Output is correct
82 Correct 155 ms 10464 KB Output is correct
83 Correct 190 ms 10388 KB Output is correct
84 Correct 143 ms 10316 KB Output is correct
85 Correct 282 ms 8292 KB Output is correct
86 Correct 299 ms 8220 KB Output is correct
87 Correct 188 ms 12716 KB Output is correct
88 Correct 260 ms 12716 KB Output is correct