Submission #781006

#TimeUsernameProblemLanguageResultExecution timeMemory
781006ymmSelf Study (JOI22_ho_t2)C++17
0 / 100
443 ms5016 KiB
#include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; int main() { cin.tie(0) -> sync_with_stdio(false); ll n, m; cin >> n >> m; vector<ll> a(n), b(n); for (auto &x : a) cin >> x; Loop (i,0,n) { cin >> b[i]; a[i] = max(a[i], b[i]); } ll l = 0, r = 2e18; while (l < r) { ll target = (l+r+1)/2; ll cnt = 0; Loop (i,0,n) { ll x = (target+a[i]-1)/a[i]; if (x > m) { x = m; x += (target - x*a[i] + b[i]-1)/b[i]; } cnt += x; } if (cnt <= n*m) l = target; else r = target-1; } cout << l << '\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...