답안 #751968

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751968 2023-06-02T02:03:10 Z willychan Self Study (JOI22_ho_t2) C++14
0 / 100
462 ms 5012 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include<bits/extc++.h>
//__gnu_pbds
#define int ll
ll n,m;
vector<int> a;
vector<int> b;
bool check(ll k){
	ll left = 0;							
	for(int i=0;i<n;i++){
		ll c = k;
		ll g = (c/a[i])+((c%a[i])!=0);
		if(g>m)	{
			c-=(m*a[i]);
			left -= (c/b[i])+((c%b[i])!=0);
		}else{
			left+=m-g;			
		}
	}
	return left>=0;
}


signed main(){
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>m;		
	a.resize(n);b.resize(n);
	for(int i=0;i<n;i++) cin>>a[i];
	ll maxnn = 0;
	for(int i=0;i<n;i++) {
		cin>>b[i];
		a[i] = max(a[i],b[i]);
		maxnn  = max(maxnn,a[i]);
	}
	long long l = 0; long long r = 1e18+5;
	while(r-l>1LL){
	 	long long mid = (l+r)/2;
		if(check(mid)){
			l = mid;
		}else{
			r = mid;	
		}
	}
	cout<<l<<"\n";
	return 0;
}
# 결과 실행 시간 메모리 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 0 ms 212 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 4 ms 340 KB Output is correct
11 Correct 241 ms 4948 KB Output is correct
12 Correct 227 ms 5008 KB Output is correct
13 Correct 233 ms 5012 KB Output is correct
14 Incorrect 462 ms 5008 KB Output isn't correct
15 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 126 ms 2660 KB Output is correct
10 Correct 75 ms 1884 KB Output is correct
11 Correct 59 ms 1492 KB Output is correct
12 Correct 48 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 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 9 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 0 ms 212 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 4 ms 340 KB Output is correct
11 Correct 241 ms 4948 KB Output is correct
12 Correct 227 ms 5008 KB Output is correct
13 Correct 233 ms 5012 KB Output is correct
14 Incorrect 462 ms 5008 KB Output isn't correct
15 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 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 126 ms 2660 KB Output is correct
10 Correct 75 ms 1884 KB Output is correct
11 Correct 59 ms 1492 KB Output is correct
12 Correct 48 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 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 9 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 0 ms 212 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 4 ms 340 KB Output is correct
11 Correct 241 ms 4948 KB Output is correct
12 Correct 227 ms 5008 KB Output is correct
13 Correct 233 ms 5012 KB Output is correct
14 Incorrect 462 ms 5008 KB Output isn't correct
15 Halted 0 ms 0 KB -