Submission #973533

#TimeUsernameProblemLanguageResultExecution timeMemory
973533berrSelf Study (JOI22_ho_t2)C++17
0 / 100
287 ms5216 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n>> m; vector<int> a(n), b(n); for(auto &i: a) cin >> i; for(auto &i: b) cin >> i; auto check=[&](int x){ int bos=0; for(int i=0; i<n; i++){ if(a[i]<=b[i]){ bos+=m; bos-=(x+b[i]-1)/b[i]; } else{ if(m*a[i]>=x){ bos+=m-(x+a[i]-1)/a[i]; } else{ bos-=(x-m*a[i]+b[i]-1)/b[i]; } } } return(bos>=0); }; int s=0; for(int i=60; i>=0; i--){ int tmp = s+(1LL<<i); if(check(tmp)) s=tmp; } cout<<s; }
#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...