Submission #991168

#TimeUsernameProblemLanguageResultExecution timeMemory
991168OtalpSelf Study (JOI22_ho_t2)C++14
10 / 100
159 ms11344 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define int ll ll a[300100]; ll b[300100]; ll n, m; bool check(ll x){ ll h = 0; //cout<<x<<' '; for(int i=1; i<=n; i++){ if(a[i] > b[i]){ if(m * a[i] < x){ h += m; h += (x - m * a[i] - 1) / b[i] + 1; } else{ h += (x - 1) / a[i] + 1; } } else{ h += (x - 1) / b[i] + 1; } } //cout<<h<<'\n'; return h <= m*n; } void solve(){ cin>>n>>m; for(int i=1; i<=n; i++){ cin>>a[i]; } for(int i=1; i<=n; i++){ cin>>b[i]; } ll ans = 1e18; for(int i=1; i<=n; i++) ans = min(ans, max(a[i], b[i])); cout<<ans; } signed main(){ solve(); }
#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...