# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
692253 | 2023-02-01T08:56:44 Z | bdl | Self Study (JOI22_ho_t2) | C++17 | 398 ms | 9092 KB |
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #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 | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 244 ms | 2576 KB | Output is correct |
12 | Correct | 230 ms | 2628 KB | Output is correct |
13 | Correct | 246 ms | 2628 KB | Output is correct |
14 | Correct | 301 ms | 2628 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 398 ms | 3808 KB | Output is correct |
17 | Correct | 275 ms | 9088 KB | Output is correct |
18 | Correct | 257 ms | 8332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 398 ms | 3808 KB | Output is correct |
3 | Correct | 275 ms | 9088 KB | Output is correct |
4 | Correct | 257 ms | 8332 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 | 1 ms | 212 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 | 1 ms | 212 KB | Output is correct |
13 | Correct | 138 ms | 1464 KB | Output is correct |
14 | Correct | 78 ms | 1068 KB | Output is correct |
15 | Correct | 63 ms | 872 KB | Output is correct |
16 | Correct | 57 ms | 756 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 6 ms | 344 KB | Output is correct |
23 | Correct | 5 ms | 444 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 244 ms | 2576 KB | Output is correct |
12 | Correct | 230 ms | 2628 KB | Output is correct |
13 | Correct | 246 ms | 2628 KB | Output is correct |
14 | Correct | 301 ms | 2628 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 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 | 1 ms | 212 KB | Output is correct |
23 | Correct | 138 ms | 1464 KB | Output is correct |
24 | Correct | 78 ms | 1068 KB | Output is correct |
25 | Correct | 63 ms | 872 KB | Output is correct |
26 | Correct | 57 ms | 756 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 344 KB | Output is correct |
33 | Correct | 5 ms | 444 KB | Output is correct |
34 | Correct | 1 ms | 212 KB | Output is correct |
35 | Correct | 398 ms | 3808 KB | Output is correct |
36 | Correct | 275 ms | 9088 KB | Output is correct |
37 | Correct | 257 ms | 8332 KB | Output is correct |
38 | Correct | 1 ms | 308 KB | Output is correct |
39 | Correct | 1 ms | 304 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 1 ms | 304 KB | Output is correct |
42 | Correct | 1 ms | 212 KB | Output is correct |
43 | Correct | 1 ms | 212 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 5 ms | 340 KB | Output is correct |
46 | Correct | 10 ms | 468 KB | Output is correct |
47 | Correct | 1 ms | 344 KB | Output is correct |
48 | Correct | 42 ms | 1696 KB | Output is correct |
49 | Correct | 1 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 4 ms | 412 KB | Output is correct |
52 | Correct | 0 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 | 134 ms | 4272 KB | Output is correct |
56 | Correct | 93 ms | 2244 KB | Output is correct |
57 | Correct | 102 ms | 2288 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 | 0 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 | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 138 ms | 1464 KB | Output is correct |
10 | Correct | 78 ms | 1068 KB | Output is correct |
11 | Correct | 63 ms | 872 KB | Output is correct |
12 | Correct | 57 ms | 756 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 6 ms | 344 KB | Output is correct |
19 | Correct | 5 ms | 444 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 398 ms | 3808 KB | Output is correct |
22 | Correct | 275 ms | 9088 KB | Output is correct |
23 | Correct | 257 ms | 8332 KB | Output is correct |
24 | Correct | 40 ms | 1552 KB | Output is correct |
25 | Correct | 118 ms | 3872 KB | Output is correct |
26 | Correct | 30 ms | 1108 KB | Output is correct |
27 | Correct | 247 ms | 8440 KB | Output is correct |
28 | Correct | 242 ms | 8428 KB | Output is correct |
29 | Correct | 249 ms | 8436 KB | Output is correct |
30 | Correct | 275 ms | 8364 KB | Output is correct |
31 | Correct | 240 ms | 8432 KB | Output is correct |
32 | Correct | 372 ms | 3804 KB | Output is correct |
33 | Correct | 237 ms | 9092 KB | Output is correct |
34 | Correct | 395 ms | 3804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 244 ms | 2576 KB | Output is correct |
12 | Correct | 230 ms | 2628 KB | Output is correct |
13 | Correct | 246 ms | 2628 KB | Output is correct |
14 | Correct | 301 ms | 2628 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 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 | 1 ms | 212 KB | Output is correct |
23 | Correct | 138 ms | 1464 KB | Output is correct |
24 | Correct | 78 ms | 1068 KB | Output is correct |
25 | Correct | 63 ms | 872 KB | Output is correct |
26 | Correct | 57 ms | 756 KB | Output is correct |
27 | Correct | 1 ms | 212 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 1 ms | 212 KB | Output is correct |
30 | Correct | 0 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 344 KB | Output is correct |
33 | Correct | 5 ms | 444 KB | Output is correct |
34 | Correct | 1 ms | 308 KB | Output is correct |
35 | Correct | 1 ms | 304 KB | Output is correct |
36 | Correct | 0 ms | 212 KB | Output is correct |
37 | Correct | 1 ms | 304 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 | 5 ms | 340 KB | Output is correct |
42 | Correct | 10 ms | 468 KB | Output is correct |
43 | Correct | 1 ms | 344 KB | Output is correct |
44 | Correct | 42 ms | 1696 KB | Output is correct |
45 | Correct | 1 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 4 ms | 412 KB | Output is correct |
48 | Correct | 0 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 | 134 ms | 4272 KB | Output is correct |
52 | Correct | 93 ms | 2244 KB | Output is correct |
53 | Correct | 102 ms | 2288 KB | Output is correct |
54 | Correct | 40 ms | 1552 KB | Output is correct |
55 | Correct | 118 ms | 3872 KB | Output is correct |
56 | Correct | 30 ms | 1108 KB | Output is correct |
57 | Correct | 247 ms | 8440 KB | Output is correct |
58 | Correct | 242 ms | 8428 KB | Output is correct |
59 | Correct | 249 ms | 8436 KB | Output is correct |
60 | Correct | 275 ms | 8364 KB | Output is correct |
61 | Correct | 240 ms | 8432 KB | Output is correct |
62 | Correct | 372 ms | 3804 KB | Output is correct |
63 | Correct | 237 ms | 9092 KB | Output is correct |
64 | Correct | 395 ms | 3804 KB | Output is correct |
65 | Correct | 1 ms | 212 KB | Output is correct |
66 | Correct | 398 ms | 3808 KB | Output is correct |
67 | Correct | 275 ms | 9088 KB | Output is correct |
68 | Correct | 257 ms | 8332 KB | Output is correct |
69 | Correct | 32 ms | 1172 KB | Output is correct |
70 | Correct | 7 ms | 532 KB | Output is correct |
71 | Correct | 1 ms | 308 KB | Output is correct |
72 | Correct | 41 ms | 1472 KB | Output is correct |
73 | Correct | 10 ms | 576 KB | Output is correct |
74 | Correct | 2 ms | 340 KB | Output is correct |
75 | Correct | 244 ms | 8364 KB | Output is correct |
76 | Correct | 251 ms | 8396 KB | Output is correct |
77 | Correct | 261 ms | 8440 KB | Output is correct |
78 | Correct | 277 ms | 8376 KB | Output is correct |
79 | Correct | 287 ms | 8528 KB | Output is correct |
80 | Correct | 256 ms | 8440 KB | Output is correct |
81 | Correct | 257 ms | 6448 KB | Output is correct |
82 | Correct | 233 ms | 6452 KB | Output is correct |