Submission #526444

#TimeUsernameProblemLanguageResultExecution timeMemory
526444sidonSelf Study (JOI22_ho_t2)C++17
100 / 100
379 ms5196 KiB
#include <bits/stdc++.h> using namespace std; #define int __int128 const int Z = 3e5; int64_t N, M, A[Z], B[Z], x; int32_t main() { ios::sync_with_stdio(0), cin.tie(0); cin >> N >> M; for(auto &j : {A, B}) for(int i = 0; i < N; ++i) cin >> j[i]; for(int i = 0; i < N; ++i) A[i] = max(A[i], B[i]); for(int y = 1LL<<62; y /= 2; ) { int free = 0; for(int i = 0; i < N; ++i) { int a_req = (x + y + A[i] - 1) / A[i]; if(a_req <= M) free += M - a_req; else free -= (x + y - M * A[i] + B[i] - 1) / B[i]; } if(free >= 0) x += y; } cout << int64_t(x); }
#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...