Submission #897586

# Submission time Handle Problem Language Result Execution time Memory
897586 2024-01-03T13:03:18 Z NK_ Remittance (JOI19_remittance) C++17
100 / 100
254 ms 26596 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);
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 348 KB Output is correct
2 Correct 19 ms 348 KB Output is correct
3 Correct 21 ms 348 KB Output is correct
4 Correct 21 ms 348 KB Output is correct
5 Correct 24 ms 348 KB Output is correct
6 Correct 25 ms 348 KB Output is correct
7 Correct 23 ms 344 KB Output is correct
8 Correct 21 ms 456 KB Output is correct
9 Correct 23 ms 348 KB Output is correct
10 Correct 31 ms 348 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 20 ms 456 KB Output is correct
13 Correct 21 ms 344 KB Output is correct
14 Correct 32 ms 348 KB Output is correct
15 Correct 23 ms 348 KB Output is correct
16 Correct 78 ms 436 KB Output is correct
17 Correct 42 ms 428 KB Output is correct
18 Correct 36 ms 348 KB Output is correct
19 Correct 29 ms 348 KB Output is correct
20 Correct 139 ms 756 KB Output is correct
21 Correct 137 ms 428 KB Output is correct
22 Correct 28 ms 344 KB Output is correct
23 Correct 116 ms 544 KB Output is correct
24 Correct 22 ms 348 KB Output is correct
25 Correct 29 ms 444 KB Output is correct
26 Correct 137 ms 344 KB Output is correct
27 Correct 24 ms 348 KB Output is correct
28 Correct 22 ms 348 KB Output is correct
29 Correct 21 ms 348 KB Output is correct
30 Correct 22 ms 460 KB Output is correct
31 Correct 138 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 348 KB Output is correct
2 Correct 19 ms 348 KB Output is correct
3 Correct 21 ms 348 KB Output is correct
4 Correct 21 ms 348 KB Output is correct
5 Correct 24 ms 348 KB Output is correct
6 Correct 25 ms 348 KB Output is correct
7 Correct 23 ms 344 KB Output is correct
8 Correct 21 ms 456 KB Output is correct
9 Correct 23 ms 348 KB Output is correct
10 Correct 31 ms 348 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 20 ms 456 KB Output is correct
13 Correct 21 ms 344 KB Output is correct
14 Correct 32 ms 348 KB Output is correct
15 Correct 23 ms 348 KB Output is correct
16 Correct 78 ms 436 KB Output is correct
17 Correct 42 ms 428 KB Output is correct
18 Correct 36 ms 348 KB Output is correct
19 Correct 29 ms 348 KB Output is correct
20 Correct 139 ms 756 KB Output is correct
21 Correct 137 ms 428 KB Output is correct
22 Correct 28 ms 344 KB Output is correct
23 Correct 116 ms 544 KB Output is correct
24 Correct 22 ms 348 KB Output is correct
25 Correct 29 ms 444 KB Output is correct
26 Correct 137 ms 344 KB Output is correct
27 Correct 24 ms 348 KB Output is correct
28 Correct 22 ms 348 KB Output is correct
29 Correct 21 ms 348 KB Output is correct
30 Correct 22 ms 460 KB Output is correct
31 Correct 138 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
33 Correct 21 ms 344 KB Output is correct
34 Correct 21 ms 348 KB Output is correct
35 Correct 21 ms 348 KB Output is correct
36 Correct 21 ms 452 KB Output is correct
37 Correct 24 ms 348 KB Output is correct
38 Correct 25 ms 452 KB Output is correct
39 Correct 23 ms 348 KB Output is correct
40 Correct 25 ms 348 KB Output is correct
41 Correct 24 ms 348 KB Output is correct
42 Correct 20 ms 344 KB Output is correct
43 Correct 25 ms 348 KB Output is correct
44 Correct 26 ms 348 KB Output is correct
45 Correct 23 ms 348 KB Output is correct
46 Correct 21 ms 348 KB Output is correct
47 Correct 23 ms 600 KB Output is correct
48 Correct 21 ms 348 KB Output is correct
49 Correct 21 ms 348 KB Output is correct
50 Correct 139 ms 432 KB Output is correct
51 Correct 140 ms 432 KB Output is correct
52 Correct 77 ms 344 KB Output is correct
53 Correct 129 ms 344 KB Output is correct
54 Correct 21 ms 348 KB Output is correct
55 Correct 25 ms 348 KB Output is correct
56 Correct 141 ms 432 KB Output is correct
57 Correct 21 ms 344 KB Output is correct
58 Correct 21 ms 452 KB Output is correct
59 Correct 21 ms 348 KB Output is correct
60 Correct 21 ms 452 KB Output is correct
61 Correct 139 ms 428 KB Output is correct
62 Correct 22 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 348 KB Output is correct
2 Correct 19 ms 348 KB Output is correct
3 Correct 21 ms 348 KB Output is correct
4 Correct 21 ms 348 KB Output is correct
5 Correct 24 ms 348 KB Output is correct
6 Correct 25 ms 348 KB Output is correct
7 Correct 23 ms 344 KB Output is correct
8 Correct 21 ms 456 KB Output is correct
9 Correct 23 ms 348 KB Output is correct
10 Correct 31 ms 348 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 20 ms 456 KB Output is correct
13 Correct 21 ms 344 KB Output is correct
14 Correct 32 ms 348 KB Output is correct
15 Correct 23 ms 348 KB Output is correct
16 Correct 78 ms 436 KB Output is correct
17 Correct 42 ms 428 KB Output is correct
18 Correct 36 ms 348 KB Output is correct
19 Correct 29 ms 348 KB Output is correct
20 Correct 139 ms 756 KB Output is correct
21 Correct 137 ms 428 KB Output is correct
22 Correct 28 ms 344 KB Output is correct
23 Correct 116 ms 544 KB Output is correct
24 Correct 22 ms 348 KB Output is correct
25 Correct 29 ms 444 KB Output is correct
26 Correct 137 ms 344 KB Output is correct
27 Correct 24 ms 348 KB Output is correct
28 Correct 22 ms 348 KB Output is correct
29 Correct 21 ms 348 KB Output is correct
30 Correct 22 ms 460 KB Output is correct
31 Correct 138 ms 428 KB Output is correct
32 Correct 22 ms 348 KB Output is correct
33 Correct 21 ms 344 KB Output is correct
34 Correct 21 ms 348 KB Output is correct
35 Correct 21 ms 348 KB Output is correct
36 Correct 21 ms 452 KB Output is correct
37 Correct 24 ms 348 KB Output is correct
38 Correct 25 ms 452 KB Output is correct
39 Correct 23 ms 348 KB Output is correct
40 Correct 25 ms 348 KB Output is correct
41 Correct 24 ms 348 KB Output is correct
42 Correct 20 ms 344 KB Output is correct
43 Correct 25 ms 348 KB Output is correct
44 Correct 26 ms 348 KB Output is correct
45 Correct 23 ms 348 KB Output is correct
46 Correct 21 ms 348 KB Output is correct
47 Correct 23 ms 600 KB Output is correct
48 Correct 21 ms 348 KB Output is correct
49 Correct 21 ms 348 KB Output is correct
50 Correct 139 ms 432 KB Output is correct
51 Correct 140 ms 432 KB Output is correct
52 Correct 77 ms 344 KB Output is correct
53 Correct 129 ms 344 KB Output is correct
54 Correct 21 ms 348 KB Output is correct
55 Correct 25 ms 348 KB Output is correct
56 Correct 141 ms 432 KB Output is correct
57 Correct 21 ms 344 KB Output is correct
58 Correct 21 ms 452 KB Output is correct
59 Correct 21 ms 348 KB Output is correct
60 Correct 21 ms 452 KB Output is correct
61 Correct 139 ms 428 KB Output is correct
62 Correct 22 ms 344 KB Output is correct
63 Correct 186 ms 26088 KB Output is correct
64 Correct 106 ms 18256 KB Output is correct
65 Correct 184 ms 25832 KB Output is correct
66 Correct 105 ms 18412 KB Output is correct
67 Correct 117 ms 18924 KB Output is correct
68 Correct 118 ms 20048 KB Output is correct
69 Correct 177 ms 25944 KB Output is correct
70 Correct 106 ms 18260 KB Output is correct
71 Correct 112 ms 18772 KB Output is correct
72 Correct 118 ms 20200 KB Output is correct
73 Correct 170 ms 25936 KB Output is correct
74 Correct 125 ms 18276 KB Output is correct
75 Correct 114 ms 18916 KB Output is correct
76 Correct 124 ms 20052 KB Output is correct
77 Correct 183 ms 25936 KB Output is correct
78 Correct 254 ms 22244 KB Output is correct
79 Correct 245 ms 22100 KB Output is correct
80 Correct 141 ms 22356 KB Output is correct
81 Correct 140 ms 22252 KB Output is correct
82 Correct 215 ms 18284 KB Output is correct
83 Correct 102 ms 18256 KB Output is correct
84 Correct 99 ms 18264 KB Output is correct
85 Correct 174 ms 26452 KB Output is correct
86 Correct 202 ms 26596 KB Output is correct
87 Correct 252 ms 22864 KB Output is correct
88 Correct 138 ms 16216 KB Output is correct