제출 #936707

#제출 시각아이디문제언어결과실행 시간메모리
936707kitlixSelf Study (JOI22_ho_t2)C++17
0 / 100
281 ms5140 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int INF = 4e18; 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 extra = 0, need = 0; for (int i = 0; i < n; ++i) { if (a[i] * w >= m) { extra += w - ((m + a[i] - 1) / a[i]); continue; } need += (m - a[i] * w + b[i] - 1) / b[i]; } if (extra >= need) 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...