#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
signed main() {
ll n, m;
cin >> n >> m;
vector<ll> a(n+1), b(n+1);
for(int i=1; i<=n; i++) cin >> a[i];
for(int i=1; i<=n; i++) cin >> b[i];
__int128_t l=1, r=1e18, ans=0;
while(l <= r) {
__int128_t mid = (l + r) / 2;
__int128_t total = 0;
for(__int128_t i=1; i<=n; i++) total += (mid + a[i] - 1) / a[i];
if(total <= n * m) ans = mid, l = mid + 1;
else r = mid - 1;
}
cout << (ll)ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
396 KB |
Output is correct |
2 |
Correct |
1 ms |
440 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
360 KB |
Output is correct |
5 |
Correct |
0 ms |
360 KB |
Output is correct |
6 |
Correct |
1 ms |
356 KB |
Output is correct |
7 |
Correct |
0 ms |
448 KB |
Output is correct |
8 |
Correct |
0 ms |
356 KB |
Output is correct |
9 |
Correct |
123 ms |
5584 KB |
Output is correct |
10 |
Correct |
83 ms |
3900 KB |
Output is correct |
11 |
Correct |
94 ms |
2900 KB |
Output is correct |
12 |
Correct |
51 ms |
2516 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
8 ms |
600 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
125 ms |
6264 KB |
Output is correct |
22 |
Correct |
234 ms |
11356 KB |
Output is correct |
23 |
Correct |
204 ms |
10756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
396 KB |
Output is correct |
2 |
Correct |
1 ms |
440 KB |
Output is correct |
3 |
Correct |
1 ms |
360 KB |
Output is correct |
4 |
Correct |
1 ms |
360 KB |
Output is correct |
5 |
Correct |
0 ms |
360 KB |
Output is correct |
6 |
Correct |
1 ms |
356 KB |
Output is correct |
7 |
Correct |
0 ms |
448 KB |
Output is correct |
8 |
Correct |
0 ms |
356 KB |
Output is correct |
9 |
Correct |
123 ms |
5584 KB |
Output is correct |
10 |
Correct |
83 ms |
3900 KB |
Output is correct |
11 |
Correct |
94 ms |
2900 KB |
Output is correct |
12 |
Correct |
51 ms |
2516 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
2 ms |
348 KB |
Output is correct |
19 |
Correct |
8 ms |
600 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
125 ms |
6264 KB |
Output is correct |
22 |
Correct |
234 ms |
11356 KB |
Output is correct |
23 |
Correct |
204 ms |
10756 KB |
Output is correct |
24 |
Correct |
33 ms |
1880 KB |
Output is correct |
25 |
Correct |
95 ms |
4948 KB |
Output is correct |
26 |
Correct |
23 ms |
1372 KB |
Output is correct |
27 |
Correct |
214 ms |
10836 KB |
Output is correct |
28 |
Correct |
231 ms |
10736 KB |
Output is correct |
29 |
Correct |
217 ms |
10848 KB |
Output is correct |
30 |
Correct |
227 ms |
10864 KB |
Output is correct |
31 |
Correct |
213 ms |
10736 KB |
Output is correct |
32 |
Correct |
132 ms |
6268 KB |
Output is correct |
33 |
Correct |
258 ms |
11604 KB |
Output is correct |
34 |
Correct |
159 ms |
6052 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |