답안 #706521

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
706521 2023-03-06T21:11:39 Z xuliu Self Study (JOI22_ho_t2) C++17
54 / 100
237 ms 11532 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define debug if(0)

const ll inf = 1e18+4;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, m; cin>>n>>m;
	vector<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];
	// A = B subtask
	auto check = [&](ll x) {
		// if can be done with minimum >= x
		__int128 res = 0;
		for(int i=0; i<n; i++) {
			ll y = (x+(b[i]-1LL))/b[i];
			//debug cerr<<"x: "<<x<<", b[i] = "<<b[i]<<" ; y = "<<y<<"\n";
			res += y;
		}
		//debug cerr<<"x: "<<x<<", res = "<<res<<" ; n*m = "<<n*m<<"\n";
		return res <= (n*m);
	};
	ll lo = 0, hi = inf;
	while(lo < hi) {
		ll m = (lo+hi+1)/2LL;
		if(check(m)) lo = m;
		else hi = m-1;
	}
	cout<<lo<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 96 ms 2644 KB Output is correct
10 Correct 56 ms 1876 KB Output is correct
11 Correct 40 ms 1492 KB Output is correct
12 Correct 33 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 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 4 ms 340 KB Output is correct
19 Correct 3 ms 456 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 205 ms 6184 KB Output is correct
22 Correct 173 ms 11532 KB Output is correct
23 Correct 160 ms 10808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 96 ms 2644 KB Output is correct
10 Correct 56 ms 1876 KB Output is correct
11 Correct 40 ms 1492 KB Output is correct
12 Correct 33 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 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 4 ms 340 KB Output is correct
19 Correct 3 ms 456 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 205 ms 6184 KB Output is correct
22 Correct 173 ms 11532 KB Output is correct
23 Correct 160 ms 10808 KB Output is correct
24 Correct 33 ms 1876 KB Output is correct
25 Correct 89 ms 4968 KB Output is correct
26 Correct 19 ms 1364 KB Output is correct
27 Correct 158 ms 10804 KB Output is correct
28 Correct 163 ms 10700 KB Output is correct
29 Correct 193 ms 10808 KB Output is correct
30 Correct 172 ms 10808 KB Output is correct
31 Correct 209 ms 10876 KB Output is correct
32 Correct 222 ms 6180 KB Output is correct
33 Correct 237 ms 11456 KB Output is correct
34 Correct 215 ms 6280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -