| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366218 | kawhiet | Self Study (JOI22_ho_t2) | C++20 | 80 ms | 5132 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
#define int long long
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
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];
a[i] = max(a[i], b[i]);
}
auto ok = [&](int k) {
int cnt = 0;
for (int i = 0; i < n; i++) {
if (k <= a[i] * m) {
cnt += (k + a[i] - 1) / a[i];
} else {
cnt += m + (k - a[i] * m + b[i] - 1) / b[i];
}
}
return cnt <= m * n;
};
int l = 0, r = 1e18 + 5;
while (l + 1 < r) {
int m = (l + r) / 2;
if (ok(m)) {
l = m;
} else {
r = m;
}
}
cout << l << '\n';
return 0;
}| # | 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... | ||||
