Submission #864582

#TimeUsernameProblemLanguageResultExecution timeMemory
864582NotLinuxSelf Study (JOI22_ho_t2)C++17
100 / 100
202 ms11572 KiB
#include <bits/stdc++.h> using namespace std; #define int long long void solve(){ int n,m;cin >> n >> m; int 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]); } int l = 0 , r = 1ll << 60; while(l < r){ int mid = (l+r)/2; int day = 0 , fail = 0; for(int i = 0;i<n;i++){ if(mid <= a[i] * m){ day += (mid + a[i] - 1) / a[i]; } else { day += m + (mid - a[i] * m + b[i] - 1) / b[i]; } if(day > n * m){fail = 1;} } if(fail)r = mid; else l = mid+1; } cout << l-1 << endl; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); int testcase = 1;//cin >> testcase; while(testcase--)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...