Submission #863804

#TimeUsernameProblemLanguageResultExecution timeMemory
863804prairie2022Self Study (JOI22_ho_t2)C++17
100 / 100
218 ms11540 KiB
#include<bits/stdc++.h> typedef long long ll; #define fastio cin.tie(0), cout.tie(0), ios::sync_with_stdio(0); using namespace std; inline ll divide(ll a, ll d){ return (a-1)/d+1; } int main(){ fastio int n; ll m, l = 1, r = 1e18; cin >> n >> m; ll lesson = m*n; 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]; a[i] = max(a[i], b[i]); } while(l!=r){ ll g = (l+r+1)>>1, cnt = 0; for(int i=0; i<n; i++){ ll tmp = divide(g, a[i]); if(tmp>m) cnt += m+divide(g-a[i]*m, b[i]); else cnt += tmp; if(cnt>lesson) break; } if(cnt>lesson) r = g-1; else l = g; } cout << r << '\n'; return 0; }
#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...