# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
995704 | mnieplowicz | Self Study (JOI22_ho_t2) | C++14 | 90 ms | 10512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n, m;
cin >> n >> m;
vector<long long> a(n);
for(auto &x : a) cin >> x;
vector<long long> b(n);
for(auto &x : b) cin >> x;
for(int i = 0; i < n; i++) a[i] = max(a[i], b[i]);
auto check = [&](long long val){
unsigned long long cnt = 0;
for(int i = 0; i < n; i++){
if(a[i]*m >= val) cnt += ((val - 1)/a[i] + 1);
else cnt += (m + (val - m*a[i] -1)/b[i] + 1);
}
if(cnt <= m*n) return true;
else return false;
};
long long l = 0, r = 2e18;
while(l+1 != r){
long long mid = (l+r)/2;
if(check(mid)) l = mid;
else r = mid;
}
cout << l << '\n';
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... |