# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
703588 |
2023-02-27T18:14:31 Z |
niter |
Self Study (JOI22_ho_t2) |
C++14 |
|
379 ms |
8404 KB |
#include <iostream>
#include <vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
using ll = long long;
long long A[300050], B[300050];
int main(){
ll N, M;
cin >> N >> M;
loop(i,0,N) cin >> A[i];
loop(i,0,N) cin >> B[i];
loop(i,0,N) A[i] = max(A[i], B[i]);
ll ok = 0, ng = 1LL << 60;
auto check = [&](ll x) -> bool {
ll day = 0;
for(ll i = 0; i < N; i++){
if(x <= A[i] * M) day += (x + A[i] - 1) / A[i];
else day += M + (x - A[i] * M + B[i] - 1) / B[i];
if(day > N * M) return 0;
}
return 1;
};
while(ng - ok > 1){
const ll mid = (ng + ok) / 2;
if(check(mid)) ok = mid;
else ng = mid;
}
cout << ok << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
304 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 |
0 ms |
308 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
256 ms |
7724 KB |
Output is correct |
12 |
Correct |
272 ms |
7836 KB |
Output is correct |
13 |
Correct |
184 ms |
7668 KB |
Output is correct |
14 |
Correct |
173 ms |
7860 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
97 ms |
6136 KB |
Output is correct |
17 |
Correct |
270 ms |
8192 KB |
Output is correct |
18 |
Correct |
286 ms |
8148 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
97 ms |
6136 KB |
Output is correct |
3 |
Correct |
270 ms |
8192 KB |
Output is correct |
4 |
Correct |
286 ms |
8148 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 |
1 ms |
228 KB |
Output is correct |
9 |
Correct |
0 ms |
308 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
308 KB |
Output is correct |
12 |
Correct |
0 ms |
304 KB |
Output is correct |
13 |
Correct |
130 ms |
5560 KB |
Output is correct |
14 |
Correct |
87 ms |
3696 KB |
Output is correct |
15 |
Correct |
62 ms |
2824 KB |
Output is correct |
16 |
Correct |
52 ms |
2324 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
312 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 |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
6 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
304 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 |
0 ms |
308 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
256 ms |
7724 KB |
Output is correct |
12 |
Correct |
272 ms |
7836 KB |
Output is correct |
13 |
Correct |
184 ms |
7668 KB |
Output is correct |
14 |
Correct |
173 ms |
7860 KB |
Output is correct |
15 |
Correct |
0 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 |
228 KB |
Output is correct |
19 |
Correct |
0 ms |
308 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
308 KB |
Output is correct |
22 |
Correct |
0 ms |
304 KB |
Output is correct |
23 |
Correct |
130 ms |
5560 KB |
Output is correct |
24 |
Correct |
87 ms |
3696 KB |
Output is correct |
25 |
Correct |
62 ms |
2824 KB |
Output is correct |
26 |
Correct |
52 ms |
2324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
312 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
340 KB |
Output is correct |
33 |
Correct |
6 ms |
468 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
97 ms |
6136 KB |
Output is correct |
36 |
Correct |
270 ms |
8192 KB |
Output is correct |
37 |
Correct |
286 ms |
8148 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
1 ms |
312 KB |
Output is correct |
40 |
Correct |
1 ms |
212 KB |
Output is correct |
41 |
Correct |
1 ms |
312 KB |
Output is correct |
42 |
Correct |
1 ms |
308 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
312 KB |
Output is correct |
45 |
Correct |
5 ms |
468 KB |
Output is correct |
46 |
Correct |
8 ms |
596 KB |
Output is correct |
47 |
Correct |
2 ms |
340 KB |
Output is correct |
48 |
Correct |
44 ms |
2088 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
5 ms |
468 KB |
Output is correct |
52 |
Correct |
0 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
312 KB |
Output is correct |
54 |
Correct |
1 ms |
212 KB |
Output is correct |
55 |
Correct |
125 ms |
5440 KB |
Output is correct |
56 |
Correct |
67 ms |
3020 KB |
Output is correct |
57 |
Correct |
59 ms |
3056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
228 KB |
Output is correct |
5 |
Correct |
0 ms |
308 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
308 KB |
Output is correct |
8 |
Correct |
0 ms |
304 KB |
Output is correct |
9 |
Correct |
130 ms |
5560 KB |
Output is correct |
10 |
Correct |
87 ms |
3696 KB |
Output is correct |
11 |
Correct |
62 ms |
2824 KB |
Output is correct |
12 |
Correct |
52 ms |
2324 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
312 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 |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
6 ms |
468 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
97 ms |
6136 KB |
Output is correct |
22 |
Correct |
270 ms |
8192 KB |
Output is correct |
23 |
Correct |
286 ms |
8148 KB |
Output is correct |
24 |
Correct |
56 ms |
1836 KB |
Output is correct |
25 |
Correct |
157 ms |
4880 KB |
Output is correct |
26 |
Correct |
32 ms |
1356 KB |
Output is correct |
27 |
Correct |
257 ms |
8360 KB |
Output is correct |
28 |
Correct |
273 ms |
8100 KB |
Output is correct |
29 |
Correct |
267 ms |
8100 KB |
Output is correct |
30 |
Correct |
292 ms |
8404 KB |
Output is correct |
31 |
Correct |
360 ms |
8176 KB |
Output is correct |
32 |
Correct |
148 ms |
6028 KB |
Output is correct |
33 |
Correct |
358 ms |
8152 KB |
Output is correct |
34 |
Correct |
148 ms |
6088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
304 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 |
0 ms |
308 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
256 ms |
7724 KB |
Output is correct |
12 |
Correct |
272 ms |
7836 KB |
Output is correct |
13 |
Correct |
184 ms |
7668 KB |
Output is correct |
14 |
Correct |
173 ms |
7860 KB |
Output is correct |
15 |
Correct |
0 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 |
228 KB |
Output is correct |
19 |
Correct |
0 ms |
308 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
308 KB |
Output is correct |
22 |
Correct |
0 ms |
304 KB |
Output is correct |
23 |
Correct |
130 ms |
5560 KB |
Output is correct |
24 |
Correct |
87 ms |
3696 KB |
Output is correct |
25 |
Correct |
62 ms |
2824 KB |
Output is correct |
26 |
Correct |
52 ms |
2324 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
312 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
340 KB |
Output is correct |
33 |
Correct |
6 ms |
468 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
312 KB |
Output is correct |
36 |
Correct |
1 ms |
212 KB |
Output is correct |
37 |
Correct |
1 ms |
312 KB |
Output is correct |
38 |
Correct |
1 ms |
308 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
1 ms |
312 KB |
Output is correct |
41 |
Correct |
5 ms |
468 KB |
Output is correct |
42 |
Correct |
8 ms |
596 KB |
Output is correct |
43 |
Correct |
2 ms |
340 KB |
Output is correct |
44 |
Correct |
44 ms |
2088 KB |
Output is correct |
45 |
Correct |
1 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
5 ms |
468 KB |
Output is correct |
48 |
Correct |
0 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
312 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
125 ms |
5440 KB |
Output is correct |
52 |
Correct |
67 ms |
3020 KB |
Output is correct |
53 |
Correct |
59 ms |
3056 KB |
Output is correct |
54 |
Correct |
56 ms |
1836 KB |
Output is correct |
55 |
Correct |
157 ms |
4880 KB |
Output is correct |
56 |
Correct |
32 ms |
1356 KB |
Output is correct |
57 |
Correct |
257 ms |
8360 KB |
Output is correct |
58 |
Correct |
273 ms |
8100 KB |
Output is correct |
59 |
Correct |
267 ms |
8100 KB |
Output is correct |
60 |
Correct |
292 ms |
8404 KB |
Output is correct |
61 |
Correct |
360 ms |
8176 KB |
Output is correct |
62 |
Correct |
148 ms |
6028 KB |
Output is correct |
63 |
Correct |
358 ms |
8152 KB |
Output is correct |
64 |
Correct |
148 ms |
6088 KB |
Output is correct |
65 |
Correct |
1 ms |
212 KB |
Output is correct |
66 |
Correct |
97 ms |
6136 KB |
Output is correct |
67 |
Correct |
270 ms |
8192 KB |
Output is correct |
68 |
Correct |
286 ms |
8148 KB |
Output is correct |
69 |
Correct |
37 ms |
1404 KB |
Output is correct |
70 |
Correct |
10 ms |
468 KB |
Output is correct |
71 |
Correct |
0 ms |
308 KB |
Output is correct |
72 |
Correct |
54 ms |
1768 KB |
Output is correct |
73 |
Correct |
11 ms |
596 KB |
Output is correct |
74 |
Correct |
1 ms |
340 KB |
Output is correct |
75 |
Correct |
265 ms |
8192 KB |
Output is correct |
76 |
Correct |
297 ms |
8172 KB |
Output is correct |
77 |
Correct |
283 ms |
8208 KB |
Output is correct |
78 |
Correct |
325 ms |
8300 KB |
Output is correct |
79 |
Correct |
370 ms |
8296 KB |
Output is correct |
80 |
Correct |
379 ms |
8180 KB |
Output is correct |
81 |
Correct |
305 ms |
8328 KB |
Output is correct |
82 |
Correct |
265 ms |
8128 KB |
Output is correct |