# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
894222 | 2023-12-28T02:58:10 Z | box | Self Study (JOI22_ho_t2) | C++17 | 354 ms | 9220 KB |
#include <array> #include <iostream> using namespace std; const int N = 3e5; const long long INF = 1e18; int main() { int n, m; scanf("%d%d", &n, &m); static int a[N], b[N]; for (int i = 0; i < n; i++) scanf("%d", &a[i]); for (int i = 0; i < n; i++) { scanf("%d", &b[i]); a[i] = max(a[i], b[i]); } long long low = 0, hi = INF; while (low < hi) { long long t = (low + hi) / 2 + 1, c = 0; for (int i = 0; i < n; i++) { long long x = (t + a[i] - 1) / a[i]; if (x <= m) c += m - x; else c = max(-INF, c - (t - 1LL * m * a[i] + b[i] - 1) / b[i]); } if (c >= 0) low = t; else hi = t - 1; } printf("%lld\n", low); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2488 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 4 ms | 2396 KB | Output is correct |
11 | Correct | 236 ms | 8376 KB | Output is correct |
12 | Correct | 214 ms | 8520 KB | Output is correct |
13 | Correct | 218 ms | 6328 KB | Output is correct |
14 | Correct | 267 ms | 6736 KB | Output is correct |
15 | Correct | 1 ms | 2396 KB | Output is correct |
16 | Correct | 345 ms | 3932 KB | Output is correct |
17 | Correct | 228 ms | 9220 KB | Output is correct |
18 | Correct | 213 ms | 8580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 345 ms | 3932 KB | Output is correct |
3 | Correct | 228 ms | 9220 KB | Output is correct |
4 | Correct | 213 ms | 8580 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 1 ms | 2492 KB | Output is correct |
11 | Correct | 1 ms | 2396 KB | Output is correct |
12 | Correct | 0 ms | 2488 KB | Output is correct |
13 | Correct | 108 ms | 5572 KB | Output is correct |
14 | Correct | 72 ms | 4580 KB | Output is correct |
15 | Correct | 55 ms | 3932 KB | Output is correct |
16 | Correct | 44 ms | 3676 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 0 ms | 2492 KB | Output is correct |
19 | Correct | 1 ms | 2392 KB | Output is correct |
20 | Correct | 1 ms | 2392 KB | Output is correct |
21 | Correct | 1 ms | 2396 KB | Output is correct |
22 | Correct | 6 ms | 2396 KB | Output is correct |
23 | Correct | 4 ms | 2392 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2488 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 4 ms | 2396 KB | Output is correct |
11 | Correct | 236 ms | 8376 KB | Output is correct |
12 | Correct | 214 ms | 8520 KB | Output is correct |
13 | Correct | 218 ms | 6328 KB | Output is correct |
14 | Correct | 267 ms | 6736 KB | Output is correct |
15 | Correct | 1 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 1 ms | 2396 KB | Output is correct |
19 | Correct | 1 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2492 KB | Output is correct |
21 | Correct | 1 ms | 2396 KB | Output is correct |
22 | Correct | 0 ms | 2488 KB | Output is correct |
23 | Correct | 108 ms | 5572 KB | Output is correct |
24 | Correct | 72 ms | 4580 KB | Output is correct |
25 | Correct | 55 ms | 3932 KB | Output is correct |
26 | Correct | 44 ms | 3676 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2492 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 1 ms | 2392 KB | Output is correct |
31 | Correct | 1 ms | 2396 KB | Output is correct |
32 | Correct | 6 ms | 2396 KB | Output is correct |
33 | Correct | 4 ms | 2392 KB | Output is correct |
34 | Correct | 1 ms | 2396 KB | Output is correct |
35 | Correct | 345 ms | 3932 KB | Output is correct |
36 | Correct | 228 ms | 9220 KB | Output is correct |
37 | Correct | 213 ms | 8580 KB | Output is correct |
38 | Correct | 1 ms | 2396 KB | Output is correct |
39 | Correct | 1 ms | 2396 KB | Output is correct |
40 | Correct | 1 ms | 2492 KB | Output is correct |
41 | Correct | 1 ms | 2396 KB | Output is correct |
42 | Correct | 1 ms | 2396 KB | Output is correct |
43 | Correct | 1 ms | 2396 KB | Output is correct |
44 | Correct | 1 ms | 2396 KB | Output is correct |
45 | Correct | 4 ms | 2396 KB | Output is correct |
46 | Correct | 7 ms | 2652 KB | Output is correct |
47 | Correct | 2 ms | 2504 KB | Output is correct |
48 | Correct | 38 ms | 3640 KB | Output is correct |
49 | Correct | 1 ms | 2396 KB | Output is correct |
50 | Correct | 1 ms | 2396 KB | Output is correct |
51 | Correct | 4 ms | 2600 KB | Output is correct |
52 | Correct | 1 ms | 2396 KB | Output is correct |
53 | Correct | 1 ms | 2396 KB | Output is correct |
54 | Correct | 1 ms | 2492 KB | Output is correct |
55 | Correct | 121 ms | 5528 KB | Output is correct |
56 | Correct | 83 ms | 3924 KB | Output is correct |
57 | Correct | 91 ms | 3760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2492 KB | Output is correct |
7 | Correct | 1 ms | 2396 KB | Output is correct |
8 | Correct | 0 ms | 2488 KB | Output is correct |
9 | Correct | 108 ms | 5572 KB | Output is correct |
10 | Correct | 72 ms | 4580 KB | Output is correct |
11 | Correct | 55 ms | 3932 KB | Output is correct |
12 | Correct | 44 ms | 3676 KB | Output is correct |
13 | Correct | 1 ms | 2396 KB | Output is correct |
14 | Correct | 0 ms | 2492 KB | Output is correct |
15 | Correct | 1 ms | 2392 KB | Output is correct |
16 | Correct | 1 ms | 2392 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 6 ms | 2396 KB | Output is correct |
19 | Correct | 4 ms | 2392 KB | Output is correct |
20 | Correct | 1 ms | 2396 KB | Output is correct |
21 | Correct | 345 ms | 3932 KB | Output is correct |
22 | Correct | 228 ms | 9220 KB | Output is correct |
23 | Correct | 213 ms | 8580 KB | Output is correct |
24 | Correct | 35 ms | 3444 KB | Output is correct |
25 | Correct | 115 ms | 5256 KB | Output is correct |
26 | Correct | 24 ms | 3164 KB | Output is correct |
27 | Correct | 214 ms | 8472 KB | Output is correct |
28 | Correct | 225 ms | 8392 KB | Output is correct |
29 | Correct | 217 ms | 8568 KB | Output is correct |
30 | Correct | 235 ms | 8568 KB | Output is correct |
31 | Correct | 214 ms | 8516 KB | Output is correct |
32 | Correct | 339 ms | 3920 KB | Output is correct |
33 | Correct | 218 ms | 9140 KB | Output is correct |
34 | Correct | 354 ms | 3936 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2488 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2396 KB | Output is correct |
7 | Correct | 1 ms | 2392 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 1 ms | 2396 KB | Output is correct |
10 | Correct | 4 ms | 2396 KB | Output is correct |
11 | Correct | 236 ms | 8376 KB | Output is correct |
12 | Correct | 214 ms | 8520 KB | Output is correct |
13 | Correct | 218 ms | 6328 KB | Output is correct |
14 | Correct | 267 ms | 6736 KB | Output is correct |
15 | Correct | 1 ms | 2396 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 1 ms | 2396 KB | Output is correct |
19 | Correct | 1 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2492 KB | Output is correct |
21 | Correct | 1 ms | 2396 KB | Output is correct |
22 | Correct | 0 ms | 2488 KB | Output is correct |
23 | Correct | 108 ms | 5572 KB | Output is correct |
24 | Correct | 72 ms | 4580 KB | Output is correct |
25 | Correct | 55 ms | 3932 KB | Output is correct |
26 | Correct | 44 ms | 3676 KB | Output is correct |
27 | Correct | 1 ms | 2396 KB | Output is correct |
28 | Correct | 0 ms | 2492 KB | Output is correct |
29 | Correct | 1 ms | 2392 KB | Output is correct |
30 | Correct | 1 ms | 2392 KB | Output is correct |
31 | Correct | 1 ms | 2396 KB | Output is correct |
32 | Correct | 6 ms | 2396 KB | Output is correct |
33 | Correct | 4 ms | 2392 KB | Output is correct |
34 | Correct | 1 ms | 2396 KB | Output is correct |
35 | Correct | 1 ms | 2396 KB | Output is correct |
36 | Correct | 1 ms | 2492 KB | Output is correct |
37 | Correct | 1 ms | 2396 KB | Output is correct |
38 | Correct | 1 ms | 2396 KB | Output is correct |
39 | Correct | 1 ms | 2396 KB | Output is correct |
40 | Correct | 1 ms | 2396 KB | Output is correct |
41 | Correct | 4 ms | 2396 KB | Output is correct |
42 | Correct | 7 ms | 2652 KB | Output is correct |
43 | Correct | 2 ms | 2504 KB | Output is correct |
44 | Correct | 38 ms | 3640 KB | Output is correct |
45 | Correct | 1 ms | 2396 KB | Output is correct |
46 | Correct | 1 ms | 2396 KB | Output is correct |
47 | Correct | 4 ms | 2600 KB | Output is correct |
48 | Correct | 1 ms | 2396 KB | Output is correct |
49 | Correct | 1 ms | 2396 KB | Output is correct |
50 | Correct | 1 ms | 2492 KB | Output is correct |
51 | Correct | 121 ms | 5528 KB | Output is correct |
52 | Correct | 83 ms | 3924 KB | Output is correct |
53 | Correct | 91 ms | 3760 KB | Output is correct |
54 | Correct | 35 ms | 3444 KB | Output is correct |
55 | Correct | 115 ms | 5256 KB | Output is correct |
56 | Correct | 24 ms | 3164 KB | Output is correct |
57 | Correct | 214 ms | 8472 KB | Output is correct |
58 | Correct | 225 ms | 8392 KB | Output is correct |
59 | Correct | 217 ms | 8568 KB | Output is correct |
60 | Correct | 235 ms | 8568 KB | Output is correct |
61 | Correct | 214 ms | 8516 KB | Output is correct |
62 | Correct | 339 ms | 3920 KB | Output is correct |
63 | Correct | 218 ms | 9140 KB | Output is correct |
64 | Correct | 354 ms | 3936 KB | Output is correct |
65 | Correct | 1 ms | 2396 KB | Output is correct |
66 | Correct | 345 ms | 3932 KB | Output is correct |
67 | Correct | 228 ms | 9220 KB | Output is correct |
68 | Correct | 213 ms | 8580 KB | Output is correct |
69 | Correct | 32 ms | 3244 KB | Output is correct |
70 | Correct | 7 ms | 2904 KB | Output is correct |
71 | Correct | 1 ms | 2396 KB | Output is correct |
72 | Correct | 33 ms | 3404 KB | Output is correct |
73 | Correct | 9 ms | 2600 KB | Output is correct |
74 | Correct | 1 ms | 2396 KB | Output is correct |
75 | Correct | 228 ms | 8384 KB | Output is correct |
76 | Correct | 259 ms | 8576 KB | Output is correct |
77 | Correct | 220 ms | 8388 KB | Output is correct |
78 | Correct | 232 ms | 8568 KB | Output is correct |
79 | Correct | 239 ms | 8532 KB | Output is correct |
80 | Correct | 225 ms | 8528 KB | Output is correct |
81 | Correct | 201 ms | 6580 KB | Output is correct |
82 | Correct | 201 ms | 6484 KB | Output is correct |