답안 #526684

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526684 2022-02-16T01:24:45 Z couplefire Self Study (JOI22_ho_t2) C++17
100 / 100
250 ms 9640 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main(){
    // freopen("a.in", "r", stdin);
    cin.tie(0)->sync_with_stdio(0);
    int n, m; cin >> n >> m;
    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];
    for(int i = 0; i<n; ++i) a[i] = max(a[i], b[i]);
    ll lo = 0, hi = 1e18;
    while(lo<hi){
        ll mid = lo+(hi-lo+1)/2;
        ll cnt = 0;
        for(int i = 0; i<n; ++i){
            if(a[i]*m>=mid) cnt += m-(mid+a[i]-1)/a[i];
            else cnt -= (mid-a[i]*m+b[i]-1)/b[i];
            if(cnt<-1ll*n*m) break;
        }
        if(cnt>=0ll) lo = mid;
        else hi = mid-1; 
    }
    cout << lo << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 93 ms 5000 KB Output is correct
12 Correct 100 ms 4940 KB Output is correct
13 Correct 98 ms 5000 KB Output is correct
14 Correct 75 ms 4940 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 36 ms 5328 KB Output is correct
17 Correct 132 ms 5756 KB Output is correct
18 Correct 100 ms 6340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 36 ms 5328 KB Output is correct
3 Correct 132 ms 5756 KB Output is correct
4 Correct 100 ms 6340 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 49 ms 2656 KB Output is correct
14 Correct 32 ms 1868 KB Output is correct
15 Correct 25 ms 1484 KB Output is correct
16 Correct 21 ms 1228 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 3 ms 396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 93 ms 5000 KB Output is correct
12 Correct 100 ms 4940 KB Output is correct
13 Correct 98 ms 5000 KB Output is correct
14 Correct 75 ms 4940 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 49 ms 2656 KB Output is correct
24 Correct 32 ms 1868 KB Output is correct
25 Correct 25 ms 1484 KB Output is correct
26 Correct 21 ms 1228 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 396 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 36 ms 5328 KB Output is correct
36 Correct 132 ms 5756 KB Output is correct
37 Correct 100 ms 6340 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 1 ms 204 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 3 ms 448 KB Output is correct
46 Correct 4 ms 496 KB Output is correct
47 Correct 1 ms 204 KB Output is correct
48 Correct 19 ms 1696 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 0 ms 204 KB Output is correct
51 Correct 2 ms 432 KB Output is correct
52 Correct 0 ms 204 KB Output is correct
53 Correct 0 ms 204 KB Output is correct
54 Correct 1 ms 204 KB Output is correct
55 Correct 67 ms 4240 KB Output is correct
56 Correct 43 ms 2372 KB Output is correct
57 Correct 28 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 49 ms 2656 KB Output is correct
10 Correct 32 ms 1868 KB Output is correct
11 Correct 25 ms 1484 KB Output is correct
12 Correct 21 ms 1228 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 3 ms 396 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 36 ms 5328 KB Output is correct
22 Correct 132 ms 5756 KB Output is correct
23 Correct 100 ms 6340 KB Output is correct
24 Correct 31 ms 1320 KB Output is correct
25 Correct 78 ms 3320 KB Output is correct
26 Correct 15 ms 956 KB Output is correct
27 Correct 99 ms 6688 KB Output is correct
28 Correct 101 ms 6652 KB Output is correct
29 Correct 108 ms 6716 KB Output is correct
30 Correct 123 ms 6932 KB Output is correct
31 Correct 225 ms 7992 KB Output is correct
32 Correct 110 ms 5568 KB Output is correct
33 Correct 250 ms 6624 KB Output is correct
34 Correct 114 ms 5064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 93 ms 5000 KB Output is correct
12 Correct 100 ms 4940 KB Output is correct
13 Correct 98 ms 5000 KB Output is correct
14 Correct 75 ms 4940 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 49 ms 2656 KB Output is correct
24 Correct 32 ms 1868 KB Output is correct
25 Correct 25 ms 1484 KB Output is correct
26 Correct 21 ms 1228 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 396 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 3 ms 448 KB Output is correct
42 Correct 4 ms 496 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 19 ms 1696 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 2 ms 432 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 67 ms 4240 KB Output is correct
52 Correct 43 ms 2372 KB Output is correct
53 Correct 28 ms 2396 KB Output is correct
54 Correct 31 ms 1320 KB Output is correct
55 Correct 78 ms 3320 KB Output is correct
56 Correct 15 ms 956 KB Output is correct
57 Correct 99 ms 6688 KB Output is correct
58 Correct 101 ms 6652 KB Output is correct
59 Correct 108 ms 6716 KB Output is correct
60 Correct 123 ms 6932 KB Output is correct
61 Correct 225 ms 7992 KB Output is correct
62 Correct 110 ms 5568 KB Output is correct
63 Correct 250 ms 6624 KB Output is correct
64 Correct 114 ms 5064 KB Output is correct
65 Correct 0 ms 204 KB Output is correct
66 Correct 36 ms 5328 KB Output is correct
67 Correct 132 ms 5756 KB Output is correct
68 Correct 100 ms 6340 KB Output is correct
69 Correct 22 ms 884 KB Output is correct
70 Correct 7 ms 332 KB Output is correct
71 Correct 1 ms 204 KB Output is correct
72 Correct 33 ms 1152 KB Output is correct
73 Correct 8 ms 520 KB Output is correct
74 Correct 2 ms 332 KB Output is correct
75 Correct 107 ms 7052 KB Output is correct
76 Correct 114 ms 6684 KB Output is correct
77 Correct 133 ms 6256 KB Output is correct
78 Correct 154 ms 5168 KB Output is correct
79 Correct 214 ms 6672 KB Output is correct
80 Correct 231 ms 9640 KB Output is correct
81 Correct 226 ms 6520 KB Output is correct
82 Correct 225 ms 6852 KB Output is correct