| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368885 | djangg7 | Self Study (JOI22_ho_t2) | C++20 | 190 ms | 5112 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a[300500], b[300500];
int main(){
ll n, m;
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= n; i++){
cin >> b[i];
}
ll mx = *max_element(a + 1, a + 1 + n);
ll l = 0, h = LLONG_MAX;
while(l <= h){
int flag = 0;
ll mid = (l + h) / 2LL;
ll cnts = n * m;
for(int i = 1; i <= n; i++){
if(a[i] <= b[i]){
cnts -= (mid + b[i] - 1LL) / b[i]; // upper(mid / b[i])
}
else{
if((mid + a[i] - 1LL) / a[i] <= m){
cnts -= (mid + a[i] - 1LL) / a[i];
}
else{
cnts -= m;
ll rem = mid - m * a[i];
cnts -= (rem + b[i] - 1LL) / b[i];
}
}
if(cnts < 0LL){
flag = 1;
break;
}
}
if(flag){
h = mid - 1LL;
continue;
}
l = mid + 1LL;
}
cout << h << '\n';
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
