Submission #1018876

#TimeUsernameProblemLanguageResultExecution timeMemory
1018876vjudge1Snowball (JOI21_ho_t2)C++17
0 / 100
0 ms344 KiB
#include<iostream> #include<vector> #include<algorithm> using namespace std; bool can_achieve_min_level(long long N,long long M,const vector<long long>& A,const vector<long long>& B,long long X) { long long total_lessons=N*M; long long lessons_needed=0; for(long long i=0; i<N; ++i) { if(A[i]>=X) { continue; } long long lessons_to_attend=(X+A[i]-1)/A[i]; lessons_needed+=lessons_to_attend; } return lessons_needed<=total_lessons; } long long maximize_min_level(long long N, long long M,const vector<long long>& A,const vector<long long>& B) { long long low=0,high=*max_element(A.begin(),A.end())*M; while(low<high) { long long mid=(low+high+1)/2; if(can_achieve_min_level(N,M,A,B,mid)) { low=mid; } else { high=mid-1; } } return low; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); long long N,M; cin>>N>>M; vector<long long> A(N),B(N); for(long long i=0; i<N; ++i) { cin>>A[i]; } for(long long i=0; i<N; ++i) { cin>>B[i]; } long long result=maximize_min_level(N,M,A,B); cout<<result<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...