답안 #1018789

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018789 2024-07-10T09:47:59 Z Bilal_Coder Self Study (JOI22_ho_t2) C++17
0 / 100
228 ms 5124 KB
#include "bits/stdc++.h"
using namespace std;
#define int long long 
/*
▀█████████▄   ▄█   ▄█          ▄████████  ▄█        ▄████████  ▄██████▄  ████████▄     ▄████████    ▄████████ 
  ███    ███ ███  ███         ███    ███ ███       ███    ███ ███    ███ ███   ▀███   ███    ███   ███    ███ 
  ███    ███ ███▌ ███         ███    ███ ███       ███    █▀  ███    ███ ███    ███   ███    █▀    ███    ███ 
 ▄███▄▄▄██▀  ███▌ ███         ███    ███ ███       ███        ███    ███ ███    ███  ▄███▄▄▄      ▄███▄▄▄▄██▀ 
▀▀███▀▀▀██▄  ███▌ ███       ▀███████████ ███       ███        ███    ███ ███    ███ ▀▀███▀▀▀     ▀▀███▀▀▀▀▀   
  ███    ██▄ ███  ███         ███    ███ ███       ███    █▄  ███    ███ ███    ███   ███    █▄  ▀███████████ 
  ███    ███ ███  ███▌    ▄   ███    ███ ███▌    ▄ ███    ███ ███    ███ ███   ▄███   ███    ███   ███    ███ 
▄█████████▀  █▀   █████▄▄██   ███    █▀  █████▄▄██ ████████▀   ▀██████▀  ████████▀    ██████████   ███    ███ 
                  ▀                      ▀                                                         ███    ███ 
*/
template<class T> bool setmax(T& a, const T& b){ 
	return b < a ? a = b, 1 : 0; 
}
template<class T> bool setmin(T& a, const T& b){ 
	return a < b ? a = b, 1 : 0; 
} 
signed main()
{
	int n , m;
	cin >> n >> m;
	vector<int> a(n) , b(n);
	for (auto & x : a)
		cin >> x;
	for (auto & x : b)
		cin >> x;
	auto check = [&](int p){
		int t = 0;
		for (int i = 0; i < n; i++){
			if (b[i] > a[i])
				t += (p + b[i] - 1) / b[i];
			else {
				if (a[i] * 1ll * m >= p)
					t += (p + a[i] - 1) / a[i];
				else 
					t += m + (p - a[i] * 1ll * m + b[i] - 1) / b[i];
			}
		}
		if (t <= n * 1ll * m)
			return true;
		return false;
	};
	int l = 0 , r = 1e18;
	while(l < r){
		int m = (l + r + 1) >> 1;
		if (check(m))
			l = m;
		else r = m - 1;
	}
	cout << l << "\n";
	return 0;
}
# 결과 실행 시간 메모리 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 348 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 213 ms 5116 KB Output is correct
12 Correct 228 ms 4952 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 151 ms 5124 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 87 ms 2764 KB Output is correct
10 Correct 58 ms 1884 KB Output is correct
11 Correct 44 ms 1372 KB Output is correct
12 Correct 35 ms 1372 KB Output is correct
13 Correct 1 ms 348 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 392 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 504 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 348 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 213 ms 5116 KB Output is correct
12 Correct 228 ms 4952 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 151 ms 5124 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 87 ms 2764 KB Output is correct
10 Correct 58 ms 1884 KB Output is correct
11 Correct 44 ms 1372 KB Output is correct
12 Correct 35 ms 1372 KB Output is correct
13 Correct 1 ms 348 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 392 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 504 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 348 KB Output is correct
10 Correct 3 ms 380 KB Output is correct
11 Correct 213 ms 5116 KB Output is correct
12 Correct 228 ms 4952 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 151 ms 5124 KB Output isn't correct
15 Halted 0 ms 0 KB -