답안 #676569

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
676569 2022-12-31T09:55:45 Z rittin1 Self Study (JOI22_ho_t2) C++17
100 / 100
219 ms 11440 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=3e5 + 5;
int a[N];
int b[N];
bool check(int mid,int n,int m){
    int days=0;
    for(int i=1;i<=n;i++){
        if(mid<=(a[i]*m)){
            if(mid%a[i]==0){
                days+=(mid)/a[i];
            }
            else{
                days+=1+((mid)/a[i]);
            }
        }
        else{
            days+=m;
            if((mid-a[i]*m)%b[i]==0){
                days+=(mid-a[i]*m)/b[i];
            }
            else{
                days+=1+((mid-a[i]*m)/b[i]);
            }
        }
        if(days>(n*m)){
            return 0;
        }
    }
    return 1;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    for(int i=1;i<=n;i++){
        cin >> b[i];
        a[i]=max(a[i],b[i]);
    }
    
    int hi=(1LL<<60);
    int lo=0;
    int mid;
    while(hi-lo>1){
        mid=(hi+lo)/2;
        if(check(mid,n,m)){
            lo=mid;
        }
        else{
            hi=mid;
        }
    }
    cout << lo;
    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 472 KB Output is correct
11 Correct 97 ms 10828 KB Output is correct
12 Correct 98 ms 10692 KB Output is correct
13 Correct 84 ms 8820 KB Output is correct
14 Correct 71 ms 8764 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 31 ms 6092 KB Output is correct
17 Correct 104 ms 11440 KB Output is correct
18 Correct 93 ms 10744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 31 ms 6092 KB Output is correct
3 Correct 104 ms 11440 KB Output is correct
4 Correct 93 ms 10744 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 49 ms 5572 KB Output is correct
14 Correct 32 ms 3804 KB Output is correct
15 Correct 23 ms 2892 KB Output is correct
16 Correct 20 ms 2380 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 472 KB Output is correct
11 Correct 97 ms 10828 KB Output is correct
12 Correct 98 ms 10692 KB Output is correct
13 Correct 84 ms 8820 KB Output is correct
14 Correct 71 ms 8764 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 49 ms 5572 KB Output is correct
24 Correct 32 ms 3804 KB Output is correct
25 Correct 23 ms 2892 KB Output is correct
26 Correct 20 ms 2380 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 31 ms 6092 KB Output is correct
36 Correct 104 ms 11440 KB Output is correct
37 Correct 93 ms 10744 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 328 KB Output is correct
40 Correct 0 ms 340 KB Output is correct
41 Correct 0 ms 340 KB Output is correct
42 Correct 1 ms 324 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 3 ms 468 KB Output is correct
46 Correct 4 ms 596 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 19 ms 2024 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 0 ms 332 KB Output is correct
53 Correct 0 ms 324 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 52 ms 5504 KB Output is correct
56 Correct 31 ms 3160 KB Output is correct
57 Correct 24 ms 3112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 49 ms 5572 KB Output is correct
10 Correct 32 ms 3804 KB Output is correct
11 Correct 23 ms 2892 KB Output is correct
12 Correct 20 ms 2380 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 3 ms 468 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 31 ms 6092 KB Output is correct
22 Correct 104 ms 11440 KB Output is correct
23 Correct 93 ms 10744 KB Output is correct
24 Correct 29 ms 1908 KB Output is correct
25 Correct 71 ms 4940 KB Output is correct
26 Correct 13 ms 1364 KB Output is correct
27 Correct 91 ms 10800 KB Output is correct
28 Correct 99 ms 10712 KB Output is correct
29 Correct 98 ms 10800 KB Output is correct
30 Correct 122 ms 10796 KB Output is correct
31 Correct 200 ms 10700 KB Output is correct
32 Correct 102 ms 6168 KB Output is correct
33 Correct 196 ms 11372 KB Output is correct
34 Correct 102 ms 6176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 ms 292 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 472 KB Output is correct
11 Correct 97 ms 10828 KB Output is correct
12 Correct 98 ms 10692 KB Output is correct
13 Correct 84 ms 8820 KB Output is correct
14 Correct 71 ms 8764 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 49 ms 5572 KB Output is correct
24 Correct 32 ms 3804 KB Output is correct
25 Correct 23 ms 2892 KB Output is correct
26 Correct 20 ms 2380 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 3 ms 468 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 328 KB Output is correct
36 Correct 0 ms 340 KB Output is correct
37 Correct 0 ms 340 KB Output is correct
38 Correct 1 ms 324 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 3 ms 468 KB Output is correct
42 Correct 4 ms 596 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 19 ms 2024 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 2 ms 468 KB Output is correct
48 Correct 0 ms 332 KB Output is correct
49 Correct 0 ms 324 KB Output is correct
50 Correct 1 ms 340 KB Output is correct
51 Correct 52 ms 5504 KB Output is correct
52 Correct 31 ms 3160 KB Output is correct
53 Correct 24 ms 3112 KB Output is correct
54 Correct 29 ms 1908 KB Output is correct
55 Correct 71 ms 4940 KB Output is correct
56 Correct 13 ms 1364 KB Output is correct
57 Correct 91 ms 10800 KB Output is correct
58 Correct 99 ms 10712 KB Output is correct
59 Correct 98 ms 10800 KB Output is correct
60 Correct 122 ms 10796 KB Output is correct
61 Correct 200 ms 10700 KB Output is correct
62 Correct 102 ms 6168 KB Output is correct
63 Correct 196 ms 11372 KB Output is correct
64 Correct 102 ms 6176 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 31 ms 6092 KB Output is correct
67 Correct 104 ms 11440 KB Output is correct
68 Correct 93 ms 10744 KB Output is correct
69 Correct 21 ms 1376 KB Output is correct
70 Correct 7 ms 576 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 33 ms 1792 KB Output is correct
73 Correct 7 ms 596 KB Output is correct
74 Correct 1 ms 340 KB Output is correct
75 Correct 98 ms 10792 KB Output is correct
76 Correct 111 ms 10796 KB Output is correct
77 Correct 120 ms 10732 KB Output is correct
78 Correct 154 ms 10876 KB Output is correct
79 Correct 205 ms 10700 KB Output is correct
80 Correct 219 ms 10672 KB Output is correct
81 Correct 177 ms 8804 KB Output is correct
82 Correct 165 ms 8812 KB Output is correct