Submission #676609

#TimeUsernameProblemLanguageResultExecution timeMemory
676609owoovoSelf Study (JOI22_ho_t2)C++17
0 / 100
422 ms4988 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; ll ori[2][3000010]={}; const ll maxn=1e18+100; int main(){ ll n,w; cin>>n>>w; for(int i=0;i<n;i++){ cin>>ori[0][i]; } for(int i=0;i<n;i++){ cin>>ori[1][i]; } ll l=1,r=maxn; while(l!=r){ ll m=(l+r+1)/2,c=0; for(int i=0;i<n;i++){ c+=w; if(ori[0][i]>ori[1][i]){ if(ori[0][i]*w>=m){ c-=((m-1)/ori[0][i])+1; }else{ c-=w; c-=((m-ori[0][i]*w-1)/ori[1][i])+1; } }else{ c-=((m-1)/ori[1][i])+1; } } if(c>=0){ l=m; }else{ r=m-1; } } cout<<l<<'\n'; 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...