Submission #937795

#TimeUsernameProblemLanguageResultExecution timeMemory
937795AndreySelf Study (JOI22_ho_t2)C++14
0 / 100
283 ms16296 KiB
#include <bits/stdc++.h> using namespace std; vector<long long> haha(0); vector<long long> bruh(0); long long n,m; bool check(long long a) { long long br = 0; for(long long i = 0; i < n; i++) { if(haha[i] <= bruh[i]) { br+=(a-1)/bruh[i]+1; } else { if(a > haha[i]*m) { br+=m; br+=(a-1-haha[i]*m)/bruh[i]+1; } else { br+=(a-1)/haha[i]+1; } } } if(br > n*m) { return false; } else { return true; } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n >> m; long long a; for(long long i = 0; i < n; i++) { cin >> a; haha.push_back(a); } for(long long i = 0; i < n; i++) { cin >> a; bruh.push_back(a); } long long l = 0,r = 1e18; while(l < r) { long long mid = (l+r+1)/2; if(check(mid)) { l = mid; } else { r = mid-1; } } 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...