# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
760828 |
2023-06-18T15:54:47 Z |
Petrix |
Self Study (JOI22_ho_t2) |
C++17 |
|
314 ms |
11356 KB |
#include <iostream>
using namespace std;
long long a[300000],b[300000];
int main()
{
long long n,m,i,st,dr,mij,s,rasp;
cin>>n>>m;
for(i=0;i<n;i++){
cin>>a[i];
}
for(i=0;i<n;i++){
cin>>b[i];
a[i]=max(a[i],b[i]);
}
st=rasp=0;dr=1ll<<60;
while(st<=dr){
s=0;
mij=(st+dr)/2;
for(i=0;i<n && s<=n*m;i++){
if(a[i]*m<mij){
s+=m+(mij-a[i]*m-1)/b[i]+1;
}else{
s+=(mij-1)/a[i]+1;
}
}
if(s>m*n){
dr=mij-1;
}else{
rasp=mij;
st=mij+1;
}
}
cout<<rasp;
return 0;
}
# |
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 |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
200 ms |
10780 KB |
Output is correct |
12 |
Correct |
205 ms |
10788 KB |
Output is correct |
13 |
Correct |
151 ms |
8840 KB |
Output is correct |
14 |
Correct |
139 ms |
8696 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
64 ms |
6084 KB |
Output is correct |
17 |
Correct |
205 ms |
11320 KB |
Output is correct |
18 |
Correct |
204 ms |
10712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
64 ms |
6084 KB |
Output is correct |
3 |
Correct |
205 ms |
11320 KB |
Output is correct |
4 |
Correct |
204 ms |
10712 KB |
Output is correct |
5 |
Correct |
1 ms |
304 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
308 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
101 ms |
5488 KB |
Output is correct |
14 |
Correct |
67 ms |
3780 KB |
Output is correct |
15 |
Correct |
51 ms |
3020 KB |
Output is correct |
16 |
Correct |
41 ms |
2288 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
316 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
2 ms |
340 KB |
Output is correct |
23 |
Correct |
4 ms |
468 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 |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
200 ms |
10780 KB |
Output is correct |
12 |
Correct |
205 ms |
10788 KB |
Output is correct |
13 |
Correct |
151 ms |
8840 KB |
Output is correct |
14 |
Correct |
139 ms |
8696 KB |
Output is correct |
15 |
Correct |
1 ms |
304 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
308 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
101 ms |
5488 KB |
Output is correct |
24 |
Correct |
67 ms |
3780 KB |
Output is correct |
25 |
Correct |
51 ms |
3020 KB |
Output is correct |
26 |
Correct |
41 ms |
2288 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
316 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
468 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
64 ms |
6084 KB |
Output is correct |
36 |
Correct |
205 ms |
11320 KB |
Output is correct |
37 |
Correct |
204 ms |
10712 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 |
288 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
0 ms |
212 KB |
Output is correct |
44 |
Correct |
0 ms |
212 KB |
Output is correct |
45 |
Correct |
4 ms |
436 KB |
Output is correct |
46 |
Correct |
7 ms |
624 KB |
Output is correct |
47 |
Correct |
1 ms |
316 KB |
Output is correct |
48 |
Correct |
35 ms |
1984 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 |
468 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 |
100 ms |
5484 KB |
Output is correct |
56 |
Correct |
52 ms |
3108 KB |
Output is correct |
57 |
Correct |
47 ms |
3060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
308 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 |
101 ms |
5488 KB |
Output is correct |
10 |
Correct |
67 ms |
3780 KB |
Output is correct |
11 |
Correct |
51 ms |
3020 KB |
Output is correct |
12 |
Correct |
41 ms |
2288 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
316 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
2 ms |
340 KB |
Output is correct |
19 |
Correct |
4 ms |
468 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
64 ms |
6084 KB |
Output is correct |
22 |
Correct |
205 ms |
11320 KB |
Output is correct |
23 |
Correct |
204 ms |
10712 KB |
Output is correct |
24 |
Correct |
46 ms |
2036 KB |
Output is correct |
25 |
Correct |
114 ms |
4920 KB |
Output is correct |
26 |
Correct |
23 ms |
1360 KB |
Output is correct |
27 |
Correct |
197 ms |
10668 KB |
Output is correct |
28 |
Correct |
203 ms |
10692 KB |
Output is correct |
29 |
Correct |
204 ms |
10768 KB |
Output is correct |
30 |
Correct |
230 ms |
10700 KB |
Output is correct |
31 |
Correct |
303 ms |
10700 KB |
Output is correct |
32 |
Correct |
130 ms |
6092 KB |
Output is correct |
33 |
Correct |
297 ms |
11356 KB |
Output is correct |
34 |
Correct |
132 ms |
6092 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 |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
200 ms |
10780 KB |
Output is correct |
12 |
Correct |
205 ms |
10788 KB |
Output is correct |
13 |
Correct |
151 ms |
8840 KB |
Output is correct |
14 |
Correct |
139 ms |
8696 KB |
Output is correct |
15 |
Correct |
1 ms |
304 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
308 KB |
Output is correct |
19 |
Correct |
1 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
101 ms |
5488 KB |
Output is correct |
24 |
Correct |
67 ms |
3780 KB |
Output is correct |
25 |
Correct |
51 ms |
3020 KB |
Output is correct |
26 |
Correct |
41 ms |
2288 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
0 ms |
316 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
340 KB |
Output is correct |
33 |
Correct |
4 ms |
468 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 |
288 KB |
Output is correct |
38 |
Correct |
1 ms |
212 KB |
Output is correct |
39 |
Correct |
0 ms |
212 KB |
Output is correct |
40 |
Correct |
0 ms |
212 KB |
Output is correct |
41 |
Correct |
4 ms |
436 KB |
Output is correct |
42 |
Correct |
7 ms |
624 KB |
Output is correct |
43 |
Correct |
1 ms |
316 KB |
Output is correct |
44 |
Correct |
35 ms |
1984 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 |
468 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 |
100 ms |
5484 KB |
Output is correct |
52 |
Correct |
52 ms |
3108 KB |
Output is correct |
53 |
Correct |
47 ms |
3060 KB |
Output is correct |
54 |
Correct |
46 ms |
2036 KB |
Output is correct |
55 |
Correct |
114 ms |
4920 KB |
Output is correct |
56 |
Correct |
23 ms |
1360 KB |
Output is correct |
57 |
Correct |
197 ms |
10668 KB |
Output is correct |
58 |
Correct |
203 ms |
10692 KB |
Output is correct |
59 |
Correct |
204 ms |
10768 KB |
Output is correct |
60 |
Correct |
230 ms |
10700 KB |
Output is correct |
61 |
Correct |
303 ms |
10700 KB |
Output is correct |
62 |
Correct |
130 ms |
6092 KB |
Output is correct |
63 |
Correct |
297 ms |
11356 KB |
Output is correct |
64 |
Correct |
132 ms |
6092 KB |
Output is correct |
65 |
Correct |
1 ms |
212 KB |
Output is correct |
66 |
Correct |
64 ms |
6084 KB |
Output is correct |
67 |
Correct |
205 ms |
11320 KB |
Output is correct |
68 |
Correct |
204 ms |
10712 KB |
Output is correct |
69 |
Correct |
34 ms |
1348 KB |
Output is correct |
70 |
Correct |
8 ms |
568 KB |
Output is correct |
71 |
Correct |
1 ms |
212 KB |
Output is correct |
72 |
Correct |
45 ms |
1804 KB |
Output is correct |
73 |
Correct |
9 ms |
656 KB |
Output is correct |
74 |
Correct |
1 ms |
340 KB |
Output is correct |
75 |
Correct |
203 ms |
10688 KB |
Output is correct |
76 |
Correct |
213 ms |
10684 KB |
Output is correct |
77 |
Correct |
224 ms |
10700 KB |
Output is correct |
78 |
Correct |
253 ms |
10712 KB |
Output is correct |
79 |
Correct |
308 ms |
10780 KB |
Output is correct |
80 |
Correct |
314 ms |
10692 KB |
Output is correct |
81 |
Correct |
242 ms |
8780 KB |
Output is correct |
82 |
Correct |
227 ms |
8768 KB |
Output is correct |