답안 #939662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939662 2024-03-06T16:15:40 Z TAhmed33 Self Study (JOI22_ho_t2) C++
0 / 100
425 ms 5236 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 3e5 + 25;
ll n, m;
pair <ll, ll> a[MAXN];
void solve () {
	cin >> n >> m;
	for (int i = 1; i <= n; i++) cin >> a[i].first;
	for (int i = 1; i <= n; i++) cin >> a[i].second;
	for (int i = 1; i <= n; i++) a[i].first = max(a[i].first, a[i].second);
	ll l = 0, r = 1e18, ans = 0;
	while (l <= r) {
		ll mid = (l + r) / 2;
		ll sum = 0;
		for (int i = 1; i <= n; i++) {
			ll x = (mid + a[i].first - 1) / a[i].first;
			if (x <= m) {
				sum += x;
			} else {
				sum += ((mid - a[i].first * m + a[i].second - 1) / a[i].second) + m;
			}
		}
		if (sum <= n * m) {
			l = mid + 1; ans = mid;
		} else {
			r = mid - 1;
		}
	}
	cout << ans << '\n';
}	
int main () {
	ios::sync_with_stdio(0); cin.tie(0);
	int t = 1; //cin >> t;
	while (t--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 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 3 ms 348 KB Output is correct
11 Correct 203 ms 5132 KB Output is correct
12 Correct 201 ms 5132 KB Output is correct
13 Correct 212 ms 5236 KB Output is correct
14 Incorrect 425 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 104 ms 4744 KB Output is correct
10 Correct 70 ms 2648 KB Output is correct
11 Correct 51 ms 2652 KB Output is correct
12 Correct 43 ms 2900 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 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 8 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 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 3 ms 348 KB Output is correct
11 Correct 203 ms 5132 KB Output is correct
12 Correct 201 ms 5132 KB Output is correct
13 Correct 212 ms 5236 KB Output is correct
14 Incorrect 425 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 104 ms 4744 KB Output is correct
10 Correct 70 ms 2648 KB Output is correct
11 Correct 51 ms 2652 KB Output is correct
12 Correct 43 ms 2900 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 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 8 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 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 3 ms 348 KB Output is correct
11 Correct 203 ms 5132 KB Output is correct
12 Correct 201 ms 5132 KB Output is correct
13 Correct 212 ms 5236 KB Output is correct
14 Incorrect 425 ms 5132 KB Output isn't correct
15 Halted 0 ms 0 KB -