답안 #999171

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
999171 2024-06-15T07:49:04 Z ZeroCool Self Study (JOI22_ho_t2) C++14
0 / 100
88 ms 10940 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define ll long long
#define ar array
#define ld long double

const int N = 2000, MOD = 1e9 + 7, INF = 1e17;


signed main(){ios::sync_with_stdio(false);cin.tie(0);	
	int n, m;
	cin>>n>>m;
	int A[n], B[n];
	for(int i = 0;i<n;i++)cin>>A[i];
	for(int i =0;i<n;i++)cin>>B[i], A[i] = max(A[i], B[i]);
	
	auto check = [&](int t){
		int cnt = 0;
		for(int i = 0;i<n;i++){
			if(A[i] * m >= t)cnt += (t - 1) / A[i] + 1;
			else cnt += (m + 1 + (t - m * A[i] - 1) / B[i]);
		}
		return cnt <= n * m;
	};
	
	int lo = 0;
	int hi = 1e18;
	int ans = 0;
	while(lo <= hi){
		int mid = (lo + hi) / 2;
		if(check(mid)){
			ans = mid;
			lo = mid + 1;
		}else hi = mid - 1;
	}
	cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 85 ms 10760 KB Output is correct
12 Correct 83 ms 10940 KB Output is correct
13 Correct 73 ms 8784 KB Output is correct
14 Incorrect 88 ms 8948 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 5468 KB Output is correct
10 Correct 29 ms 3928 KB Output is correct
11 Correct 21 ms 2904 KB Output is correct
12 Correct 17 ms 2392 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 85 ms 10760 KB Output is correct
12 Correct 83 ms 10940 KB Output is correct
13 Correct 73 ms 8784 KB Output is correct
14 Incorrect 88 ms 8948 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 452 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 45 ms 5468 KB Output is correct
10 Correct 29 ms 3928 KB Output is correct
11 Correct 21 ms 2904 KB Output is correct
12 Correct 17 ms 2392 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 352 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 608 KB Output is correct
11 Correct 85 ms 10760 KB Output is correct
12 Correct 83 ms 10940 KB Output is correct
13 Correct 73 ms 8784 KB Output is correct
14 Incorrect 88 ms 8948 KB Output isn't correct
15 Halted 0 ms 0 KB -