Submission #936711

#TimeUsernameProblemLanguageResultExecution timeMemory
936711kitlixSelf Study (JOI22_ho_t2)C++17
0 / 100
271 ms5140 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int INF = 1ll << 60; signed main() { ios_base::sync_with_stdio(0), cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n), b(n); for (auto& el : a) cin >> el; for (auto& el : b) cin >> el; for (int i = 0; i < n; ++i) a[i] = max(a[i], b[i]); int l = 0, r = INF; while (l + 1 < r) { int mid = (l + r) / 2; int total = 0; for (int i = 0; i < n; ++i) { if (a[i] * m >= mid) { total += (mid + a[i] - 1) / a[i]; continue; } total += m + (mid - a[i] * m + b[i] - 1) / b[i]; } if (total <= n * m) l = mid; else r = mid; } cout << l; }
#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...