# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
526869 | 2022-02-16T12:46:27 Z | eecs | Self Study (JOI22_ho_t2) | C++17 | 297 ms | 9564 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 300010; int n, m; ll a[maxn], b[maxn]; int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%lld", &a[i]); } for (int i = 1; i <= n; i++) { scanf("%lld", &b[i]); } auto chk = [&](ll lim) { __int128 sum = 0; for (int i = 1; i <= n; i++) { ll rem = lim; if (a[i] > b[i]) { ll t = min(1LL * m, (lim + a[i] - 1) / a[i]); sum += t, rem -= t * a[i]; } if (rem >= 0) sum += (rem + b[i] - 1) / b[i]; } return sum <= 1LL * n * m; }; ll l = 0, r = 1e18, ans; while (l <= r) { ll mid = (l + r) / 2; chk(mid) ? l = (ans = mid) + 1 : r = mid - 1; } printf("%lld\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 220 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 300 KB | Output is correct |
10 | Correct | 5 ms | 460 KB | Output is correct |
11 | Correct | 215 ms | 9424 KB | Output is correct |
12 | Correct | 216 ms | 9348 KB | Output is correct |
13 | Correct | 194 ms | 6540 KB | Output is correct |
14 | Correct | 297 ms | 8632 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 213 ms | 5096 KB | Output is correct |
17 | Correct | 160 ms | 5108 KB | Output is correct |
18 | Correct | 162 ms | 5060 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 213 ms | 5096 KB | Output is correct |
3 | Correct | 160 ms | 5108 KB | Output is correct |
4 | Correct | 162 ms | 5060 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 204 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 83 ms | 2756 KB | Output is correct |
14 | Correct | 55 ms | 1976 KB | Output is correct |
15 | Correct | 41 ms | 1608 KB | Output is correct |
16 | Correct | 35 ms | 1356 KB | Output is correct |
17 | Correct | 1 ms | 336 KB | Output is correct |
18 | Correct | 0 ms | 204 KB | Output is correct |
19 | Correct | 0 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 208 KB | Output is correct |
22 | Correct | 5 ms | 336 KB | Output is correct |
23 | Correct | 4 ms | 456 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 220 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 300 KB | Output is correct |
10 | Correct | 5 ms | 460 KB | Output is correct |
11 | Correct | 215 ms | 9424 KB | Output is correct |
12 | Correct | 216 ms | 9348 KB | Output is correct |
13 | Correct | 194 ms | 6540 KB | Output is correct |
14 | Correct | 297 ms | 8632 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 204 KB | Output is correct |
22 | Correct | 0 ms | 204 KB | Output is correct |
23 | Correct | 83 ms | 2756 KB | Output is correct |
24 | Correct | 55 ms | 1976 KB | Output is correct |
25 | Correct | 41 ms | 1608 KB | Output is correct |
26 | Correct | 35 ms | 1356 KB | Output is correct |
27 | Correct | 1 ms | 336 KB | Output is correct |
28 | Correct | 0 ms | 204 KB | Output is correct |
29 | Correct | 0 ms | 204 KB | Output is correct |
30 | Correct | 1 ms | 204 KB | Output is correct |
31 | Correct | 0 ms | 208 KB | Output is correct |
32 | Correct | 5 ms | 336 KB | Output is correct |
33 | Correct | 4 ms | 456 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
35 | Correct | 213 ms | 5096 KB | Output is correct |
36 | Correct | 160 ms | 5108 KB | Output is correct |
37 | Correct | 162 ms | 5060 KB | Output is correct |
38 | Correct | 1 ms | 208 KB | Output is correct |
39 | Correct | 1 ms | 288 KB | Output is correct |
40 | Correct | 0 ms | 204 KB | Output is correct |
41 | Correct | 0 ms | 204 KB | Output is correct |
42 | Correct | 1 ms | 204 KB | Output is correct |
43 | Correct | 0 ms | 204 KB | Output is correct |
44 | Correct | 0 ms | 204 KB | Output is correct |
45 | Correct | 5 ms | 568 KB | Output is correct |
46 | Correct | 7 ms | 460 KB | Output is correct |
47 | Correct | 1 ms | 204 KB | Output is correct |
48 | Correct | 38 ms | 1596 KB | Output is correct |
49 | Correct | 0 ms | 304 KB | Output is correct |
50 | Correct | 1 ms | 208 KB | Output is correct |
51 | Correct | 4 ms | 464 KB | Output is correct |
52 | Correct | 1 ms | 304 KB | Output is correct |
53 | Correct | 0 ms | 208 KB | Output is correct |
54 | Correct | 1 ms | 208 KB | Output is correct |
55 | Correct | 103 ms | 4208 KB | Output is correct |
56 | Correct | 54 ms | 2412 KB | Output is correct |
57 | Correct | 100 ms | 2528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 256 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 | 83 ms | 2756 KB | Output is correct |
10 | Correct | 55 ms | 1976 KB | Output is correct |
11 | Correct | 41 ms | 1608 KB | Output is correct |
12 | Correct | 35 ms | 1356 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 208 KB | Output is correct |
18 | Correct | 5 ms | 336 KB | Output is correct |
19 | Correct | 4 ms | 456 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 213 ms | 5096 KB | Output is correct |
22 | Correct | 160 ms | 5108 KB | Output is correct |
23 | Correct | 162 ms | 5060 KB | Output is correct |
24 | Correct | 34 ms | 1128 KB | Output is correct |
25 | Correct | 99 ms | 2456 KB | Output is correct |
26 | Correct | 18 ms | 836 KB | Output is correct |
27 | Correct | 166 ms | 5096 KB | Output is correct |
28 | Correct | 180 ms | 5084 KB | Output is correct |
29 | Correct | 170 ms | 5040 KB | Output is correct |
30 | Correct | 194 ms | 5180 KB | Output is correct |
31 | Correct | 217 ms | 5036 KB | Output is correct |
32 | Correct | 233 ms | 5104 KB | Output is correct |
33 | Correct | 246 ms | 5144 KB | Output is correct |
34 | Correct | 234 ms | 5032 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 220 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 300 KB | Output is correct |
10 | Correct | 5 ms | 460 KB | Output is correct |
11 | Correct | 215 ms | 9424 KB | Output is correct |
12 | Correct | 216 ms | 9348 KB | Output is correct |
13 | Correct | 194 ms | 6540 KB | Output is correct |
14 | Correct | 297 ms | 8632 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 0 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 0 ms | 204 KB | Output is correct |
21 | Correct | 0 ms | 204 KB | Output is correct |
22 | Correct | 0 ms | 204 KB | Output is correct |
23 | Correct | 83 ms | 2756 KB | Output is correct |
24 | Correct | 55 ms | 1976 KB | Output is correct |
25 | Correct | 41 ms | 1608 KB | Output is correct |
26 | Correct | 35 ms | 1356 KB | Output is correct |
27 | Correct | 1 ms | 336 KB | Output is correct |
28 | Correct | 0 ms | 204 KB | Output is correct |
29 | Correct | 0 ms | 204 KB | Output is correct |
30 | Correct | 1 ms | 204 KB | Output is correct |
31 | Correct | 0 ms | 208 KB | Output is correct |
32 | Correct | 5 ms | 336 KB | Output is correct |
33 | Correct | 4 ms | 456 KB | Output is correct |
34 | Correct | 1 ms | 208 KB | Output is correct |
35 | Correct | 1 ms | 288 KB | Output is correct |
36 | Correct | 0 ms | 204 KB | Output is correct |
37 | Correct | 0 ms | 204 KB | Output is correct |
38 | Correct | 1 ms | 204 KB | Output is correct |
39 | Correct | 0 ms | 204 KB | Output is correct |
40 | Correct | 0 ms | 204 KB | Output is correct |
41 | Correct | 5 ms | 568 KB | Output is correct |
42 | Correct | 7 ms | 460 KB | Output is correct |
43 | Correct | 1 ms | 204 KB | Output is correct |
44 | Correct | 38 ms | 1596 KB | Output is correct |
45 | Correct | 0 ms | 304 KB | Output is correct |
46 | Correct | 1 ms | 208 KB | Output is correct |
47 | Correct | 4 ms | 464 KB | Output is correct |
48 | Correct | 1 ms | 304 KB | Output is correct |
49 | Correct | 0 ms | 208 KB | Output is correct |
50 | Correct | 1 ms | 208 KB | Output is correct |
51 | Correct | 103 ms | 4208 KB | Output is correct |
52 | Correct | 54 ms | 2412 KB | Output is correct |
53 | Correct | 100 ms | 2528 KB | Output is correct |
54 | Correct | 34 ms | 1128 KB | Output is correct |
55 | Correct | 99 ms | 2456 KB | Output is correct |
56 | Correct | 18 ms | 836 KB | Output is correct |
57 | Correct | 166 ms | 5096 KB | Output is correct |
58 | Correct | 180 ms | 5084 KB | Output is correct |
59 | Correct | 170 ms | 5040 KB | Output is correct |
60 | Correct | 194 ms | 5180 KB | Output is correct |
61 | Correct | 217 ms | 5036 KB | Output is correct |
62 | Correct | 233 ms | 5104 KB | Output is correct |
63 | Correct | 246 ms | 5144 KB | Output is correct |
64 | Correct | 234 ms | 5032 KB | Output is correct |
65 | Correct | 1 ms | 204 KB | Output is correct |
66 | Correct | 213 ms | 5096 KB | Output is correct |
67 | Correct | 160 ms | 5108 KB | Output is correct |
68 | Correct | 162 ms | 5060 KB | Output is correct |
69 | Correct | 27 ms | 948 KB | Output is correct |
70 | Correct | 8 ms | 424 KB | Output is correct |
71 | Correct | 0 ms | 204 KB | Output is correct |
72 | Correct | 37 ms | 1120 KB | Output is correct |
73 | Correct | 9 ms | 424 KB | Output is correct |
74 | Correct | 1 ms | 332 KB | Output is correct |
75 | Correct | 245 ms | 6988 KB | Output is correct |
76 | Correct | 213 ms | 6752 KB | Output is correct |
77 | Correct | 227 ms | 6140 KB | Output is correct |
78 | Correct | 227 ms | 5132 KB | Output is correct |
79 | Correct | 240 ms | 6684 KB | Output is correct |
80 | Correct | 261 ms | 9564 KB | Output is correct |
81 | Correct | 220 ms | 6488 KB | Output is correct |
82 | Correct | 253 ms | 6816 KB | Output is correct |