# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
526869 | eecs | Self Study (JOI22_ho_t2) | C++17 | 297 ms | 9564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 300010;
int n, m;
ll a[maxn], b[maxn];
int main() {
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
scanf("%lld", &a[i]);
}
for (int i = 1; i <= n; i++) {
scanf("%lld", &b[i]);
}
auto chk = [&](ll lim) {
__int128 sum = 0;
for (int i = 1; i <= n; i++) {
ll rem = lim;
if (a[i] > b[i]) {
ll t = min(1LL * m, (lim + a[i] - 1) / a[i]);
sum += t, rem -= t * a[i];
}
if (rem >= 0) sum += (rem + b[i] - 1) / b[i];
}
return sum <= 1LL * n * m;
};
ll l = 0, r = 1e18, ans;
while (l <= r) {
ll mid = (l + r) / 2;
chk(mid) ? l = (ans = mid) + 1 : r = mid - 1;
}
printf("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |