| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1319551 | Ghulam_Junaid | Self Study (JOI22_ho_t2) | C++20 | 294 ms | 5088 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ll n, m;
cin >> n >> m;
ll a[n], b[n];
for (ll i = 0; i < n; i ++)
cin >> a[i];
for (ll i = 0; i < n; i ++)
cin >> b[i];
for (ll i = 0; i < n; i ++)
a[i] = max(a[i], b[i]);
ll lo = 0, hi = 2e18;
while (hi - lo > 1){
ll mid = (lo + hi) / 2;
ll rest = 0, del = 0;
for (ll i = 0; i < n; i ++){
ll need = mid / a[i];
if (mid % a[i]) need++;
del += min(m, need);
if (mid > a[i] * m){
ll rem = mid - a[i] * m;
need = rem / b[i];
if (rem % b[i]) need++;
rest += need;
}
if (del + rest > n * m) break;
}
if (del + rest <= n * m)
lo = mid;
else
hi = mid;
}
cout << lo << endl;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
