| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1177072 | AlgorithmWarrior | Self Study (JOI22_ho_t2) | C++20 | 238 ms | 2764 KiB |
#include <bits/stdc++.h>
using namespace std;
long long const INF=1e18;
int const MAX=3e5+5;
int a[MAX],b[MAX];
int n,m;
void read(){
cin>>n>>m;
int i;
for(i=1;i<=n;++i)
cin>>a[i];
for(i=1;i<=n;++i)
cin>>b[i];
}
bool check(long long val){
long long schedule=0,freetime=0;
int i;
for(i=1;i<=n;++i)
if(b[i]>=a[i]){
schedule+=(val+b[i]-1)/b[i];
freetime+=m;
}
else
if(1LL*a[i]*m>=val)
freetime+=m-(val+a[i]-1)/a[i];
else
schedule+=(val-1LL*a[i]*m+b[i]-1)/b[i];
return schedule<=freetime;
}
long long bin_search(){
long long st=0,dr=INF+1;
/// [)
while(dr-st>1){
long long mij=(st+dr)/2;
if(check(mij))
st=mij;
else
dr=mij;
}
return st;
}
int main()
{
read();
cout<<bin_search();
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
