| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1325071 | zwezdinv | Self Study (JOI22_ho_t2) | C++20 | 135 ms | 5120 KiB |
#include<bits/stdc++.h>
using ll = long long;
signed main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
std::cin >> n >> m;
std::vector<ll> a(n), b(n);
for (auto& i : a) std::cin >> i;
for (auto& i : b) std::cin >> i;
auto check = [&](ll s) -> bool {
ll bal = 0;
for (int i = 0; i < n; ++i) {
if (b[i] >= a[i]) {
bal += (s + b[i] - 1) / b[i] - m;
} else {
ll k = (s + a[i] - 1) / a[i];
if (k > m) {
bal += (s - a[i] * m + b[i] - 1) / b[i];
} else {
bal -= m - k;
}
}
}
return bal <= 0;
};
ll L = 0, R = 1e18;
while (L != R) {
ll M = (L + R) / 2 + 1;
if (check(M)) L = M;
else R = M - 1;
}
std::cout << L;
}| # | 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... | ||||
