답안 #923416

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
923416 2024-02-07T07:47:29 Z goodspeed0208 Self Study (JOI22_ho_t2) C++14
0 / 100
285 ms 5140 KB
#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
using namespace std;

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<int>a(n), b(n);
	for (auto &i : a) cin >> i;
	for (auto &i : b) cin >> i;
	
	int l = 1, r = 1000000000000000005, mid;
	while (l + 1 < r) {
		mid = (l + r) / 2;
		int need = 0;
		for (int i = 0 ; i < n ; i++) {
			if (a[i] > b[i]) {
				if (mid > a[i] * m) {
					need += m + (mid - a[i] * m) / b[i];
					if ((mid - a[i] * m ) % b[i] != 0) need++;
				}
				else {
					need += mid / a[i];
					if (mid % a[i] != 0) need++;
				}
			} else {
				need += (mid / b[i]);
				if (mid % b[i] != 0) need++;
			}
		}
		if (need <= n * m) {
			l = mid;
			//cout << l << " " << need << "\n";
		} else {
			r = mid;
			//cout << r << " " << need << "\n";
		}
	}
	cout << l << "\n";
}





# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 504 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 152 ms 4956 KB Output is correct
12 Correct 151 ms 4952 KB Output is correct
13 Correct 134 ms 4952 KB Output is correct
14 Incorrect 285 ms 5140 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 74 ms 2804 KB Output is correct
10 Correct 58 ms 1884 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 29 ms 1368 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 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 5 ms 344 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 504 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 152 ms 4956 KB Output is correct
12 Correct 151 ms 4952 KB Output is correct
13 Correct 134 ms 4952 KB Output is correct
14 Incorrect 285 ms 5140 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 74 ms 2804 KB Output is correct
10 Correct 58 ms 1884 KB Output is correct
11 Correct 36 ms 1628 KB Output is correct
12 Correct 29 ms 1368 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 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 5 ms 344 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 504 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 152 ms 4956 KB Output is correct
12 Correct 151 ms 4952 KB Output is correct
13 Correct 134 ms 4952 KB Output is correct
14 Incorrect 285 ms 5140 KB Output isn't correct
15 Halted 0 ms 0 KB -