Submission #928229

# Submission time Handle Problem Language Result Execution time Memory
928229 2024-02-16T05:22:57 Z pcc Self Study (JOI22_ho_t2) C++14
0 / 100
0 ms 2396 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pll pair<ll,ll>
#define fs first
#define sc second

const ll mxn = 3e5+10;

ll N,M;
ll arr[mxn],brr[mxn];

ll f(ll tar){
	ll re = 0;
	for(int i = 1;i<=N;i++){
		if(arr[i]*M>=tar){
			re += M-(tar+arr[i]-1)/arr[i];
		}
		else{
			ll tmp = tar-arr[i]*M;
			re -= (tmp+brr[i]-1)/brr[i];
		}
	}
	return re>=0;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>M;
	for(int i = 1;i<=N;i++)cin>>arr[i];
	for(int i = 1;i<=N;i++)cin>>brr[i],arr[i] = max(arr[i],brr[i]);
	ll l = 0,r = 2e18;
	while(l != r){
		ll mid = (l+r+1)>>1;
		if(f(mid))l = mid;
		else r = mid-1;
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -