Submission #936710

#TimeUsernameProblemLanguageResultExecution timeMemory
936710kitlixSelf Study (JOI22_ho_t2)C++17
0 / 100
272 ms5208 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, w; cin >> n >> w; 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 m = (l + r) / 2; int total = 0; for (int i = 0; i < n; ++i) { if (a[i] * w >= m) { total += (m + a[i] - 1) / a[i]; continue; } total += w + (m - a[i] * w + b[i] - 1) / b[i]; } if (total <= n * w) l = m; else r = m; } 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...