Submission #973541

#TimeUsernameProblemLanguageResultExecution timeMemory
973541berrSelf Study (JOI22_ho_t2)C++17
0 / 100
282 ms5140 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<int> a(n), b(n); for(auto &i: a) cin >> i; for(auto &i: b) cin >> i; auto check=[&](int x){ int bos=0; for(int i=0; i<n; i++){ if(a[i]<=b[i]){ bos+=m; bos-=(x+b[i]-1)/b[i]; } else{ if(m*a[i]>=x){ bos+=m-(x+a[i]-1)/a[i]; } else{ bos-=(x-m*a[i]+b[i]-1)/b[i]; } } // if(-bos > (n-i)*m) return 0LL; } if(bos < 0) return 0LL; return 1LL; }; int s=0; for(int i=60; i>=0; i--){ int tmp = s+(1LL<<i); // cout<<tmp<<"\n"; if(check(tmp)) s=tmp; } cout<<s; }
#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...