Submission #1134901

#TimeUsernameProblemLanguageResultExecution timeMemory
1134901UnforgettableplSelf Study (JOI22_ho_t2)C++20
0 / 100
133 ms4936 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ceilDiv(A,B) ((A)/(B) + min(1ll,A%B)) const int INF = 1e10; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,m; cin >> n >> m; vector<int> A(n),B(n); for(int&i:A)cin>>i; for(int&i:B)cin>>i; auto test = [&](int x) { int pick = 0; for(int i=0;i<n;i++) { if(B[i]>=A[i])pick+=ceilDiv(x,B[i]); else if(x<=A[i]*m)pick+=ceilDiv(x,A[i]); else pick+=m+ceilDiv(x-A[i]*m,B[i]); } return pick<=n*m; }; int ans = 0; for(int jump=(1ll<<59);jump;jump/=2) { if(test(ans+jump))ans+=jump; } cout << ans << '\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...