제출 #936715

#제출 시각아이디문제언어결과실행 시간메모리
936715kitlixSelf Study (JOI22_ho_t2)C++17
62 / 100
209 ms10328 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int INF = 1e18; 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) break; } if (total <= n * w) l = m; else r = m; } cout << l << '\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...