제출 #1164637

#제출 시각아이디문제언어결과실행 시간메모리
1164637MunkhturErdenebatSelf Study (JOI22_ho_t2)C++20
0 / 100
196 ms36436 KiB
#include<bits/stdc++.h> #include<string.h> #include <algorithm> #include <iterator> #include <set> #include <stdlib.h> #define ll long long #define fr first #define sc second #define pb push_back using namespace std; ll a,b,c,d,e,f,m,i,j,n,h,g,l,r,ka,p,q[3000005],t[5000005],k[5000005]; map<ll,ll> mee,see; map<ll,ll> maa,mii; vector<ll> vas[1000006],ves[200005],vis,vii; string x[100000],y,z; pair<ll,ll> wefe; priority_queue<ll> pq; stack<ll> munkh; int main(){ cin>>a>>b; for(i=0 ; i<a ; i++){ cin>>k[i]; } for(i=0 ; i<a ; i++){ cin>>q[i]; } l=0; r=10000000000000000; while(l<r){ m=(l+r+1)/2; g=0; h=0; for(i=0 ; i<a ; i++){ n=max(k[i],q[i]); if(m<=b*n){ g+=b-(m+n-1)/n; } else{ c=m-b*n; h+=(c+q[i]-1)/(q[i]); } } if(g>=h){ l=m; } else{ r=m-1; } } cout<<l; }
#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...