답안 #1077701

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077701 2024-08-27T08:39:01 Z Acanikolic Self Study (JOI22_ho_t2) C++14
62 / 100
127 ms 13892 KB
#include <bits/stdc++.h>  

#define int long long 

#define pb push_back
 
#define F first
 
#define S second
 
using namespace std;
 
const int N = 1e5 + 10;
 
const int mod = 1e9 + 7;
 
const int inf = 1e9;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 	
 	int n,m;
 	cin >> n >> m;
 	vector<int>a(n + 1),b(n + 1),c(n + 1);
 	for(int i = 1; i <= n; i++) cin >> a[i];
 	for(int i = 1; i <= n; i++) cin >> b[i];
 	for(int i = 1; i <= n; i++) c[i] = max(a[i],b[i]);
 	int l = 1,r = *max_element(c.begin(),c.end()) * m,ans = 0;
 	while(l <= r) {
 		int mid = (l + r) / 2,rest = 0;
 		for(int i = 1; i <= n; i++) {
 			if(b[i] >= a[i]) {
 				int need = (mid + b[i] - 1) / b[i];
 				rest += m - need;
 				continue;
 			}
 			int c = min(m,(mid + a[i] - 1) / a[i]);
 			int k = mid - a[i] * c;
 			if(k >= 1) {
 				rest -= (k + b[i] - 1) / b[i];
 			}else {
 				rest += m - c;
 			}
 		}
		if(rest >= 0) {
			ans = mid;
			l = mid + 1;
		}else {
			r = mid - 1;
		}
 	}
 	cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 89 ms 13140 KB Output is correct
12 Correct 127 ms 13140 KB Output is correct
13 Correct 80 ms 11088 KB Output is correct
14 Correct 84 ms 11188 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 24 ms 8524 KB Output is correct
17 Correct 75 ms 13892 KB Output is correct
18 Correct 64 ms 13136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 24 ms 8524 KB Output is correct
3 Correct 75 ms 13892 KB Output is correct
4 Correct 64 ms 13136 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 1 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 1 ms 348 KB Output is correct
13 Correct 32 ms 6784 KB Output is correct
14 Correct 24 ms 4604 KB Output is correct
15 Correct 17 ms 3676 KB Output is correct
16 Correct 13 ms 3044 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 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 1 ms 348 KB Output is correct
23 Correct 2 ms 604 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 1 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 89 ms 13140 KB Output is correct
12 Correct 127 ms 13140 KB Output is correct
13 Correct 80 ms 11088 KB Output is correct
14 Correct 84 ms 11188 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 456 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 448 KB Output is correct
19 Correct 1 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 1 ms 348 KB Output is correct
23 Correct 32 ms 6784 KB Output is correct
24 Correct 24 ms 4604 KB Output is correct
25 Correct 17 ms 3676 KB Output is correct
26 Correct 13 ms 3044 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 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 1 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 24 ms 8524 KB Output is correct
36 Correct 75 ms 13892 KB Output is correct
37 Correct 64 ms 13136 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 604 KB Output is correct
40 Correct 0 ms 456 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 4 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 20 ms 2648 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 452 KB Output is correct
55 Correct 49 ms 6824 KB Output is correct
56 Correct 28 ms 3932 KB Output is correct
57 Correct 19 ms 4104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 448 KB Output is correct
5 Correct 1 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 1 ms 348 KB Output is correct
9 Correct 32 ms 6784 KB Output is correct
10 Correct 24 ms 4604 KB Output is correct
11 Correct 17 ms 3676 KB Output is correct
12 Correct 13 ms 3044 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 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 604 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 24 ms 8524 KB Output is correct
22 Correct 75 ms 13892 KB Output is correct
23 Correct 64 ms 13136 KB Output is correct
24 Correct 18 ms 2436 KB Output is correct
25 Correct 38 ms 5972 KB Output is correct
26 Correct 8 ms 1628 KB Output is correct
27 Correct 65 ms 13120 KB Output is correct
28 Correct 67 ms 13144 KB Output is correct
29 Correct 65 ms 13308 KB Output is correct
30 Correct 111 ms 13136 KB Output is correct
31 Correct 86 ms 13140 KB Output is correct
32 Correct 44 ms 8540 KB Output is correct
33 Correct 88 ms 13752 KB Output is correct
34 Incorrect 76 ms 8672 KB Output isn't correct
35 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 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 1 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 89 ms 13140 KB Output is correct
12 Correct 127 ms 13140 KB Output is correct
13 Correct 80 ms 11088 KB Output is correct
14 Correct 84 ms 11188 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 456 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 448 KB Output is correct
19 Correct 1 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 1 ms 348 KB Output is correct
23 Correct 32 ms 6784 KB Output is correct
24 Correct 24 ms 4604 KB Output is correct
25 Correct 17 ms 3676 KB Output is correct
26 Correct 13 ms 3044 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 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 1 ms 348 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 604 KB Output is correct
36 Correct 0 ms 456 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 4 ms 604 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 20 ms 2648 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 452 KB Output is correct
51 Correct 49 ms 6824 KB Output is correct
52 Correct 28 ms 3932 KB Output is correct
53 Correct 19 ms 4104 KB Output is correct
54 Correct 18 ms 2436 KB Output is correct
55 Correct 38 ms 5972 KB Output is correct
56 Correct 8 ms 1628 KB Output is correct
57 Correct 65 ms 13120 KB Output is correct
58 Correct 67 ms 13144 KB Output is correct
59 Correct 65 ms 13308 KB Output is correct
60 Correct 111 ms 13136 KB Output is correct
61 Correct 86 ms 13140 KB Output is correct
62 Correct 44 ms 8540 KB Output is correct
63 Correct 88 ms 13752 KB Output is correct
64 Incorrect 76 ms 8672 KB Output isn't correct
65 Halted 0 ms 0 KB -