제출 #916338

#제출 시각아이디문제언어결과실행 시간메모리
916338ace5Self Study (JOI22_ho_t2)C++17
100 / 100
363 ms11572 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n,m; cin >> n >> m; int64_t a[n],b[n]; for(int i = 0;i < n;++i) { cin >> a[i]; } for(int i = 0;i < n;++i) { cin >> b[i]; if(a[i] < b[i]) a[i] = b[i]; } int64_t l = 0,r = 1e18; while(l < r) { int64_t mid = (l+r+1)/2; __int128 sv = 0; __int128 bv = 0; for(int j = 0;j < n;++j) { sv += max(int64_t(0),m-((mid+a[j]-1)/a[j])); bv += max(int64_t(0),(mid-m*a[j]+b[j]-1)/b[j]); } sv < bv ? r = mid-1 : l = mid; } cout << l; return 0; }
#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...