답안 #863804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
863804 2023-10-21T06:45:43 Z prairie2022 Self Study (JOI22_ho_t2) C++17
100 / 100
218 ms 11540 KB
#include<bits/stdc++.h>
typedef long long ll;
#define fastio cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
using namespace std;

inline ll divide(ll a, ll d){
    return (a-1)/d+1;
}

int main(){
    fastio
    int n;
    ll m, l = 1, r = 1e18;
    cin >> n >> m;
    ll lesson = m*n;
    vector<ll> 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]);
    }
    while(l!=r){
        ll g = (l+r+1)>>1, cnt = 0;
        for(int i=0; i<n; i++){
            ll tmp = divide(g, a[i]);
            if(tmp>m) cnt += m+divide(g-a[i]*m, b[i]);
            else cnt += tmp;
            if(cnt>lesson) break;
        }
        if(cnt>lesson) r = g-1;
        else l = g;
    }
    cout << r << '\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 1 ms 344 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 1 ms 348 KB Output is correct
11 Correct 82 ms 5140 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 77 ms 5140 KB Output is correct
14 Correct 58 ms 4952 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 27 ms 6324 KB Output is correct
17 Correct 91 ms 11540 KB Output is correct
18 Correct 83 ms 10752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 27 ms 6324 KB Output is correct
3 Correct 91 ms 11540 KB Output is correct
4 Correct 83 ms 10752 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 1 ms 348 KB Output is correct
9 Correct 1 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 43 ms 2792 KB Output is correct
14 Correct 29 ms 1884 KB Output is correct
15 Correct 21 ms 1628 KB Output is correct
16 Correct 19 ms 1372 KB Output is correct
17 Correct 1 ms 344 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 1 ms 348 KB Output is correct
23 Correct 2 ms 632 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 1 ms 344 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 1 ms 348 KB Output is correct
11 Correct 82 ms 5140 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 77 ms 5140 KB Output is correct
14 Correct 58 ms 4952 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 1 ms 348 KB Output is correct
19 Correct 1 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 43 ms 2792 KB Output is correct
24 Correct 29 ms 1884 KB Output is correct
25 Correct 21 ms 1628 KB Output is correct
26 Correct 19 ms 1372 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 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 2 ms 632 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 27 ms 6324 KB Output is correct
36 Correct 91 ms 11540 KB Output is correct
37 Correct 83 ms 10752 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 0 ms 348 KB Output is correct
42 Correct 0 ms 456 KB Output is correct
43 Correct 0 ms 348 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 860 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 16 ms 2140 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 2 ms 620 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 46 ms 5480 KB Output is correct
56 Correct 32 ms 3164 KB Output is correct
57 Correct 21 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 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 1 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 43 ms 2792 KB Output is correct
10 Correct 29 ms 1884 KB Output is correct
11 Correct 21 ms 1628 KB Output is correct
12 Correct 19 ms 1372 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 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 2 ms 632 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 27 ms 6324 KB Output is correct
22 Correct 91 ms 11540 KB Output is correct
23 Correct 83 ms 10752 KB Output is correct
24 Correct 28 ms 1884 KB Output is correct
25 Correct 70 ms 4948 KB Output is correct
26 Correct 13 ms 1372 KB Output is correct
27 Correct 81 ms 10776 KB Output is correct
28 Correct 91 ms 10952 KB Output is correct
29 Correct 96 ms 10832 KB Output is correct
30 Correct 119 ms 10836 KB Output is correct
31 Correct 188 ms 10836 KB Output is correct
32 Correct 138 ms 6224 KB Output is correct
33 Correct 218 ms 11540 KB Output is correct
34 Correct 150 ms 6312 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 1 ms 344 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 1 ms 348 KB Output is correct
11 Correct 82 ms 5140 KB Output is correct
12 Correct 82 ms 4956 KB Output is correct
13 Correct 77 ms 5140 KB Output is correct
14 Correct 58 ms 4952 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 1 ms 348 KB Output is correct
19 Correct 1 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 43 ms 2792 KB Output is correct
24 Correct 29 ms 1884 KB Output is correct
25 Correct 21 ms 1628 KB Output is correct
26 Correct 19 ms 1372 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 348 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 2 ms 632 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 0 ms 348 KB Output is correct
38 Correct 0 ms 456 KB Output is correct
39 Correct 0 ms 348 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 860 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 16 ms 2140 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 2 ms 620 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 46 ms 5480 KB Output is correct
52 Correct 32 ms 3164 KB Output is correct
53 Correct 21 ms 3160 KB Output is correct
54 Correct 28 ms 1884 KB Output is correct
55 Correct 70 ms 4948 KB Output is correct
56 Correct 13 ms 1372 KB Output is correct
57 Correct 81 ms 10776 KB Output is correct
58 Correct 91 ms 10952 KB Output is correct
59 Correct 96 ms 10832 KB Output is correct
60 Correct 119 ms 10836 KB Output is correct
61 Correct 188 ms 10836 KB Output is correct
62 Correct 138 ms 6224 KB Output is correct
63 Correct 218 ms 11540 KB Output is correct
64 Correct 150 ms 6312 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 27 ms 6324 KB Output is correct
67 Correct 91 ms 11540 KB Output is correct
68 Correct 83 ms 10752 KB Output is correct
69 Correct 21 ms 1368 KB Output is correct
70 Correct 6 ms 604 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 30 ms 1772 KB Output is correct
73 Correct 7 ms 604 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 95 ms 10884 KB Output is correct
76 Correct 111 ms 10880 KB Output is correct
77 Correct 121 ms 11088 KB Output is correct
78 Correct 156 ms 10836 KB Output is correct
79 Correct 210 ms 10836 KB Output is correct
80 Correct 215 ms 10940 KB Output is correct
81 Correct 195 ms 8784 KB Output is correct
82 Correct 195 ms 8952 KB Output is correct