답안 #536784

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536784 2022-03-14T03:19:11 Z xp875 Self Study (JOI22_ho_t2) C++17
10 / 100
84 ms 5000 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	
	ll n, m;
	cin >> n >> m;
	ll a[n], b[n];
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n; i++) cin >> b[i];
	if(m==1) {
		ll ans = (ll)1<<60;
		for(int i=0;i<n; i++) {
			ans = min(ans, max(a[i], b[i]));
		}
		cout << ans;
		return 0;
	}
	
	ll lo = 0, hi = (ll)1<<60;
	while(hi-lo>1) {
		ll x = (lo+hi)/2;
		ll ans = 0;
		for(int i=0; i<n; i++) {
			if(a[i]>b[i]){
				if(x > m*a[i]) ans += m + (x-a[i]*m+b[i]-1)/b[i];
				else ans += (x+a[i]-1)/a[i];
			}
			else ans += (x+b[i]-1)/b[i];
		}
		if(ans <= n*m) lo = x;
		else hi = x;
		
	}
	cout << lo;
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 59 ms 4948 KB Output is correct
12 Correct 61 ms 4992 KB Output is correct
13 Correct 51 ms 4988 KB Output is correct
14 Correct 50 ms 4948 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 29 ms 4948 KB Output is correct
17 Correct 73 ms 4996 KB Output is correct
18 Correct 58 ms 5000 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 29 ms 4948 KB Output is correct
3 Correct 73 ms 4996 KB Output is correct
4 Correct 58 ms 5000 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 84 ms 2644 KB Output is correct
14 Correct 59 ms 1876 KB Output is correct
15 Correct 43 ms 1492 KB Output is correct
16 Correct 36 ms 1236 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Incorrect 6 ms 340 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 59 ms 4948 KB Output is correct
12 Correct 61 ms 4992 KB Output is correct
13 Correct 51 ms 4988 KB Output is correct
14 Correct 50 ms 4948 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 84 ms 2644 KB Output is correct
24 Correct 59 ms 1876 KB Output is correct
25 Correct 43 ms 1492 KB Output is correct
26 Correct 36 ms 1236 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Incorrect 6 ms 340 KB Output isn't correct
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 84 ms 2644 KB Output is correct
10 Correct 59 ms 1876 KB Output is correct
11 Correct 43 ms 1492 KB Output is correct
12 Correct 36 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 6 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 59 ms 4948 KB Output is correct
12 Correct 61 ms 4992 KB Output is correct
13 Correct 51 ms 4988 KB Output is correct
14 Correct 50 ms 4948 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 84 ms 2644 KB Output is correct
24 Correct 59 ms 1876 KB Output is correct
25 Correct 43 ms 1492 KB Output is correct
26 Correct 36 ms 1236 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Incorrect 6 ms 340 KB Output isn't correct
33 Halted 0 ms 0 KB -