답안 #1018807

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018807 2024-07-10T09:56:36 Z Bilal_Coder Self Study (JOI22_ho_t2) C++17
0 / 100
243 ms 5200 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 = 5e18;
    	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 348 KB Output is correct
11 Correct 218 ms 5120 KB Output is correct
12 Correct 243 ms 5200 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 157 ms 5112 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 94 ms 2652 KB Output is correct
10 Correct 82 ms 1880 KB Output is correct
11 Correct 44 ms 1372 KB Output is correct
12 Correct 44 ms 1372 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 2 ms 348 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 348 KB Output is correct
11 Correct 218 ms 5120 KB Output is correct
12 Correct 243 ms 5200 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 157 ms 5112 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 94 ms 2652 KB Output is correct
10 Correct 82 ms 1880 KB Output is correct
11 Correct 44 ms 1372 KB Output is correct
12 Correct 44 ms 1372 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 2 ms 348 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 348 KB Output is correct
11 Correct 218 ms 5120 KB Output is correct
12 Correct 243 ms 5200 KB Output is correct
13 Correct 144 ms 4956 KB Output is correct
14 Incorrect 157 ms 5112 KB Output isn't correct
15 Halted 0 ms 0 KB -