# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
528675 | rk42745417 | Self Study (JOI22_ho_t2) | C++17 | 240 ms | 7240 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(2e18) + ll(1e15);
const double EPS = 1e-8;
static int LamyIsCute = []() {
EmiliaMyWife
return 48763;
}();
signed main() {
int n, m;
cin >> n >> m;
vector<int> arr(n), brr(n);
for(int &a : arr)
cin >> a;
for(int &a : brr)
cin >> a;
ll l = 0, r = LINF;
auto check = [&](const ll k) {
ll cur = 1LL * m * n;
for(int i = 0; i < n; i++) {
if(arr[i] <= brr[i]) {
cur -= (k + brr[i] - 1) / brr[i];
}
else {
ll r = k;
ll w = min<ll>(m, (r + arr[i] - 1) / arr[i]);
cur -= w;
r -= w * arr[i];
if(r > 0)
cur -= (r + brr[i] - 1) / brr[i];
}
if(cur < 0)
return false;
}
return true;
};
while(l < r) {
ll m = l + r >> 1;
if(check(m))
l = m + 1;
else
r = m;
}
cout << ll(l - 1) << '\n';
}
컴파일 시 표준 에러 (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... |