답안 #922982

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
922982 2024-02-06T11:46:01 Z ting39 Self Study (JOI22_ho_t2) C++17
0 / 100
508 ms 10916 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
vector<int> a,b;
int dv(int x,int y){
	if(x<=0||y*(x/y)==x) return x/y;
	else return x/y+1;
}
bool check(int x){
	int emp=0,ext=0;
	for(int i=0;i<n;i++){
		emp+=max(m-dv(x,a[i]),0LL);
		ext+=max(dv(x-m*a[i],b[i]),0LL);
	}
	return emp>=ext;
}
signed main(){
	cin>>n>>m;
	a.resize(n);
	b.resize(n);
	for(int &i:a) cin>>i;
	for(int i=0;i<n;i++){
		cin>>b[i];
		a[i]=max(a[i],b[i]);
	}
	int l=0,r=1e18,mid;
	while(r-l>1){
		mid=(l+r)/2;
		if(check(mid)) l=mid;
		else r=mid;
	}
	cout<<l<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 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 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 6 ms 588 KB Output is correct
11 Correct 352 ms 10916 KB Output is correct
12 Correct 356 ms 10860 KB Output is correct
13 Correct 311 ms 9064 KB Output is correct
14 Incorrect 508 ms 8824 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 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 436 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 180 ms 5668 KB Output is correct
10 Correct 119 ms 3784 KB Output is correct
11 Correct 91 ms 2908 KB Output is correct
12 Correct 74 ms 2528 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 0 ms 432 KB Output is correct
18 Incorrect 9 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 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 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 6 ms 588 KB Output is correct
11 Correct 352 ms 10916 KB Output is correct
12 Correct 356 ms 10860 KB Output is correct
13 Correct 311 ms 9064 KB Output is correct
14 Incorrect 508 ms 8824 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 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 436 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 180 ms 5668 KB Output is correct
10 Correct 119 ms 3784 KB Output is correct
11 Correct 91 ms 2908 KB Output is correct
12 Correct 74 ms 2528 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 352 KB Output is correct
17 Correct 0 ms 432 KB Output is correct
18 Incorrect 9 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 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 1 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 6 ms 588 KB Output is correct
11 Correct 352 ms 10916 KB Output is correct
12 Correct 356 ms 10860 KB Output is correct
13 Correct 311 ms 9064 KB Output is correct
14 Incorrect 508 ms 8824 KB Output isn't correct
15 Halted 0 ms 0 KB -