답안 #995704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995704 2024-06-09T18:33:54 Z mnieplowicz Self Study (JOI22_ho_t2) C++14
100 / 100
90 ms 10512 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	long long n, m;
	cin >> n >> m;
	vector<long long> a(n);
	for(auto &x : a) cin >> x;
	vector<long long> b(n);
	for(auto &x : b) cin >> x;
	for(int i = 0; i < n; i++) a[i] = max(a[i], b[i]);
	
	auto check = [&](long long val){
		unsigned long long cnt = 0;
		for(int i = 0; i < n; i++){
			if(a[i]*m >= val) cnt += ((val - 1)/a[i] + 1);
			else cnt += (m + (val - m*a[i] -1)/b[i] + 1);
		}
		if(cnt <= m*n) return true;
		else return false;
	};
	
	long long l = 0, r = 2e18;
	while(l+1 != r){
		long long mid = (l+r)/2;
		if(check(mid)) l = mid;
		else r = mid;
	}
	cout << l << '\n';
	return 0;
}

Compilation message

Main.cpp: In lambda function:
Main.cpp:22:10: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
   22 |   if(cnt <= m*n) return true;
      |      ~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 83 ms 5112 KB Output is correct
12 Correct 82 ms 4944 KB Output is correct
13 Correct 81 ms 4956 KB Output is correct
14 Correct 76 ms 4944 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 67 ms 6172 KB Output is correct
17 Correct 85 ms 10324 KB Output is correct
18 Correct 84 ms 9556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 67 ms 6172 KB Output is correct
3 Correct 85 ms 10324 KB Output is correct
4 Correct 84 ms 9556 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 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 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 42 ms 2796 KB Output is correct
14 Correct 27 ms 1884 KB Output is correct
15 Correct 20 ms 1628 KB Output is correct
16 Correct 16 ms 1372 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 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 83 ms 5112 KB Output is correct
12 Correct 82 ms 4944 KB Output is correct
13 Correct 81 ms 4956 KB Output is correct
14 Correct 76 ms 4944 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 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 42 ms 2796 KB Output is correct
24 Correct 27 ms 1884 KB Output is correct
25 Correct 20 ms 1628 KB Output is correct
26 Correct 16 ms 1372 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 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 67 ms 6172 KB Output is correct
36 Correct 85 ms 10324 KB Output is correct
37 Correct 84 ms 9556 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 0 ms 348 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 0 ms 452 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 3 ms 772 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 15 ms 2264 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 44 ms 5200 KB Output is correct
56 Correct 26 ms 3164 KB Output is correct
57 Correct 28 ms 3312 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 1 ms 344 KB Output is correct
4 Correct 1 ms 348 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 42 ms 2796 KB Output is correct
10 Correct 27 ms 1884 KB Output is correct
11 Correct 20 ms 1628 KB Output is correct
12 Correct 16 ms 1372 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 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 67 ms 6172 KB Output is correct
22 Correct 85 ms 10324 KB Output is correct
23 Correct 84 ms 9556 KB Output is correct
24 Correct 14 ms 1880 KB Output is correct
25 Correct 38 ms 4696 KB Output is correct
26 Correct 9 ms 1368 KB Output is correct
27 Correct 87 ms 9616 KB Output is correct
28 Correct 85 ms 9552 KB Output is correct
29 Correct 84 ms 9556 KB Output is correct
30 Correct 88 ms 9604 KB Output is correct
31 Correct 90 ms 9556 KB Output is correct
32 Correct 64 ms 6232 KB Output is correct
33 Correct 86 ms 10512 KB Output is correct
34 Correct 65 ms 6308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 83 ms 5112 KB Output is correct
12 Correct 82 ms 4944 KB Output is correct
13 Correct 81 ms 4956 KB Output is correct
14 Correct 76 ms 4944 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 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 42 ms 2796 KB Output is correct
24 Correct 27 ms 1884 KB Output is correct
25 Correct 20 ms 1628 KB Output is correct
26 Correct 16 ms 1372 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 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 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 0 ms 452 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 3 ms 772 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 15 ms 2264 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 44 ms 5200 KB Output is correct
52 Correct 26 ms 3164 KB Output is correct
53 Correct 28 ms 3312 KB Output is correct
54 Correct 14 ms 1880 KB Output is correct
55 Correct 38 ms 4696 KB Output is correct
56 Correct 9 ms 1368 KB Output is correct
57 Correct 87 ms 9616 KB Output is correct
58 Correct 85 ms 9552 KB Output is correct
59 Correct 84 ms 9556 KB Output is correct
60 Correct 88 ms 9604 KB Output is correct
61 Correct 90 ms 9556 KB Output is correct
62 Correct 64 ms 6232 KB Output is correct
63 Correct 86 ms 10512 KB Output is correct
64 Correct 65 ms 6308 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 67 ms 6172 KB Output is correct
67 Correct 85 ms 10324 KB Output is correct
68 Correct 84 ms 9556 KB Output is correct
69 Correct 10 ms 1372 KB Output is correct
70 Correct 3 ms 604 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 13 ms 1820 KB Output is correct
73 Correct 3 ms 600 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 86 ms 9556 KB Output is correct
76 Correct 83 ms 9552 KB Output is correct
77 Correct 84 ms 9556 KB Output is correct
78 Correct 86 ms 9548 KB Output is correct
79 Correct 85 ms 9620 KB Output is correct
80 Correct 82 ms 9744 KB Output is correct
81 Correct 73 ms 8004 KB Output is correct
82 Correct 79 ms 8020 KB Output is correct