제출 #654746

#제출 시각아이디문제언어결과실행 시간메모리
654746gun_ganSelf Study (JOI22_ho_t2)C++17
0 / 100
472 ms10876 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { cin.tie(0); ios_base::sync_with_stdio(0); ll 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]; auto ok = [&](ll x) -> bool { ll left = 0, need = 0; for(int i = 0; i < n; i++) { ll z = m; z -= (x + max(a[i], b[i]) - 1) / max(a[i], b[i]); if(z < 0) { need += (x - max(a[i], b[i]) * m + b[i] - 1) / b[i]; } else { left += z; } } return need <= left; }; ll l = 0, r = 2e18, ans = 0; while(l <= r) { ll mid = (l + r) / 2; if(ok(mid)) { l = mid + 1, ans = mid; } else { r = mid - 1; } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...