답안 #978751

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
978751 2024-05-09T15:15:13 Z DobromirAngelov Self Study (JOI22_ho_t2) C++14
100 / 100
206 ms 11540 KB
#include <iostream>
#include <vector>
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;
}
# 결과 실행 시간 메모리 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 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 84 ms 5140 KB Output is correct
12 Correct 86 ms 5140 KB Output is correct
13 Correct 67 ms 5140 KB Output is correct
14 Correct 57 ms 5144 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 28 ms 4952 KB Output is correct
17 Correct 80 ms 4956 KB Output is correct
18 Correct 83 ms 5144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 28 ms 4952 KB Output is correct
3 Correct 80 ms 4956 KB Output is correct
4 Correct 83 ms 5144 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 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 43 ms 2652 KB Output is correct
14 Correct 27 ms 1880 KB Output is correct
15 Correct 23 ms 1644 KB Output is correct
16 Correct 18 ms 1412 KB Output is correct
17 Correct 1 ms 500 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 500 KB Output is correct
20 Correct 0 ms 344 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 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 84 ms 5140 KB Output is correct
12 Correct 86 ms 5140 KB Output is correct
13 Correct 67 ms 5140 KB Output is correct
14 Correct 57 ms 5144 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 43 ms 2652 KB Output is correct
24 Correct 27 ms 1880 KB Output is correct
25 Correct 23 ms 1644 KB Output is correct
26 Correct 18 ms 1412 KB Output is correct
27 Correct 1 ms 500 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 500 KB Output is correct
30 Correct 0 ms 344 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 348 KB Output is correct
35 Correct 28 ms 4952 KB Output is correct
36 Correct 80 ms 4956 KB Output is correct
37 Correct 83 ms 5144 KB Output is correct
38 Correct 1 ms 344 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 356 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 456 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 4 ms 844 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 15 ms 2300 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 464 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 43 ms 5604 KB Output is correct
56 Correct 26 ms 3164 KB Output is correct
57 Correct 20 ms 3164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 43 ms 2652 KB Output is correct
10 Correct 27 ms 1880 KB Output is correct
11 Correct 23 ms 1644 KB Output is correct
12 Correct 18 ms 1412 KB Output is correct
13 Correct 1 ms 500 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 500 KB Output is correct
16 Correct 0 ms 344 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 348 KB Output is correct
21 Correct 28 ms 4952 KB Output is correct
22 Correct 80 ms 4956 KB Output is correct
23 Correct 83 ms 5144 KB Output is correct
24 Correct 27 ms 1884 KB Output is correct
25 Correct 63 ms 5152 KB Output is correct
26 Correct 12 ms 1372 KB Output is correct
27 Correct 84 ms 10904 KB Output is correct
28 Correct 91 ms 10952 KB Output is correct
29 Correct 94 ms 10952 KB Output is correct
30 Correct 111 ms 10948 KB Output is correct
31 Correct 189 ms 10952 KB Output is correct
32 Correct 92 ms 6168 KB Output is correct
33 Correct 173 ms 11540 KB Output is correct
34 Correct 93 ms 6304 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 1 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 0 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 84 ms 5140 KB Output is correct
12 Correct 86 ms 5140 KB Output is correct
13 Correct 67 ms 5140 KB Output is correct
14 Correct 57 ms 5144 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 43 ms 2652 KB Output is correct
24 Correct 27 ms 1880 KB Output is correct
25 Correct 23 ms 1644 KB Output is correct
26 Correct 18 ms 1412 KB Output is correct
27 Correct 1 ms 500 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 500 KB Output is correct
30 Correct 0 ms 344 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 344 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 356 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 456 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 4 ms 844 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 15 ms 2300 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 464 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 43 ms 5604 KB Output is correct
52 Correct 26 ms 3164 KB Output is correct
53 Correct 20 ms 3164 KB Output is correct
54 Correct 27 ms 1884 KB Output is correct
55 Correct 63 ms 5152 KB Output is correct
56 Correct 12 ms 1372 KB Output is correct
57 Correct 84 ms 10904 KB Output is correct
58 Correct 91 ms 10952 KB Output is correct
59 Correct 94 ms 10952 KB Output is correct
60 Correct 111 ms 10948 KB Output is correct
61 Correct 189 ms 10952 KB Output is correct
62 Correct 92 ms 6168 KB Output is correct
63 Correct 173 ms 11540 KB Output is correct
64 Correct 93 ms 6304 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 28 ms 4952 KB Output is correct
67 Correct 80 ms 4956 KB Output is correct
68 Correct 83 ms 5144 KB Output is correct
69 Correct 20 ms 1600 KB Output is correct
70 Correct 5 ms 740 KB Output is correct
71 Correct 1 ms 604 KB Output is correct
72 Correct 28 ms 1956 KB Output is correct
73 Correct 6 ms 984 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 97 ms 10952 KB Output is correct
76 Correct 103 ms 10952 KB Output is correct
77 Correct 115 ms 10888 KB Output is correct
78 Correct 146 ms 10948 KB Output is correct
79 Correct 195 ms 11092 KB Output is correct
80 Correct 206 ms 10952 KB Output is correct
81 Correct 162 ms 8712 KB Output is correct
82 Correct 146 ms 8960 KB Output is correct