Submission #999171

#TimeUsernameProblemLanguageResultExecution timeMemory
999171ZeroCoolSelf Study (JOI22_ho_t2)C++14
0 / 100
88 ms10940 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define ar array #define ld long double const int N = 2000, MOD = 1e9 + 7, INF = 1e17; signed main(){ios::sync_with_stdio(false);cin.tie(0); 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]); auto check = [&](int t){ int cnt = 0; for(int i = 0;i<n;i++){ if(A[i] * m >= t)cnt += (t - 1) / A[i] + 1; else cnt += (m + 1 + (t - m * A[i] - 1) / B[i]); } return cnt <= n * m; }; int lo = 0; int hi = 1e18; int ans = 0; while(lo <= hi){ int mid = (lo + hi) / 2; if(check(mid)){ ans = mid; lo = mid + 1; }else hi = mid - 1; } cout<<ans; }
#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...