답안 #863821

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863821 2023-10-21T07:43:28 Z phoenix0423 Self Study (JOI22_ho_t2) C++17
0 / 100
451 ms 7488 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pll;
#define fastio ios::sync_with_stdio(false), cin.tie(0)
#pragma GCC optimize("Ofast")
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lowbit(x) x&-x
const int maxn = 2e5 + 5;
const ll INF = 8e18;

int main(void){
	fastio;
	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];
	ll l = 0, r = INF;
	while(l + 1 < r){
		ll mid = (l + r) / 2;
		vector<ll> have(n);
		ll fr = 0;
		for(int i = 0; i < n; i++){
			if(a[i] <= b[i]){
				fr += m;
				continue;
			}
			ll nd = min(m, (mid - 1) / a[i] + 1);
			fr += m - nd;
			have[i] = a[i] * nd;
		}
		for(int i = 0; i < n; i++){
			if(have[i] >= mid) continue;
			fr -= (mid - have[i] - 1) / b[i] + 1;
		}
		if(fr < 0) r = mid;
		else l = mid;
	}
	cout<<l<<"\n";
}
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 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 3 ms 348 KB Output is correct
11 Correct 242 ms 7460 KB Output is correct
12 Correct 242 ms 7484 KB Output is correct
13 Correct 152 ms 7488 KB Output is correct
14 Incorrect 451 ms 7488 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 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 86 ms 3964 KB Output is correct
10 Correct 55 ms 2792 KB Output is correct
11 Correct 44 ms 2292 KB Output is correct
12 Correct 32 ms 1884 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 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 5 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 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 3 ms 348 KB Output is correct
11 Correct 242 ms 7460 KB Output is correct
12 Correct 242 ms 7484 KB Output is correct
13 Correct 152 ms 7488 KB Output is correct
14 Incorrect 451 ms 7488 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 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 86 ms 3964 KB Output is correct
10 Correct 55 ms 2792 KB Output is correct
11 Correct 44 ms 2292 KB Output is correct
12 Correct 32 ms 1884 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 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 5 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 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 3 ms 348 KB Output is correct
11 Correct 242 ms 7460 KB Output is correct
12 Correct 242 ms 7484 KB Output is correct
13 Correct 152 ms 7488 KB Output is correct
14 Incorrect 451 ms 7488 KB Output isn't correct
15 Halted 0 ms 0 KB -