답안 #928230

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928230 2024-02-16T05:23:33 Z pcc Self Study (JOI22_ho_t2) C++14
0 / 100
276 ms 5132 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;
	}
	cout<<l<<'\n';
	return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 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 4956 KB Output is correct
12 Correct 143 ms 4944 KB Output is correct
13 Correct 134 ms 5128 KB Output is correct
14 Incorrect 276 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2392 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 73 ms 4720 KB Output is correct
10 Correct 50 ms 4700 KB Output is correct
11 Correct 37 ms 4696 KB Output is correct
12 Correct 29 ms 4748 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2404 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Incorrect 5 ms 2396 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 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 4956 KB Output is correct
12 Correct 143 ms 4944 KB Output is correct
13 Correct 134 ms 5128 KB Output is correct
14 Incorrect 276 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2392 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 73 ms 4720 KB Output is correct
10 Correct 50 ms 4700 KB Output is correct
11 Correct 37 ms 4696 KB Output is correct
12 Correct 29 ms 4748 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2404 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Incorrect 5 ms 2396 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 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 4956 KB Output is correct
12 Correct 143 ms 4944 KB Output is correct
13 Correct 134 ms 5128 KB Output is correct
14 Incorrect 276 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -