#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
using namespace std;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,m;
cin>>n>>m;
vector <int> a(n),b(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
cin>>b[i];
}
int l=0,r=1e18+3000;
while(l+1<r){
int md=(l+r)/2;;
int tot=n*m;
bool ok=1;
for(int i=0;i<n;i++){
tot-=md/a[i];
if(md%a[i]!=0)tot--;
if(tot<0){
ok=0;break;
}
}
if(ok)l=md;
else r=md;
}
cout<<l<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 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 |
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 |
30 ms |
5476 KB |
Output is correct |
10 |
Correct |
21 ms |
3932 KB |
Output is correct |
11 |
Correct |
15 ms |
3044 KB |
Output is correct |
12 |
Correct |
12 ms |
2592 KB |
Output is correct |
13 |
Correct |
1 ms |
356 KB |
Output is correct |
14 |
Correct |
0 ms |
356 KB |
Output is correct |
15 |
Correct |
0 ms |
356 KB |
Output is correct |
16 |
Correct |
0 ms |
352 KB |
Output is correct |
17 |
Correct |
0 ms |
352 KB |
Output is correct |
18 |
Correct |
1 ms |
356 KB |
Output is correct |
19 |
Correct |
1 ms |
608 KB |
Output is correct |
20 |
Correct |
0 ms |
460 KB |
Output is correct |
21 |
Correct |
21 ms |
6304 KB |
Output is correct |
22 |
Correct |
60 ms |
11352 KB |
Output is correct |
23 |
Correct |
59 ms |
10844 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 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 |
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 |
30 ms |
5476 KB |
Output is correct |
10 |
Correct |
21 ms |
3932 KB |
Output is correct |
11 |
Correct |
15 ms |
3044 KB |
Output is correct |
12 |
Correct |
12 ms |
2592 KB |
Output is correct |
13 |
Correct |
1 ms |
356 KB |
Output is correct |
14 |
Correct |
0 ms |
356 KB |
Output is correct |
15 |
Correct |
0 ms |
356 KB |
Output is correct |
16 |
Correct |
0 ms |
352 KB |
Output is correct |
17 |
Correct |
0 ms |
352 KB |
Output is correct |
18 |
Correct |
1 ms |
356 KB |
Output is correct |
19 |
Correct |
1 ms |
608 KB |
Output is correct |
20 |
Correct |
0 ms |
460 KB |
Output is correct |
21 |
Correct |
21 ms |
6304 KB |
Output is correct |
22 |
Correct |
60 ms |
11352 KB |
Output is correct |
23 |
Correct |
59 ms |
10844 KB |
Output is correct |
24 |
Correct |
12 ms |
1892 KB |
Output is correct |
25 |
Correct |
32 ms |
4996 KB |
Output is correct |
26 |
Correct |
7 ms |
1368 KB |
Output is correct |
27 |
Correct |
60 ms |
10776 KB |
Output is correct |
28 |
Correct |
61 ms |
10844 KB |
Output is correct |
29 |
Correct |
62 ms |
10832 KB |
Output is correct |
30 |
Correct |
76 ms |
10836 KB |
Output is correct |
31 |
Correct |
78 ms |
10912 KB |
Output is correct |
32 |
Correct |
42 ms |
6176 KB |
Output is correct |
33 |
Correct |
85 ms |
11344 KB |
Output is correct |
34 |
Correct |
42 ms |
6232 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |