답안 #897588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897588 2024-01-03T13:05:04 Z NK_ 송금 (JOI19_remittance) C++17
100 / 100
266 ms 16212 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
 
using namespace std;
 
#define nl '\n'
 
using ll = long long;
template<class T> using V = vector<T>;
using vi = V<int>;
using vl = V<ll>;
 
 
const int MX = 3e7;
int main() {
	cin.tie(0)->sync_with_stdio(0);
	
	int N; cin >> N;
	vl A(N), B(N); for(int i = 0; i < N; i++) cin >> A[i] >> B[i];
 
	for(int t = 0; t < MX / N; t++) {
		for(int x = 0; x < N; x++) if (A[x] > B[x]) {
			ll amt = min(A[x] / 2, (A[x] - B[x] + 1) / 2);
			A[x] -= 2 * amt;
			A[(x + 1) % N] += amt;
		}
	}
 
	cout << (A == B ? "Yes" : "No") << nl;
 
	exit(0-0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 348 KB Output is correct
2 Correct 20 ms 448 KB Output is correct
3 Correct 19 ms 452 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 23 ms 348 KB Output is correct
6 Correct 28 ms 348 KB Output is correct
7 Correct 24 ms 348 KB Output is correct
8 Correct 20 ms 348 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 29 ms 344 KB Output is correct
11 Correct 22 ms 348 KB Output is correct
12 Correct 21 ms 344 KB Output is correct
13 Correct 27 ms 344 KB Output is correct
14 Correct 31 ms 348 KB Output is correct
15 Correct 24 ms 448 KB Output is correct
16 Correct 79 ms 428 KB Output is correct
17 Correct 41 ms 348 KB Output is correct
18 Correct 32 ms 344 KB Output is correct
19 Correct 30 ms 348 KB Output is correct
20 Correct 137 ms 436 KB Output is correct
21 Correct 138 ms 344 KB Output is correct
22 Correct 34 ms 428 KB Output is correct
23 Correct 116 ms 348 KB Output is correct
24 Correct 22 ms 444 KB Output is correct
25 Correct 24 ms 348 KB Output is correct
26 Correct 138 ms 424 KB Output is correct
27 Correct 22 ms 452 KB Output is correct
28 Correct 22 ms 456 KB Output is correct
29 Correct 22 ms 348 KB Output is correct
30 Correct 22 ms 600 KB Output is correct
31 Correct 139 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 348 KB Output is correct
2 Correct 20 ms 448 KB Output is correct
3 Correct 19 ms 452 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 23 ms 348 KB Output is correct
6 Correct 28 ms 348 KB Output is correct
7 Correct 24 ms 348 KB Output is correct
8 Correct 20 ms 348 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 29 ms 344 KB Output is correct
11 Correct 22 ms 348 KB Output is correct
12 Correct 21 ms 344 KB Output is correct
13 Correct 27 ms 344 KB Output is correct
14 Correct 31 ms 348 KB Output is correct
15 Correct 24 ms 448 KB Output is correct
16 Correct 79 ms 428 KB Output is correct
17 Correct 41 ms 348 KB Output is correct
18 Correct 32 ms 344 KB Output is correct
19 Correct 30 ms 348 KB Output is correct
20 Correct 137 ms 436 KB Output is correct
21 Correct 138 ms 344 KB Output is correct
22 Correct 34 ms 428 KB Output is correct
23 Correct 116 ms 348 KB Output is correct
24 Correct 22 ms 444 KB Output is correct
25 Correct 24 ms 348 KB Output is correct
26 Correct 138 ms 424 KB Output is correct
27 Correct 22 ms 452 KB Output is correct
28 Correct 22 ms 456 KB Output is correct
29 Correct 22 ms 348 KB Output is correct
30 Correct 22 ms 600 KB Output is correct
31 Correct 139 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
33 Correct 21 ms 456 KB Output is correct
34 Correct 21 ms 456 KB Output is correct
35 Correct 21 ms 348 KB Output is correct
36 Correct 19 ms 348 KB Output is correct
37 Correct 21 ms 348 KB Output is correct
38 Correct 24 ms 596 KB Output is correct
39 Correct 23 ms 456 KB Output is correct
40 Correct 21 ms 348 KB Output is correct
41 Correct 21 ms 348 KB Output is correct
42 Correct 20 ms 448 KB Output is correct
43 Correct 25 ms 348 KB Output is correct
44 Correct 22 ms 348 KB Output is correct
45 Correct 23 ms 452 KB Output is correct
46 Correct 20 ms 348 KB Output is correct
47 Correct 27 ms 344 KB Output is correct
48 Correct 21 ms 348 KB Output is correct
49 Correct 20 ms 344 KB Output is correct
50 Correct 140 ms 432 KB Output is correct
51 Correct 137 ms 344 KB Output is correct
52 Correct 77 ms 348 KB Output is correct
53 Correct 129 ms 428 KB Output is correct
54 Correct 21 ms 452 KB Output is correct
55 Correct 21 ms 348 KB Output is correct
56 Correct 137 ms 344 KB Output is correct
57 Correct 21 ms 344 KB Output is correct
58 Correct 21 ms 448 KB Output is correct
59 Correct 21 ms 348 KB Output is correct
60 Correct 21 ms 348 KB Output is correct
61 Correct 137 ms 348 KB Output is correct
62 Correct 24 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 348 KB Output is correct
2 Correct 20 ms 448 KB Output is correct
3 Correct 19 ms 452 KB Output is correct
4 Correct 20 ms 348 KB Output is correct
5 Correct 23 ms 348 KB Output is correct
6 Correct 28 ms 348 KB Output is correct
7 Correct 24 ms 348 KB Output is correct
8 Correct 20 ms 348 KB Output is correct
9 Correct 20 ms 348 KB Output is correct
10 Correct 29 ms 344 KB Output is correct
11 Correct 22 ms 348 KB Output is correct
12 Correct 21 ms 344 KB Output is correct
13 Correct 27 ms 344 KB Output is correct
14 Correct 31 ms 348 KB Output is correct
15 Correct 24 ms 448 KB Output is correct
16 Correct 79 ms 428 KB Output is correct
17 Correct 41 ms 348 KB Output is correct
18 Correct 32 ms 344 KB Output is correct
19 Correct 30 ms 348 KB Output is correct
20 Correct 137 ms 436 KB Output is correct
21 Correct 138 ms 344 KB Output is correct
22 Correct 34 ms 428 KB Output is correct
23 Correct 116 ms 348 KB Output is correct
24 Correct 22 ms 444 KB Output is correct
25 Correct 24 ms 348 KB Output is correct
26 Correct 138 ms 424 KB Output is correct
27 Correct 22 ms 452 KB Output is correct
28 Correct 22 ms 456 KB Output is correct
29 Correct 22 ms 348 KB Output is correct
30 Correct 22 ms 600 KB Output is correct
31 Correct 139 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
33 Correct 21 ms 456 KB Output is correct
34 Correct 21 ms 456 KB Output is correct
35 Correct 21 ms 348 KB Output is correct
36 Correct 19 ms 348 KB Output is correct
37 Correct 21 ms 348 KB Output is correct
38 Correct 24 ms 596 KB Output is correct
39 Correct 23 ms 456 KB Output is correct
40 Correct 21 ms 348 KB Output is correct
41 Correct 21 ms 348 KB Output is correct
42 Correct 20 ms 448 KB Output is correct
43 Correct 25 ms 348 KB Output is correct
44 Correct 22 ms 348 KB Output is correct
45 Correct 23 ms 452 KB Output is correct
46 Correct 20 ms 348 KB Output is correct
47 Correct 27 ms 344 KB Output is correct
48 Correct 21 ms 348 KB Output is correct
49 Correct 20 ms 344 KB Output is correct
50 Correct 140 ms 432 KB Output is correct
51 Correct 137 ms 344 KB Output is correct
52 Correct 77 ms 348 KB Output is correct
53 Correct 129 ms 428 KB Output is correct
54 Correct 21 ms 452 KB Output is correct
55 Correct 21 ms 348 KB Output is correct
56 Correct 137 ms 344 KB Output is correct
57 Correct 21 ms 344 KB Output is correct
58 Correct 21 ms 448 KB Output is correct
59 Correct 21 ms 348 KB Output is correct
60 Correct 21 ms 348 KB Output is correct
61 Correct 137 ms 348 KB Output is correct
62 Correct 24 ms 348 KB Output is correct
63 Correct 171 ms 15964 KB Output is correct
64 Correct 109 ms 15960 KB Output is correct
65 Correct 179 ms 16160 KB Output is correct
66 Correct 111 ms 16104 KB Output is correct
67 Correct 109 ms 15964 KB Output is correct
68 Correct 129 ms 16104 KB Output is correct
69 Correct 171 ms 16112 KB Output is correct
70 Correct 109 ms 15964 KB Output is correct
71 Correct 111 ms 15960 KB Output is correct
72 Correct 119 ms 16100 KB Output is correct
73 Correct 179 ms 16104 KB Output is correct
74 Correct 105 ms 15964 KB Output is correct
75 Correct 109 ms 16212 KB Output is correct
76 Correct 118 ms 16104 KB Output is correct
77 Correct 196 ms 16104 KB Output is correct
78 Correct 244 ms 15964 KB Output is correct
79 Correct 266 ms 16108 KB Output is correct
80 Correct 134 ms 15964 KB Output is correct
81 Correct 146 ms 16104 KB Output is correct
82 Correct 222 ms 16100 KB Output is correct
83 Correct 96 ms 15960 KB Output is correct
84 Correct 101 ms 16112 KB Output is correct
85 Correct 194 ms 15964 KB Output is correct
86 Correct 184 ms 16108 KB Output is correct
87 Correct 251 ms 15964 KB Output is correct
88 Correct 138 ms 15964 KB Output is correct