| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1368885 | djangg7 | Self Study (JOI22_ho_t2) | C++20 | 190 ms | 5112 KiB |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a[300500], b[300500];
int main(){
ll n, m;
cin >> n >> m;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
for(int i = 1; i <= n; i++){
cin >> b[i];
}
ll mx = *max_element(a + 1, a + 1 + n);
ll l = 0, h = LLONG_MAX;
while(l <= h){
int flag = 0;
ll mid = (l + h) / 2LL;
ll cnts = n * m;
for(int i = 1; i <= n; i++){
if(a[i] <= b[i]){
cnts -= (mid + b[i] - 1LL) / b[i]; // upper(mid / b[i])
}
else{
if((mid + a[i] - 1LL) / a[i] <= m){
cnts -= (mid + a[i] - 1LL) / a[i];
}
else{
cnts -= m;
ll rem = mid - m * a[i];
cnts -= (rem + b[i] - 1LL) / b[i];
}
}
if(cnts < 0LL){
flag = 1;
break;
}
}
if(flag){
h = mid - 1LL;
continue;
}
l = mid + 1LL;
}
cout << h << '\n';
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
