답안 #1000518

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1000518 2024-06-17T16:21:41 Z LCJLY Self Study (JOI22_ho_t2) C++14
62 / 100
118 ms 11344 KB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<int,int>pii;
typedef array<int,3>pi2;
#define ll __int128

void solve(){	
	int n,m;
	cin >> n >> m;
	pii arr[n];
	for(int x=0;x<n;x++){
		cin >> arr[x].first;
	}	
	
	for(int x=0;x<n;x++){
		cin >> arr[x].second;
		arr[x].first=max(arr[x].first,arr[x].second);
	}
	
	int l=0;
	int r=1e17;
	int mid;
	int best=0;
	while(l<=r){
		mid=(l+r)/2;
		ll counter=0;
		for(int x=0;x<n;x++){
			ll hold=(mid+arr[x].first-1)/arr[x].first;
			if(hold<=m){
				counter+=hold;
			}
			else{
				counter+=m;
				ll hold2=(mid-arr[x].first*m);
				counter+=(hold2+arr[x].second-1)/arr[x].second;
			}
		}
		
		if(counter<=n*m){
			best=mid;
			l=mid+1;
		}
		else r=mid-1;
	}
	cout << best;
}	
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin >> t;
	//freopen("in.txt","r",stdin);
	while(t--){
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 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 2 ms 348 KB Output is correct
11 Correct 103 ms 5128 KB Output is correct
12 Correct 101 ms 4956 KB Output is correct
13 Correct 100 ms 4956 KB Output is correct
14 Correct 104 ms 5120 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 102 ms 4956 KB Output is correct
17 Correct 117 ms 4956 KB Output is correct
18 Correct 104 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 102 ms 4956 KB Output is correct
3 Correct 117 ms 4956 KB Output is correct
4 Correct 104 ms 4952 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 0 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 53 ms 2776 KB Output is correct
14 Correct 35 ms 1884 KB Output is correct
15 Correct 27 ms 1368 KB Output is correct
16 Correct 22 ms 1368 KB Output is correct
17 Correct 1 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 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 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 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 2 ms 348 KB Output is correct
11 Correct 103 ms 5128 KB Output is correct
12 Correct 101 ms 4956 KB Output is correct
13 Correct 100 ms 4956 KB Output is correct
14 Correct 104 ms 5120 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 0 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 0 ms 348 KB Output is correct
23 Correct 53 ms 2776 KB Output is correct
24 Correct 35 ms 1884 KB Output is correct
25 Correct 27 ms 1368 KB Output is correct
26 Correct 22 ms 1368 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 344 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 2 ms 348 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 102 ms 4956 KB Output is correct
36 Correct 117 ms 4956 KB Output is correct
37 Correct 104 ms 4952 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 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 2 ms 348 KB Output is correct
46 Correct 4 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 18 ms 1256 KB Output is correct
49 Correct 0 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 348 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 0 ms 352 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 53 ms 2652 KB Output is correct
56 Correct 34 ms 1884 KB Output is correct
57 Correct 35 ms 1884 KB Output is correct
# 결과 실행 시간 메모리 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 53 ms 2776 KB Output is correct
10 Correct 35 ms 1884 KB Output is correct
11 Correct 27 ms 1368 KB Output is correct
12 Correct 22 ms 1368 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 344 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 2 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 102 ms 4956 KB Output is correct
22 Correct 117 ms 4956 KB Output is correct
23 Correct 104 ms 4952 KB Output is correct
24 Correct 15 ms 1112 KB Output is correct
25 Correct 59 ms 4952 KB Output is correct
26 Correct 12 ms 1368 KB Output is correct
27 Correct 104 ms 10892 KB Output is correct
28 Correct 118 ms 11088 KB Output is correct
29 Correct 114 ms 10832 KB Output is correct
30 Correct 109 ms 10832 KB Output is correct
31 Correct 90 ms 10892 KB Output is correct
32 Correct 93 ms 6300 KB Output is correct
33 Incorrect 86 ms 11344 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 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 2 ms 348 KB Output is correct
11 Correct 103 ms 5128 KB Output is correct
12 Correct 101 ms 4956 KB Output is correct
13 Correct 100 ms 4956 KB Output is correct
14 Correct 104 ms 5120 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 0 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 0 ms 348 KB Output is correct
23 Correct 53 ms 2776 KB Output is correct
24 Correct 35 ms 1884 KB Output is correct
25 Correct 27 ms 1368 KB Output is correct
26 Correct 22 ms 1368 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 344 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 2 ms 348 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 344 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 2 ms 348 KB Output is correct
42 Correct 4 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 18 ms 1256 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 348 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 0 ms 352 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 53 ms 2652 KB Output is correct
52 Correct 34 ms 1884 KB Output is correct
53 Correct 35 ms 1884 KB Output is correct
54 Correct 15 ms 1112 KB Output is correct
55 Correct 59 ms 4952 KB Output is correct
56 Correct 12 ms 1368 KB Output is correct
57 Correct 104 ms 10892 KB Output is correct
58 Correct 118 ms 11088 KB Output is correct
59 Correct 114 ms 10832 KB Output is correct
60 Correct 109 ms 10832 KB Output is correct
61 Correct 90 ms 10892 KB Output is correct
62 Correct 93 ms 6300 KB Output is correct
63 Incorrect 86 ms 11344 KB Output isn't correct
64 Halted 0 ms 0 KB -