답안 #928228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928228 2024-02-16T05:21:01 Z pcc Self Study (JOI22_ho_t2) C++14
10 / 100
273 ms 11596 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 = 1e18;
	while(l != r){
		ll mid = (l+r+1)>>1;
		if(f(mid))l = mid;
		else r = mid-1;
	}
	cout<<*min_element(arr+1,arr+N+1)<<'\n';
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 142 ms 5324 KB Output is correct
12 Correct 154 ms 5132 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Correct 273 ms 5140 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 259 ms 6484 KB Output is correct
17 Correct 147 ms 11596 KB Output is correct
18 Correct 151 ms 10944 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 259 ms 6484 KB Output is correct
3 Correct 147 ms 11596 KB Output is correct
4 Correct 151 ms 10944 KB Output is correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 142 ms 5324 KB Output is correct
12 Correct 154 ms 5132 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Correct 273 ms 5140 KB Output is correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 142 ms 5324 KB Output is correct
12 Correct 154 ms 5132 KB Output is correct
13 Correct 132 ms 5136 KB Output is correct
14 Correct 273 ms 5140 KB Output is correct
15 Incorrect 1 ms 2392 KB Output isn't correct
16 Halted 0 ms 0 KB -