Submission #966973

# Submission time Handle Problem Language Result Execution time Memory
966973 2024-04-20T18:27:50 Z Tzepu100 Self Study (JOI22_ho_t2) C++14
100 / 100
198 ms 11616 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N), B(N);
    for(ll& a : A) {
        cin >> a;
    }
    for(ll& b : B){
        cin >> b;
    }
    for(ll i = 0; i < N; i++){
        A[i] = max(A[i], B[i]);
    }

    ll ok = 0, ng = 1LL << 60;
    auto check = [&](ll x) -> bool {
        ll day = 0;
        for(ll i = 0; i < N; i++){
            if(x <= A[i] * M) day += (x + A[i] - 1) / A[i];
            else day += M + (x - A[i] * M + B[i] - 1) / B[i];
            if(day > N * M) return 0;
        }
        return 1;
    };
    while(ng - ok > 1){
        const ll mid = (ng + ok) / 2;
        if(check(mid)) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 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 604 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 82 ms 10836 KB Output is correct
12 Correct 83 ms 10948 KB Output is correct
13 Correct 70 ms 8788 KB Output is correct
14 Correct 58 ms 8788 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 28 ms 6324 KB Output is correct
17 Correct 79 ms 11616 KB Output is correct
18 Correct 81 ms 10952 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 28 ms 6324 KB Output is correct
3 Correct 79 ms 11616 KB Output is correct
4 Correct 81 ms 10952 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 344 KB Output is correct
9 Correct 1 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 42 ms 5484 KB Output is correct
14 Correct 38 ms 3796 KB Output is correct
15 Correct 23 ms 2908 KB Output is correct
16 Correct 24 ms 2552 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 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 604 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 82 ms 10836 KB Output is correct
12 Correct 83 ms 10948 KB Output is correct
13 Correct 70 ms 8788 KB Output is correct
14 Correct 58 ms 8788 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 344 KB Output is correct
19 Correct 1 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 42 ms 5484 KB Output is correct
24 Correct 38 ms 3796 KB Output is correct
25 Correct 23 ms 2908 KB Output is correct
26 Correct 24 ms 2552 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 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 28 ms 6324 KB Output is correct
36 Correct 79 ms 11616 KB Output is correct
37 Correct 81 ms 10952 KB Output is correct
38 Correct 1 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 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 460 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 3 ms 856 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 15 ms 2032 KB Output is correct
49 Correct 1 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 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 43 ms 5652 KB Output is correct
56 Correct 25 ms 3164 KB Output is correct
57 Correct 22 ms 3160 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 344 KB Output is correct
5 Correct 1 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 42 ms 5484 KB Output is correct
10 Correct 38 ms 3796 KB Output is correct
11 Correct 23 ms 2908 KB Output is correct
12 Correct 24 ms 2552 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 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 28 ms 6324 KB Output is correct
22 Correct 79 ms 11616 KB Output is correct
23 Correct 81 ms 10952 KB Output is correct
24 Correct 26 ms 1880 KB Output is correct
25 Correct 62 ms 5208 KB Output is correct
26 Correct 11 ms 1372 KB Output is correct
27 Correct 80 ms 10952 KB Output is correct
28 Correct 86 ms 10832 KB Output is correct
29 Correct 98 ms 10900 KB Output is correct
30 Correct 116 ms 10836 KB Output is correct
31 Correct 184 ms 10832 KB Output is correct
32 Correct 91 ms 6224 KB Output is correct
33 Correct 167 ms 11604 KB Output is correct
34 Correct 94 ms 6100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 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 604 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 82 ms 10836 KB Output is correct
12 Correct 83 ms 10948 KB Output is correct
13 Correct 70 ms 8788 KB Output is correct
14 Correct 58 ms 8788 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 344 KB Output is correct
19 Correct 1 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 42 ms 5484 KB Output is correct
24 Correct 38 ms 3796 KB Output is correct
25 Correct 23 ms 2908 KB Output is correct
26 Correct 24 ms 2552 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 1 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 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 460 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 3 ms 856 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 15 ms 2032 KB Output is correct
45 Correct 1 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 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 43 ms 5652 KB Output is correct
52 Correct 25 ms 3164 KB Output is correct
53 Correct 22 ms 3160 KB Output is correct
54 Correct 26 ms 1880 KB Output is correct
55 Correct 62 ms 5208 KB Output is correct
56 Correct 11 ms 1372 KB Output is correct
57 Correct 80 ms 10952 KB Output is correct
58 Correct 86 ms 10832 KB Output is correct
59 Correct 98 ms 10900 KB Output is correct
60 Correct 116 ms 10836 KB Output is correct
61 Correct 184 ms 10832 KB Output is correct
62 Correct 91 ms 6224 KB Output is correct
63 Correct 167 ms 11604 KB Output is correct
64 Correct 94 ms 6100 KB Output is correct
65 Correct 0 ms 344 KB Output is correct
66 Correct 28 ms 6324 KB Output is correct
67 Correct 79 ms 11616 KB Output is correct
68 Correct 81 ms 10952 KB Output is correct
69 Correct 18 ms 1360 KB Output is correct
70 Correct 6 ms 604 KB Output is correct
71 Correct 0 ms 344 KB Output is correct
72 Correct 28 ms 1924 KB Output is correct
73 Correct 6 ms 600 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 88 ms 10900 KB Output is correct
76 Correct 108 ms 10832 KB Output is correct
77 Correct 107 ms 10772 KB Output is correct
78 Correct 140 ms 10772 KB Output is correct
79 Correct 188 ms 10904 KB Output is correct
80 Correct 198 ms 11092 KB Output is correct
81 Correct 154 ms 8724 KB Output is correct
82 Correct 145 ms 8960 KB Output is correct