답안 #1030877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030877 2024-07-22T11:12:53 Z VMaksimoski008 Self Study (JOI22_ho_t2) C++17
100 / 100
252 ms 11348 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ll n, m;
    cin >> n >> m;

    vector<ll> a(n+1), b(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++) a[i] = max(a[i], b[i]);

    __int128_t l=1, r=1e18, ans=0;
    while(l <= r) {
        __int128_t mid = (l + r) / 2;
        ll total = 0;

        for(int i=1; i<=n; i++) {
            if(a[i] * m >= mid) total += (mid + a[i] - 1) / a[i];
            else total += (mid - a[i] * m + b[i] - 1) / b[i] + m;

            if(total > n * m) {
                total = n * m + 1;
                break;
            }
        }

        if(total <= n * m) ans = mid, l = mid + 1;
        else r = mid - 1;
    }

    cout << (ll)ans << '\n';
    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 424 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 195 ms 5116 KB Output is correct
12 Correct 207 ms 4956 KB Output is correct
13 Correct 133 ms 5116 KB Output is correct
14 Correct 124 ms 4952 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 52 ms 6228 KB Output is correct
17 Correct 197 ms 11348 KB Output is correct
18 Correct 185 ms 10836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 52 ms 6228 KB Output is correct
3 Correct 197 ms 11348 KB Output is correct
4 Correct 185 ms 10836 KB Output is correct
5 Correct 0 ms 600 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 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 360 KB Output is correct
12 Correct 0 ms 360 KB Output is correct
13 Correct 100 ms 2780 KB Output is correct
14 Correct 63 ms 2004 KB Output is correct
15 Correct 46 ms 1372 KB Output is correct
16 Correct 38 ms 1372 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 360 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 3 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 424 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 195 ms 5116 KB Output is correct
12 Correct 207 ms 4956 KB Output is correct
13 Correct 133 ms 5116 KB Output is correct
14 Correct 124 ms 4952 KB Output is correct
15 Correct 0 ms 600 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 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 360 KB Output is correct
23 Correct 100 ms 2780 KB Output is correct
24 Correct 63 ms 2004 KB Output is correct
25 Correct 46 ms 1372 KB Output is correct
26 Correct 38 ms 1372 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 360 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 3 ms 604 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 52 ms 6228 KB Output is correct
36 Correct 197 ms 11348 KB Output is correct
37 Correct 185 ms 10836 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 0 ms 600 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 356 KB Output is correct
43 Correct 0 ms 360 KB Output is correct
44 Correct 1 ms 360 KB Output is correct
45 Correct 5 ms 600 KB Output is correct
46 Correct 6 ms 604 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 35 ms 2136 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 4 ms 604 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 111 ms 5432 KB Output is correct
56 Correct 50 ms 3156 KB Output is correct
57 Correct 45 ms 3268 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 360 KB Output is correct
8 Correct 0 ms 360 KB Output is correct
9 Correct 100 ms 2780 KB Output is correct
10 Correct 63 ms 2004 KB Output is correct
11 Correct 46 ms 1372 KB Output is correct
12 Correct 38 ms 1372 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 360 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 3 ms 604 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 52 ms 6228 KB Output is correct
22 Correct 197 ms 11348 KB Output is correct
23 Correct 185 ms 10836 KB Output is correct
24 Correct 38 ms 1880 KB Output is correct
25 Correct 101 ms 4960 KB Output is correct
26 Correct 22 ms 1384 KB Output is correct
27 Correct 182 ms 10336 KB Output is correct
28 Correct 191 ms 10380 KB Output is correct
29 Correct 191 ms 10588 KB Output is correct
30 Correct 204 ms 10336 KB Output is correct
31 Correct 225 ms 10320 KB Output is correct
32 Correct 91 ms 6292 KB Output is correct
33 Correct 252 ms 11256 KB Output is correct
34 Correct 89 ms 6136 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 424 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 195 ms 5116 KB Output is correct
12 Correct 207 ms 4956 KB Output is correct
13 Correct 133 ms 5116 KB Output is correct
14 Correct 124 ms 4952 KB Output is correct
15 Correct 0 ms 600 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 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 360 KB Output is correct
22 Correct 0 ms 360 KB Output is correct
23 Correct 100 ms 2780 KB Output is correct
24 Correct 63 ms 2004 KB Output is correct
25 Correct 46 ms 1372 KB Output is correct
26 Correct 38 ms 1372 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 360 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 3 ms 604 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 0 ms 600 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 356 KB Output is correct
39 Correct 0 ms 360 KB Output is correct
40 Correct 1 ms 360 KB Output is correct
41 Correct 5 ms 600 KB Output is correct
42 Correct 6 ms 604 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 35 ms 2136 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 4 ms 604 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 111 ms 5432 KB Output is correct
52 Correct 50 ms 3156 KB Output is correct
53 Correct 45 ms 3268 KB Output is correct
54 Correct 38 ms 1880 KB Output is correct
55 Correct 101 ms 4960 KB Output is correct
56 Correct 22 ms 1384 KB Output is correct
57 Correct 182 ms 10336 KB Output is correct
58 Correct 191 ms 10380 KB Output is correct
59 Correct 191 ms 10588 KB Output is correct
60 Correct 204 ms 10336 KB Output is correct
61 Correct 225 ms 10320 KB Output is correct
62 Correct 91 ms 6292 KB Output is correct
63 Correct 252 ms 11256 KB Output is correct
64 Correct 89 ms 6136 KB Output is correct
65 Correct 0 ms 344 KB Output is correct
66 Correct 52 ms 6228 KB Output is correct
67 Correct 197 ms 11348 KB Output is correct
68 Correct 185 ms 10836 KB Output is correct
69 Correct 26 ms 1372 KB Output is correct
70 Correct 9 ms 604 KB Output is correct
71 Correct 0 ms 436 KB Output is correct
72 Correct 35 ms 1884 KB Output is correct
73 Correct 8 ms 600 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 203 ms 10868 KB Output is correct
76 Correct 202 ms 10832 KB Output is correct
77 Correct 214 ms 10744 KB Output is correct
78 Correct 230 ms 10836 KB Output is correct
79 Correct 232 ms 10860 KB Output is correct
80 Correct 237 ms 10832 KB Output is correct
81 Correct 182 ms 8784 KB Output is correct
82 Correct 185 ms 8788 KB Output is correct