# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776234 | 2023-07-07T13:19:07 Z | RecursiveCo | Self Study (JOI22_ho_t2) | C++14 | 213 ms | 15076 KB |
// CF template, version 3.0 #include <bits/stdc++.h> using namespace std; #define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0) #define getTest int t; cin >> t #define eachTest for (int _var=0;_var<t;_var++) #define get(name) int (name); cin >> (name) #define out(o) cout << (o) #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); } #define sortl(name) sort((name).begin(), (name).end()) #define rev(name) reverse((name).begin(), (name).end()) #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++) #define decision(b) if (b){out("YES");}else{out("NO");} #define int long long int signed main() { improvePerformance; get(n); get(m); getList(n, A); getList(n, B); int l = 0; int r = 1e18; while (r - l >= 1) { int middle = (l + r + 1) / 2; int classes = 0; bool can = true; forto(n, i) { if (A[i] <= B[i]) classes += (middle - 1) / B[i] + 1; else { int attended = min(m, (middle + A[i] - 1) / A[i]); if (attended * A[i] < middle) attended += (middle - attended * A[i] + B[i] - 1) / B[i]; classes += attended; } if (classes > n * m) { can = false; break; } } if (can && (classes <= n * m || middle == 0)) l = middle; else r = middle - 1; } out(l); }
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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 90 ms | 8768 KB | Output is correct |
12 | Correct | 91 ms | 8820 KB | Output is correct |
13 | Correct | 71 ms | 8724 KB | Output is correct |
14 | Correct | 60 ms | 8716 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 29 ms | 9920 KB | Output is correct |
17 | Correct | 84 ms | 15036 KB | Output is correct |
18 | Correct | 87 ms | 14428 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 29 ms | 9920 KB | Output is correct |
3 | Correct | 84 ms | 15036 KB | Output is correct |
4 | Correct | 87 ms | 14428 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 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 | 44 ms | 4556 KB | Output is correct |
14 | Correct | 29 ms | 2644 KB | Output is correct |
15 | Correct | 22 ms | 2416 KB | Output is correct |
16 | Correct | 18 ms | 1576 KB | Output is correct |
17 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 468 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 90 ms | 8768 KB | Output is correct |
12 | Correct | 91 ms | 8820 KB | Output is correct |
13 | Correct | 71 ms | 8724 KB | Output is correct |
14 | Correct | 60 ms | 8716 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 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 | 44 ms | 4556 KB | Output is correct |
24 | Correct | 29 ms | 2644 KB | Output is correct |
25 | Correct | 22 ms | 2416 KB | Output is correct |
26 | Correct | 18 ms | 1576 KB | Output is correct |
27 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 468 KB | Output is correct |
34 | Correct | 1 ms | 212 KB | Output is correct |
35 | Correct | 29 ms | 9920 KB | Output is correct |
36 | Correct | 84 ms | 15036 KB | Output is correct |
37 | Correct | 87 ms | 14428 KB | Output is correct |
38 | Correct | 1 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 | 1 ms | 212 KB | Output is correct |
42 | Correct | 1 ms | 212 KB | Output is correct |
43 | Correct | 1 ms | 212 KB | Output is correct |
44 | Correct | 0 ms | 212 KB | Output is correct |
45 | Correct | 2 ms | 468 KB | Output is correct |
46 | Correct | 3 ms | 712 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 18 ms | 2404 KB | Output is correct |
49 | Correct | 0 ms | 316 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 2 ms | 468 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 | 50 ms | 7360 KB | Output is correct |
56 | Correct | 28 ms | 3784 KB | Output is correct |
57 | Correct | 22 ms | 3920 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 44 ms | 4556 KB | Output is correct |
10 | Correct | 29 ms | 2644 KB | Output is correct |
11 | Correct | 22 ms | 2416 KB | Output is correct |
12 | Correct | 18 ms | 1576 KB | Output is correct |
13 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
19 | Correct | 2 ms | 468 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 29 ms | 9920 KB | Output is correct |
22 | Correct | 84 ms | 15036 KB | Output is correct |
23 | Correct | 87 ms | 14428 KB | Output is correct |
24 | Correct | 27 ms | 2356 KB | Output is correct |
25 | Correct | 64 ms | 6976 KB | Output is correct |
26 | Correct | 11 ms | 1576 KB | Output is correct |
27 | Correct | 88 ms | 14340 KB | Output is correct |
28 | Correct | 90 ms | 14396 KB | Output is correct |
29 | Correct | 93 ms | 14376 KB | Output is correct |
30 | Correct | 115 ms | 14436 KB | Output is correct |
31 | Correct | 187 ms | 14328 KB | Output is correct |
32 | Correct | 109 ms | 9920 KB | Output is correct |
33 | Correct | 213 ms | 15076 KB | Output is correct |
34 | Correct | 109 ms | 9920 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 | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 90 ms | 8768 KB | Output is correct |
12 | Correct | 91 ms | 8820 KB | Output is correct |
13 | Correct | 71 ms | 8724 KB | Output is correct |
14 | Correct | 60 ms | 8716 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 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 | 44 ms | 4556 KB | Output is correct |
24 | Correct | 29 ms | 2644 KB | Output is correct |
25 | Correct | 22 ms | 2416 KB | Output is correct |
26 | Correct | 18 ms | 1576 KB | Output is correct |
27 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
33 | Correct | 2 ms | 468 KB | Output is correct |
34 | Correct | 1 ms | 212 KB | Output is correct |
35 | Correct | 0 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 | 1 ms | 212 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 0 ms | 212 KB | Output is correct |
41 | Correct | 2 ms | 468 KB | Output is correct |
42 | Correct | 3 ms | 712 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 18 ms | 2404 KB | Output is correct |
45 | Correct | 0 ms | 316 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 2 ms | 468 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 | 50 ms | 7360 KB | Output is correct |
52 | Correct | 28 ms | 3784 KB | Output is correct |
53 | Correct | 22 ms | 3920 KB | Output is correct |
54 | Correct | 27 ms | 2356 KB | Output is correct |
55 | Correct | 64 ms | 6976 KB | Output is correct |
56 | Correct | 11 ms | 1576 KB | Output is correct |
57 | Correct | 88 ms | 14340 KB | Output is correct |
58 | Correct | 90 ms | 14396 KB | Output is correct |
59 | Correct | 93 ms | 14376 KB | Output is correct |
60 | Correct | 115 ms | 14436 KB | Output is correct |
61 | Correct | 187 ms | 14328 KB | Output is correct |
62 | Correct | 109 ms | 9920 KB | Output is correct |
63 | Correct | 213 ms | 15076 KB | Output is correct |
64 | Correct | 109 ms | 9920 KB | Output is correct |
65 | Correct | 1 ms | 212 KB | Output is correct |
66 | Correct | 29 ms | 9920 KB | Output is correct |
67 | Correct | 84 ms | 15036 KB | Output is correct |
68 | Correct | 87 ms | 14428 KB | Output is correct |
69 | Correct | 21 ms | 1496 KB | Output is correct |
70 | Correct | 6 ms | 612 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 31 ms | 2260 KB | Output is correct |
73 | Correct | 7 ms | 724 KB | Output is correct |
74 | Correct | 1 ms | 340 KB | Output is correct |
75 | Correct | 110 ms | 14316 KB | Output is correct |
76 | Correct | 112 ms | 14372 KB | Output is correct |
77 | Correct | 122 ms | 14404 KB | Output is correct |
78 | Correct | 156 ms | 14388 KB | Output is correct |
79 | Correct | 212 ms | 14420 KB | Output is correct |
80 | Correct | 211 ms | 14360 KB | Output is correct |
81 | Correct | 201 ms | 12336 KB | Output is correct |
82 | Correct | 204 ms | 12688 KB | Output is correct |