#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=3e5+5;
ll n, m, a[nx], b[nx], l=1, r=1e18;
bool check(ll x)
{
ll vl=n*m;
for (int i=1; i<=n; i++)
{
ll c=(x%a[i]==0)?(x/a[i]):(x/a[i]+1);
if (vl<c) return 0;
vl-=c;
}
return 1;
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m;
for (int i=1; i<=n; i++) cin>>a[i];
for (int i=1; i<=n; i++) cin>>b[i];
while (l<r)
{
ll md=(l+r+1)/2;
if (check(md)) l=md;
else r=md-1;
}
cout<<l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
55 ms |
4720 KB |
Output is correct |
10 |
Correct |
27 ms |
4700 KB |
Output is correct |
11 |
Correct |
20 ms |
4756 KB |
Output is correct |
12 |
Correct |
17 ms |
4700 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
2 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2392 KB |
Output is correct |
21 |
Correct |
24 ms |
5132 KB |
Output is correct |
22 |
Correct |
76 ms |
4952 KB |
Output is correct |
23 |
Correct |
80 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
0 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
55 ms |
4720 KB |
Output is correct |
10 |
Correct |
27 ms |
4700 KB |
Output is correct |
11 |
Correct |
20 ms |
4756 KB |
Output is correct |
12 |
Correct |
17 ms |
4700 KB |
Output is correct |
13 |
Correct |
1 ms |
2392 KB |
Output is correct |
14 |
Correct |
0 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2392 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
2 ms |
2396 KB |
Output is correct |
20 |
Correct |
1 ms |
2392 KB |
Output is correct |
21 |
Correct |
24 ms |
5132 KB |
Output is correct |
22 |
Correct |
76 ms |
4952 KB |
Output is correct |
23 |
Correct |
80 ms |
4948 KB |
Output is correct |
24 |
Correct |
26 ms |
4696 KB |
Output is correct |
25 |
Correct |
64 ms |
7320 KB |
Output is correct |
26 |
Correct |
11 ms |
5212 KB |
Output is correct |
27 |
Correct |
79 ms |
10924 KB |
Output is correct |
28 |
Correct |
84 ms |
10928 KB |
Output is correct |
29 |
Correct |
86 ms |
10836 KB |
Output is correct |
30 |
Correct |
107 ms |
10832 KB |
Output is correct |
31 |
Correct |
180 ms |
10836 KB |
Output is correct |
32 |
Correct |
104 ms |
6300 KB |
Output is correct |
33 |
Correct |
210 ms |
11388 KB |
Output is correct |
34 |
Correct |
102 ms |
6228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |