Submission #534140

#TimeUsernameProblemLanguageResultExecution timeMemory
534140LittleOrangeSelf Study (JOI22_ho_t2)C++17
0 / 100
474 ms4940 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll n,m; vector<pair<ll,ll> > dat; bool isok(ll target){ // ans>=target; ll time = 0; for (int i = 0;i<n;i++){ ll a = min(((target-1)/dat[i].first)+1,m); ll t = target - a*dat[i].first; time += a; if (t>0){ time += ((t-1)/dat[i].second)+1; } } return time<=n*m; } ll check(ll l, ll r){ if (l >= r) return l; ll mid = (r-l+1)/2+l; if (isok(mid)){ return check(mid,r); }else{ return check(l,mid-1); } } int main(){ ios::sync_with_stdio(0);cin.tie(0); cin >> n >> m; dat.resize(n); for (int i = 0;i<n;i++){ cin >> dat[i].first; } for (int i = 0;i<n;i++){ cin >> dat[i].second; dat[i].first = max(dat[i].first, dat[i].second); } cout << check(1LL,1000000000000000000LL) << "\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...