12.24

include

include

include

using namespace std;
struct Chocolate{
int h,w;
};
int main(){
int N,K;
cin>>N>>K;
vectorchocs(N);
int max_s=0;
for(int i=0;i<N;++i){
cin>>chocs[i].h>>chocs[i].w;
max_s=max(max_s,max(chocs[i].h,chocs[i].w));
}
int left=1,right=max_s;
int ans=1;while(left<=right){
int mid=left+(right-left)/2;
long long total=0;
for(auto&c:chocs){
total+=(long long)(c.h/mid)*(c.w/mid);
if(total>=K)break;
}
if(total>=K){
ans=mid;
left=mid+1;
}else{
right=mid-1;
}
}
cout<<ans<<endl;
return 0;
}

posted @ 2025-12-25 21:05  Cx330。  阅读(2)  评论(0)    收藏  举报