Submission #864582

# Submission time Handle Problem Language Result Execution time Memory
864582 2023-10-23T09:21:29 Z NotLinux Self Study (JOI22_ho_t2) C++17
100 / 100
202 ms 11572 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
	int n,m;cin >> n >> m;
	int a[n],b[n];
	for(int i = 0;i<n;i++)cin >> a[i];
	for(int i = 0;i<n;i++){
		cin >> b[i];
		a[i] = max(a[i] , b[i]);
	}
	int l = 0 , r = 1ll << 60;
	while(l < r){
		int mid = (l+r)/2;
		int day = 0 , fail = 0;
		for(int i = 0;i<n;i++){
			if(mid <= a[i] * m){
				day += (mid + a[i] - 1) / a[i];
			}
			else {
				day += m + (mid - a[i] * m + b[i] - 1) / b[i];
			}
			if(day > n * m){fail = 1;}
		}
		if(fail)r = mid;
		else l = mid+1;
	}
	cout << l-1 << endl;
}
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int testcase = 1;//cin >> testcase;
	while(testcase--)solve();
}
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 145 ms 10996 KB Output is correct
12 Correct 145 ms 10836 KB Output is correct
13 Correct 133 ms 8844 KB Output is correct
14 Correct 179 ms 8784 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 178 ms 6232 KB Output is correct
17 Correct 145 ms 11572 KB Output is correct
18 Correct 148 ms 10920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 178 ms 6232 KB Output is correct
3 Correct 145 ms 11572 KB Output is correct
4 Correct 148 ms 10920 KB Output is correct
5 Correct 0 ms 344 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 74 ms 5460 KB Output is correct
14 Correct 48 ms 3932 KB Output is correct
15 Correct 36 ms 2896 KB Output is correct
16 Correct 29 ms 2396 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 460 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 3 ms 344 KB Output is correct
23 Correct 3 ms 628 KB Output is correct
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 145 ms 10996 KB Output is correct
12 Correct 145 ms 10836 KB Output is correct
13 Correct 133 ms 8844 KB Output is correct
14 Correct 179 ms 8784 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 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 74 ms 5460 KB Output is correct
24 Correct 48 ms 3932 KB Output is correct
25 Correct 36 ms 2896 KB Output is correct
26 Correct 29 ms 2396 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 460 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 3 ms 344 KB Output is correct
33 Correct 3 ms 628 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 178 ms 6232 KB Output is correct
36 Correct 145 ms 11572 KB Output is correct
37 Correct 148 ms 10920 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 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 348 KB Output is correct
45 Correct 3 ms 604 KB Output is correct
46 Correct 5 ms 764 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 25 ms 2136 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 3 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 456 KB Output is correct
55 Correct 72 ms 5568 KB Output is correct
56 Correct 45 ms 3164 KB Output is correct
57 Correct 64 ms 3264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 74 ms 5460 KB Output is correct
10 Correct 48 ms 3932 KB Output is correct
11 Correct 36 ms 2896 KB Output is correct
12 Correct 29 ms 2396 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 460 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 3 ms 344 KB Output is correct
19 Correct 3 ms 628 KB Output is correct
20 Correct 1 ms 600 KB Output is correct
21 Correct 178 ms 6232 KB Output is correct
22 Correct 145 ms 11572 KB Output is correct
23 Correct 148 ms 10920 KB Output is correct
24 Correct 29 ms 1880 KB Output is correct
25 Correct 77 ms 4956 KB Output is correct
26 Correct 16 ms 1552 KB Output is correct
27 Correct 146 ms 10920 KB Output is correct
28 Correct 144 ms 10916 KB Output is correct
29 Correct 151 ms 11016 KB Output is correct
30 Correct 156 ms 10836 KB Output is correct
31 Correct 194 ms 10836 KB Output is correct
32 Correct 188 ms 6484 KB Output is correct
33 Correct 166 ms 11344 KB Output is correct
34 Correct 185 ms 6224 KB Output is correct
# Verdict Execution time Memory 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 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 145 ms 10996 KB Output is correct
12 Correct 145 ms 10836 KB Output is correct
13 Correct 133 ms 8844 KB Output is correct
14 Correct 179 ms 8784 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 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 74 ms 5460 KB Output is correct
24 Correct 48 ms 3932 KB Output is correct
25 Correct 36 ms 2896 KB Output is correct
26 Correct 29 ms 2396 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 460 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 3 ms 344 KB Output is correct
33 Correct 3 ms 628 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 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 348 KB Output is correct
41 Correct 3 ms 604 KB Output is correct
42 Correct 5 ms 764 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 25 ms 2136 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 3 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 456 KB Output is correct
51 Correct 72 ms 5568 KB Output is correct
52 Correct 45 ms 3164 KB Output is correct
53 Correct 64 ms 3264 KB Output is correct
54 Correct 29 ms 1880 KB Output is correct
55 Correct 77 ms 4956 KB Output is correct
56 Correct 16 ms 1552 KB Output is correct
57 Correct 146 ms 10920 KB Output is correct
58 Correct 144 ms 10916 KB Output is correct
59 Correct 151 ms 11016 KB Output is correct
60 Correct 156 ms 10836 KB Output is correct
61 Correct 194 ms 10836 KB Output is correct
62 Correct 188 ms 6484 KB Output is correct
63 Correct 166 ms 11344 KB Output is correct
64 Correct 185 ms 6224 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 178 ms 6232 KB Output is correct
67 Correct 145 ms 11572 KB Output is correct
68 Correct 148 ms 10920 KB Output is correct
69 Correct 20 ms 1492 KB Output is correct
70 Correct 5 ms 688 KB Output is correct
71 Correct 1 ms 460 KB Output is correct
72 Correct 29 ms 1884 KB Output is correct
73 Correct 6 ms 604 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 145 ms 10924 KB Output is correct
76 Correct 151 ms 11088 KB Output is correct
77 Correct 158 ms 10920 KB Output is correct
78 Correct 169 ms 10832 KB Output is correct
79 Correct 197 ms 10836 KB Output is correct
80 Correct 202 ms 11092 KB Output is correct
81 Correct 154 ms 8944 KB Output is correct
82 Correct 182 ms 8836 KB Output is correct