답안 #939664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939664 2024-03-06T16:17:13 Z TAhmed33 Self Study (JOI22_ho_t2) C++
0 / 100
427 ms 5332 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;
	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 + max(a[i].first, a[i].second) - 1) / max(a[i].second, a[i].first);
			if (x <= m) {
				sum += x;
			} else {
				sum += ((mid - max(a[i].second, 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 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 213 ms 5204 KB Output is correct
12 Correct 206 ms 5128 KB Output is correct
13 Correct 208 ms 4952 KB Output is correct
14 Incorrect 427 ms 5332 KB Output isn't correct
15 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 344 KB Output is correct
4 Correct 0 ms 344 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 105 ms 4724 KB Output is correct
10 Correct 69 ms 2652 KB Output is correct
11 Correct 51 ms 2648 KB Output is correct
12 Correct 43 ms 2672 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 213 ms 5204 KB Output is correct
12 Correct 206 ms 5128 KB Output is correct
13 Correct 208 ms 4952 KB Output is correct
14 Incorrect 427 ms 5332 KB Output isn't correct
15 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 344 KB Output is correct
4 Correct 0 ms 344 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 105 ms 4724 KB Output is correct
10 Correct 69 ms 2652 KB Output is correct
11 Correct 51 ms 2648 KB Output is correct
12 Correct 43 ms 2672 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 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 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 213 ms 5204 KB Output is correct
12 Correct 206 ms 5128 KB Output is correct
13 Correct 208 ms 4952 KB Output is correct
14 Incorrect 427 ms 5332 KB Output isn't correct
15 Halted 0 ms 0 KB -