Submission #526683

#TimeUsernameProblemLanguageResultExecution timeMemory
526683couplefireSelf Study (JOI22_ho_t2)C++17
0 / 100
305 ms9548 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ // freopen("a.in", "r", stdin); cin.tie(0)->sync_with_stdio(0); int n, m; cin >> n >> m; 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]; for(int i = 0; i<n; ++i) a[i] = max(a[i], b[i]); ll lo = 0, hi = 1e18; while(lo<hi){ ll mid = lo+(hi-lo+1)/2; ll cnt = 0; for(int i = 0; i<n; ++i) if(a[i]*m>=mid) cnt += m-(mid+a[i]-1)/a[i]; else cnt -= (mid-a[i]*m+b[i]-1)/b[i]; if(cnt>=0) lo = mid; else hi = mid-1; } cout << lo << '\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...