제출 #1130424

#제출 시각아이디문제언어결과실행 시간메모리
1130424AksLolCodingLet's Win the Election (JOI22_ho_t3)C++17
0 / 100
1 ms324 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll cdiv(ll a, ll b){ return (a + b - 1) / b; } int main(){ cin.tie(0)->sync_with_stdio(0); ll n, m; cin >> n >> m; vector<ll> a(n), b(n); for(auto& i: a) cin >> i; for(auto& i: b) cin >> i; for(int i = 0; i < n; i++) a[i] = max(a[i], b[i]); // solve auto check = [&](ll x) { ll days = 0; for (int i = 0; i < n; i++){ if(x <= a[i] * m) days += cdiv(x, a[i]); else days += m + cdiv(x - a[i] * m, b[i]); if(days > n * m) return false; } return true; }; ll l = 0, r = 1LL << 60; while(r - l > 1){ ll mid = (r + l) / 2; if (check(mid)) l = mid; else r = mid; } // ans 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...