답안 #923032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
923032 2024-02-06T13:05:57 Z ting39 Self Study (JOI22_ho_t2) C++17
62 / 100
452 ms 11628 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 all=0;
	for(int i=0;i<n;i++){
		int emp=0,ext=0;
		all+=min(dv(x,a[i]),m);
		all+=max(dv(x-m*a[i],b[i]),0LL);
		if(n*m<all) return 0;
	}
	return 1;
}
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;
}

Compilation message

Main.cpp: In function 'bool check(long long int)':
Main.cpp:13:7: warning: unused variable 'emp' [-Wunused-variable]
   13 |   int emp=0,ext=0;
      |       ^~~
Main.cpp:13:13: warning: unused variable 'ext' [-Wunused-variable]
   13 |   int emp=0,ext=0;
      |             ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 240 ms 5116 KB Output is correct
12 Correct 252 ms 5116 KB Output is correct
13 Correct 183 ms 4956 KB Output is correct
14 Correct 189 ms 4956 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 70 ms 6140 KB Output is correct
17 Correct 247 ms 11376 KB Output is correct
18 Correct 243 ms 10992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 70 ms 6140 KB Output is correct
3 Correct 247 ms 11376 KB Output is correct
4 Correct 243 ms 10992 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 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 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 125 ms 2768 KB Output is correct
14 Correct 86 ms 1992 KB Output is correct
15 Correct 63 ms 1596 KB Output is correct
16 Correct 53 ms 1372 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 5 ms 556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 240 ms 5116 KB Output is correct
12 Correct 252 ms 5116 KB Output is correct
13 Correct 183 ms 4956 KB Output is correct
14 Correct 189 ms 4956 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 125 ms 2768 KB Output is correct
24 Correct 86 ms 1992 KB Output is correct
25 Correct 63 ms 1596 KB Output is correct
26 Correct 53 ms 1372 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 5 ms 556 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 70 ms 6140 KB Output is correct
36 Correct 247 ms 11376 KB Output is correct
37 Correct 243 ms 10992 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 600 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 5 ms 600 KB Output is correct
46 Correct 8 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 43 ms 2216 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 5 ms 448 KB Output is correct
52 Correct 1 ms 500 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 123 ms 5684 KB Output is correct
56 Correct 67 ms 3140 KB Output is correct
57 Correct 60 ms 3152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 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 344 KB Output is correct
6 Correct 1 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 125 ms 2768 KB Output is correct
10 Correct 86 ms 1992 KB Output is correct
11 Correct 63 ms 1596 KB Output is correct
12 Correct 53 ms 1372 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 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 Correct 2 ms 348 KB Output is correct
19 Correct 5 ms 556 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 70 ms 6140 KB Output is correct
22 Correct 247 ms 11376 KB Output is correct
23 Correct 243 ms 10992 KB Output is correct
24 Correct 66 ms 2044 KB Output is correct
25 Correct 172 ms 4944 KB Output is correct
26 Correct 33 ms 1308 KB Output is correct
27 Correct 252 ms 10836 KB Output is correct
28 Correct 252 ms 11008 KB Output is correct
29 Correct 256 ms 10736 KB Output is correct
30 Correct 300 ms 10740 KB Output is correct
31 Correct 452 ms 10928 KB Output is correct
32 Correct 207 ms 6256 KB Output is correct
33 Incorrect 442 ms 11628 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 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 1 ms 500 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 240 ms 5116 KB Output is correct
12 Correct 252 ms 5116 KB Output is correct
13 Correct 183 ms 4956 KB Output is correct
14 Correct 189 ms 4956 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 125 ms 2768 KB Output is correct
24 Correct 86 ms 1992 KB Output is correct
25 Correct 63 ms 1596 KB Output is correct
26 Correct 53 ms 1372 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 2 ms 348 KB Output is correct
33 Correct 5 ms 556 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 600 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 5 ms 600 KB Output is correct
42 Correct 8 ms 604 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 43 ms 2216 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 5 ms 448 KB Output is correct
48 Correct 1 ms 500 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 123 ms 5684 KB Output is correct
52 Correct 67 ms 3140 KB Output is correct
53 Correct 60 ms 3152 KB Output is correct
54 Correct 66 ms 2044 KB Output is correct
55 Correct 172 ms 4944 KB Output is correct
56 Correct 33 ms 1308 KB Output is correct
57 Correct 252 ms 10836 KB Output is correct
58 Correct 252 ms 11008 KB Output is correct
59 Correct 256 ms 10736 KB Output is correct
60 Correct 300 ms 10740 KB Output is correct
61 Correct 452 ms 10928 KB Output is correct
62 Correct 207 ms 6256 KB Output is correct
63 Incorrect 442 ms 11628 KB Output isn't correct
64 Halted 0 ms 0 KB -