Submission #538657

#TimeUsernameProblemLanguageResultExecution timeMemory
538657Harry464Self Study (JOI22_ho_t2)C++14
0 / 100
466 ms5068 KiB
#include <cmath> #include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main(){ ll n, m; cin >> n >> m; vector <double> a(n); vector <double> 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 l = 1, r = 1000000000000000001; while (l < r){ ll mid = (l+r)/2; ll potrebno = 0; for (int i = 0; i < n; i++){ ll maksa = ceil(((double) mid)/a[i]); potrebno += min(maksa, m); ll maksb = ceil(((double)mid- (double)min(maksa, m)*a[i])/b[i]); potrebno += max((ll) 0, maksb); } if (potrebno <= n*m) l = mid + 1; else r = mid; } cout << l - 1; }
#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...