# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
526684 | couplefire | Self Study (JOI22_ho_t2) | C++17 | 250 ms | 9640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
// freopen("a.in", "r", stdin);
cin.tie(0)->sync_with_stdio(0);
int n, m; cin >> n >> m;
vector<ll> a(n), b(n);
for(int i = 0; i<n; ++i) cin >> a[i];
for(int i = 0; i<n; ++i) cin >> b[i];
for(int i = 0; i<n; ++i) a[i] = max(a[i], b[i]);
ll lo = 0, hi = 1e18;
while(lo<hi){
ll mid = lo+(hi-lo+1)/2;
ll cnt = 0;
for(int i = 0; i<n; ++i){
if(a[i]*m>=mid) cnt += m-(mid+a[i]-1)/a[i];
else cnt -= (mid-a[i]*m+b[i]-1)/b[i];
if(cnt<-1ll*n*m) break;
}
if(cnt>=0ll) lo = mid;
else hi = mid-1;
}
cout << lo << '\n';
}
# | 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... |