# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
969987 |
2024-04-26T03:17:35 Z |
njoop |
Self Study (JOI22_ho_t2) |
C++14 |
|
1 ms |
2396 KB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll m, n, a[300010], b[300010], l=0, r = 1e18, sum, mid, sm, t;
ll solve(ll mn) {
sm = 0;
for(int i=1; i<=n; i++) {
if(b[i] >= a[i]) {
sm += mn/b[i] + (mn%b[i] ? 1 : 0);
continue;
}
t = mn/a[i] + (mn%a[i] ? 1 : 0);
if(t > m) t = m;
sm += t;
if(t*a[i] >= mn) continue;
sm += (mn-t*a[i])/b[i] + ((mn-t*a[i])%b[i] ? 1 : 0);
}
return sm;
}
int main() {
cin.tie(0)->sync_with_stdio(0);
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) {
mid = (l+r)/2;
sum = solve(mid);
if(sum >= n*m) {
r = mid;
} else {
l = mid+1;
}
}
cout << l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |