Submission #536780

#TimeUsernameProblemLanguageResultExecution timeMemory
536780xp875Self Study (JOI22_ho_t2)C++17
0 / 100
804 ms4996 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, m; cin >> n >> m; 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]; ll lo = 0, hi = (ll)1<<60; while(hi>lo) { ll x = (lo+hi)/2; ll ans = 0; for(int i=0; i<n; i++) { ll a1 = (x+b[i]-1)/b[i]; ll a2 = (x+a[i]-1)/a[i]; if(a2 > m) a2 = m + (x-a[i]*m+b[i]-1)/b[i]; ans += min(a1, a2); } if(ans <= n*m) lo = x+1; else hi = x; } cout << lo-1; }
#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...