# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
936718 |
2024-03-02T15:28:50 Z |
kitlix |
Self Study (JOI22_ho_t2) |
C++17 |
|
201 ms |
10076 KB |
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 4e18;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n, w;
cin >> n >> w;
vector<int> a(n), b(n);
for (auto& el : a)
cin >> el;
for (auto& el : b)
cin >> el;
for (int i = 0; i < n; ++i)
a[i] = max(a[i], b[i]);
int l = 0, r = INF;
while (l + 1 < r) {
int m = (l + r) / 2;
int total = 0;
for (int i = 0; i < n; ++i) {
if (a[i] * w >= m) {
total += ((m + a[i] - 1) / a[i]);
continue;
}
total += w + (m - a[i] * w + b[i] - 1) / b[i];
if (total > n * w)
break;
}
if (total <= n * w)
l = m;
else
r = m;
}
cout << l << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
81 ms |
4952 KB |
Output is correct |
12 |
Correct |
87 ms |
4956 KB |
Output is correct |
13 |
Correct |
66 ms |
4956 KB |
Output is correct |
14 |
Correct |
67 ms |
5136 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
28 ms |
4956 KB |
Output is correct |
17 |
Correct |
78 ms |
4956 KB |
Output is correct |
18 |
Correct |
81 ms |
5152 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
28 ms |
4956 KB |
Output is correct |
3 |
Correct |
78 ms |
4956 KB |
Output is correct |
4 |
Correct |
81 ms |
5152 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
48 ms |
2788 KB |
Output is correct |
14 |
Correct |
35 ms |
2032 KB |
Output is correct |
15 |
Correct |
21 ms |
1640 KB |
Output is correct |
16 |
Correct |
22 ms |
1380 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
81 ms |
4952 KB |
Output is correct |
12 |
Correct |
87 ms |
4956 KB |
Output is correct |
13 |
Correct |
66 ms |
4956 KB |
Output is correct |
14 |
Correct |
67 ms |
5136 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
48 ms |
2788 KB |
Output is correct |
24 |
Correct |
35 ms |
2032 KB |
Output is correct |
25 |
Correct |
21 ms |
1640 KB |
Output is correct |
26 |
Correct |
22 ms |
1380 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
3 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
28 ms |
4956 KB |
Output is correct |
36 |
Correct |
78 ms |
4956 KB |
Output is correct |
37 |
Correct |
81 ms |
5152 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
348 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
1 ms |
344 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
0 ms |
348 KB |
Output is correct |
45 |
Correct |
2 ms |
348 KB |
Output is correct |
46 |
Correct |
4 ms |
600 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
16 ms |
1116 KB |
Output is correct |
49 |
Correct |
0 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
2 ms |
348 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
2 ms |
348 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
42 ms |
2648 KB |
Output is correct |
56 |
Correct |
26 ms |
2136 KB |
Output is correct |
57 |
Correct |
20 ms |
2036 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
48 ms |
2788 KB |
Output is correct |
10 |
Correct |
35 ms |
2032 KB |
Output is correct |
11 |
Correct |
21 ms |
1640 KB |
Output is correct |
12 |
Correct |
22 ms |
1380 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
3 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
28 ms |
4956 KB |
Output is correct |
22 |
Correct |
78 ms |
4956 KB |
Output is correct |
23 |
Correct |
81 ms |
5152 KB |
Output is correct |
24 |
Correct |
27 ms |
1116 KB |
Output is correct |
25 |
Correct |
62 ms |
2556 KB |
Output is correct |
26 |
Correct |
11 ms |
860 KB |
Output is correct |
27 |
Correct |
87 ms |
5140 KB |
Output is correct |
28 |
Correct |
85 ms |
4956 KB |
Output is correct |
29 |
Correct |
87 ms |
5148 KB |
Output is correct |
30 |
Correct |
119 ms |
5140 KB |
Output is correct |
31 |
Correct |
180 ms |
4952 KB |
Output is correct |
32 |
Correct |
94 ms |
4952 KB |
Output is correct |
33 |
Correct |
148 ms |
5140 KB |
Output is correct |
34 |
Correct |
93 ms |
6308 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
81 ms |
4952 KB |
Output is correct |
12 |
Correct |
87 ms |
4956 KB |
Output is correct |
13 |
Correct |
66 ms |
4956 KB |
Output is correct |
14 |
Correct |
67 ms |
5136 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
48 ms |
2788 KB |
Output is correct |
24 |
Correct |
35 ms |
2032 KB |
Output is correct |
25 |
Correct |
21 ms |
1640 KB |
Output is correct |
26 |
Correct |
22 ms |
1380 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
3 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
348 KB |
Output is correct |
40 |
Correct |
0 ms |
348 KB |
Output is correct |
41 |
Correct |
2 ms |
348 KB |
Output is correct |
42 |
Correct |
4 ms |
600 KB |
Output is correct |
43 |
Correct |
1 ms |
348 KB |
Output is correct |
44 |
Correct |
16 ms |
1116 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
2 ms |
348 KB |
Output is correct |
48 |
Correct |
1 ms |
348 KB |
Output is correct |
49 |
Correct |
2 ms |
348 KB |
Output is correct |
50 |
Correct |
0 ms |
348 KB |
Output is correct |
51 |
Correct |
42 ms |
2648 KB |
Output is correct |
52 |
Correct |
26 ms |
2136 KB |
Output is correct |
53 |
Correct |
20 ms |
2036 KB |
Output is correct |
54 |
Correct |
27 ms |
1116 KB |
Output is correct |
55 |
Correct |
62 ms |
2556 KB |
Output is correct |
56 |
Correct |
11 ms |
860 KB |
Output is correct |
57 |
Correct |
87 ms |
5140 KB |
Output is correct |
58 |
Correct |
85 ms |
4956 KB |
Output is correct |
59 |
Correct |
87 ms |
5148 KB |
Output is correct |
60 |
Correct |
119 ms |
5140 KB |
Output is correct |
61 |
Correct |
180 ms |
4952 KB |
Output is correct |
62 |
Correct |
94 ms |
4952 KB |
Output is correct |
63 |
Correct |
148 ms |
5140 KB |
Output is correct |
64 |
Correct |
93 ms |
6308 KB |
Output is correct |
65 |
Correct |
0 ms |
344 KB |
Output is correct |
66 |
Correct |
28 ms |
4956 KB |
Output is correct |
67 |
Correct |
78 ms |
4956 KB |
Output is correct |
68 |
Correct |
81 ms |
5152 KB |
Output is correct |
69 |
Correct |
21 ms |
1628 KB |
Output is correct |
70 |
Correct |
6 ms |
608 KB |
Output is correct |
71 |
Correct |
1 ms |
348 KB |
Output is correct |
72 |
Correct |
32 ms |
1896 KB |
Output is correct |
73 |
Correct |
7 ms |
872 KB |
Output is correct |
74 |
Correct |
1 ms |
360 KB |
Output is correct |
75 |
Correct |
94 ms |
9744 KB |
Output is correct |
76 |
Correct |
107 ms |
9756 KB |
Output is correct |
77 |
Correct |
111 ms |
10076 KB |
Output is correct |
78 |
Correct |
141 ms |
9772 KB |
Output is correct |
79 |
Correct |
201 ms |
9748 KB |
Output is correct |
80 |
Correct |
201 ms |
9908 KB |
Output is correct |
81 |
Correct |
139 ms |
8244 KB |
Output is correct |
82 |
Correct |
101 ms |
8016 KB |
Output is correct |