답안 #939659

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
939659 2024-03-06T16:13:01 Z TAhmed33 Self Study (JOI22_ho_t2) C++
0 / 100
429 ms 11088 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 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 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 202 ms 8764 KB Output is correct
12 Correct 202 ms 11088 KB Output is correct
13 Correct 210 ms 8796 KB Output is correct
14 Incorrect 429 ms 8948 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 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 103 ms 4700 KB Output is correct
10 Correct 69 ms 2652 KB Output is correct
11 Correct 52 ms 2652 KB Output is correct
12 Correct 42 ms 2652 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 8 ms 536 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 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 202 ms 8764 KB Output is correct
12 Correct 202 ms 11088 KB Output is correct
13 Correct 210 ms 8796 KB Output is correct
14 Incorrect 429 ms 8948 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 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 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 103 ms 4700 KB Output is correct
10 Correct 69 ms 2652 KB Output is correct
11 Correct 52 ms 2652 KB Output is correct
12 Correct 42 ms 2652 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 8 ms 536 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 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 202 ms 8764 KB Output is correct
12 Correct 202 ms 11088 KB Output is correct
13 Correct 210 ms 8796 KB Output is correct
14 Incorrect 429 ms 8948 KB Output isn't correct
15 Halted 0 ms 0 KB -