# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
807710 | 2023-08-04T22:32:20 Z | dong_liu | Self Study (JOI22_ho_t2) | C++17 | 353 ms | 9092 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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 304 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 210 ms | 8388 KB | Output is correct |
12 | Correct | 210 ms | 8416 KB | Output is correct |
13 | Correct | 223 ms | 6516 KB | Output is correct |
14 | Correct | 266 ms | 6452 KB | Output is correct |
15 | Correct | 1 ms | 304 KB | Output is correct |
16 | Correct | 345 ms | 3880 KB | Output is correct |
17 | Correct | 227 ms | 9036 KB | Output is correct |
18 | Correct | 213 ms | 8432 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 304 KB | Output is correct |
2 | Correct | 345 ms | 3880 KB | Output is correct |
3 | Correct | 227 ms | 9036 KB | Output is correct |
4 | Correct | 213 ms | 8432 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 304 KB | Output is correct |
8 | Correct | 1 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 109 ms | 4352 KB | Output is correct |
14 | Correct | 72 ms | 3008 KB | Output is correct |
15 | Correct | 53 ms | 2352 KB | Output is correct |
16 | Correct | 44 ms | 1876 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 308 KB | Output is correct |
19 | Correct | 1 ms | 304 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 6 ms | 348 KB | Output is correct |
23 | Correct | 4 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 304 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 210 ms | 8388 KB | Output is correct |
12 | Correct | 210 ms | 8416 KB | Output is correct |
13 | Correct | 223 ms | 6516 KB | Output is correct |
14 | Correct | 266 ms | 6452 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 308 KB | Output is correct |
17 | Correct | 1 ms | 304 KB | Output is correct |
18 | Correct | 1 ms | 304 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 109 ms | 4352 KB | Output is correct |
24 | Correct | 72 ms | 3008 KB | Output is correct |
25 | Correct | 53 ms | 2352 KB | Output is correct |
26 | Correct | 44 ms | 1876 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 308 KB | Output is correct |
29 | Correct | 1 ms | 304 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 348 KB | Output is correct |
33 | Correct | 4 ms | 340 KB | Output is correct |
34 | Correct | 1 ms | 304 KB | Output is correct |
35 | Correct | 345 ms | 3880 KB | Output is correct |
36 | Correct | 227 ms | 9036 KB | Output is correct |
37 | Correct | 213 ms | 8432 KB | Output is correct |
38 | Correct | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 1 ms | 212 KB | Output is correct |
42 | Correct | 0 ms | 212 KB | Output is correct |
43 | Correct | 0 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 4 ms | 340 KB | Output is correct |
46 | Correct | 7 ms | 564 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 38 ms | 1688 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 308 KB | Output is correct |
51 | Correct | 4 ms | 320 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 | 107 ms | 4336 KB | Output is correct |
56 | Correct | 74 ms | 2348 KB | Output is correct |
57 | Correct | 90 ms | 2348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 308 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 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 | 109 ms | 4352 KB | Output is correct |
10 | Correct | 72 ms | 3008 KB | Output is correct |
11 | Correct | 53 ms | 2352 KB | Output is correct |
12 | Correct | 44 ms | 1876 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 304 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 6 ms | 348 KB | Output is correct |
19 | Correct | 4 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 304 KB | Output is correct |
21 | Correct | 345 ms | 3880 KB | Output is correct |
22 | Correct | 227 ms | 9036 KB | Output is correct |
23 | Correct | 213 ms | 8432 KB | Output is correct |
24 | Correct | 35 ms | 1468 KB | Output is correct |
25 | Correct | 104 ms | 3944 KB | Output is correct |
26 | Correct | 26 ms | 1168 KB | Output is correct |
27 | Correct | 212 ms | 8524 KB | Output is correct |
28 | Correct | 217 ms | 8364 KB | Output is correct |
29 | Correct | 219 ms | 8436 KB | Output is correct |
30 | Correct | 221 ms | 8376 KB | Output is correct |
31 | Correct | 214 ms | 8400 KB | Output is correct |
32 | Correct | 336 ms | 3800 KB | Output is correct |
33 | Correct | 212 ms | 9092 KB | Output is correct |
34 | Correct | 353 ms | 3804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 304 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 210 ms | 8388 KB | Output is correct |
12 | Correct | 210 ms | 8416 KB | Output is correct |
13 | Correct | 223 ms | 6516 KB | Output is correct |
14 | Correct | 266 ms | 6452 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 308 KB | Output is correct |
17 | Correct | 1 ms | 304 KB | Output is correct |
18 | Correct | 1 ms | 304 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 109 ms | 4352 KB | Output is correct |
24 | Correct | 72 ms | 3008 KB | Output is correct |
25 | Correct | 53 ms | 2352 KB | Output is correct |
26 | Correct | 44 ms | 1876 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 1 ms | 308 KB | Output is correct |
29 | Correct | 1 ms | 304 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 348 KB | Output is correct |
33 | Correct | 4 ms | 340 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 | 212 KB | Output is correct |
37 | Correct | 1 ms | 212 KB | Output is correct |
38 | Correct | 0 ms | 212 KB | Output is correct |
39 | Correct | 0 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 4 ms | 340 KB | Output is correct |
42 | Correct | 7 ms | 564 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 38 ms | 1688 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 308 KB | Output is correct |
47 | Correct | 4 ms | 320 KB | Output is correct |
48 | Correct | 1 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 | 107 ms | 4336 KB | Output is correct |
52 | Correct | 74 ms | 2348 KB | Output is correct |
53 | Correct | 90 ms | 2348 KB | Output is correct |
54 | Correct | 35 ms | 1468 KB | Output is correct |
55 | Correct | 104 ms | 3944 KB | Output is correct |
56 | Correct | 26 ms | 1168 KB | Output is correct |
57 | Correct | 212 ms | 8524 KB | Output is correct |
58 | Correct | 217 ms | 8364 KB | Output is correct |
59 | Correct | 219 ms | 8436 KB | Output is correct |
60 | Correct | 221 ms | 8376 KB | Output is correct |
61 | Correct | 214 ms | 8400 KB | Output is correct |
62 | Correct | 336 ms | 3800 KB | Output is correct |
63 | Correct | 212 ms | 9092 KB | Output is correct |
64 | Correct | 353 ms | 3804 KB | Output is correct |
65 | Correct | 1 ms | 304 KB | Output is correct |
66 | Correct | 345 ms | 3880 KB | Output is correct |
67 | Correct | 227 ms | 9036 KB | Output is correct |
68 | Correct | 213 ms | 8432 KB | Output is correct |
69 | Correct | 25 ms | 1188 KB | Output is correct |
70 | Correct | 7 ms | 468 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 33 ms | 1468 KB | Output is correct |
73 | Correct | 8 ms | 584 KB | Output is correct |
74 | Correct | 2 ms | 340 KB | Output is correct |
75 | Correct | 217 ms | 8356 KB | Output is correct |
76 | Correct | 225 ms | 8480 KB | Output is correct |
77 | Correct | 220 ms | 8340 KB | Output is correct |
78 | Correct | 233 ms | 8396 KB | Output is correct |
79 | Correct | 255 ms | 8396 KB | Output is correct |
80 | Correct | 226 ms | 8380 KB | Output is correct |
81 | Correct | 202 ms | 6400 KB | Output is correct |
82 | Correct | 202 ms | 6452 KB | Output is correct |