답안 #928221

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928221 2024-02-16T05:16:14 Z pcc Self Study (JOI22_ho_t2) C++17
0 / 100
271 ms 10940 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<<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 1 ms 2396 KB Output is correct
4 Correct 1 ms 2516 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 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 144 ms 10940 KB Output is correct
12 Correct 144 ms 10904 KB Output is correct
13 Correct 132 ms 8948 KB Output is correct
14 Incorrect 271 ms 8788 KB Output isn't correct
15 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 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 72 ms 7640 KB Output is correct
10 Correct 49 ms 6656 KB Output is correct
11 Correct 39 ms 6236 KB Output is correct
12 Correct 29 ms 5724 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2516 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 1 ms 2396 KB Output is correct
4 Correct 1 ms 2516 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 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 144 ms 10940 KB Output is correct
12 Correct 144 ms 10904 KB Output is correct
13 Correct 132 ms 8948 KB Output is correct
14 Incorrect 271 ms 8788 KB Output isn't correct
15 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 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 72 ms 7640 KB Output is correct
10 Correct 49 ms 6656 KB Output is correct
11 Correct 39 ms 6236 KB Output is correct
12 Correct 29 ms 5724 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 0 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2516 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 1 ms 2396 KB Output is correct
4 Correct 1 ms 2516 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 1 ms 2396 KB Output is correct
10 Correct 3 ms 2396 KB Output is correct
11 Correct 144 ms 10940 KB Output is correct
12 Correct 144 ms 10904 KB Output is correct
13 Correct 132 ms 8948 KB Output is correct
14 Incorrect 271 ms 8788 KB Output isn't correct
15 Halted 0 ms 0 KB -