답안 #937797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937797 2024-03-04T13:17:22 Z Andrey Self Study (JOI22_ho_t2) C++14
100 / 100
217 ms 18192 KB
#include <bits/stdc++.h>
using namespace std;

vector<long long> haha(0);
vector<long long> bruh(0);
long long n,m;

bool check(long long a) {
    long long br = 0;
    for(long long i = 0; i < n; i++) {
        if(haha[i] <= bruh[i]) {
            br+=(a-1)/bruh[i]+1;
        }
        else {
            if(a > haha[i]*m) {
                br+=m;
                br+=(a-1-haha[i]*m)/bruh[i]+1;
            }
            else {
                br+=(a-1)/haha[i]+1;
            }
        }
        if(br > n*m) {
            return false;
        }
    }
    if(br > n*m) {
        return false;
    }
    else {
        return true;
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n >> m;
    long long a;
    for(long long i = 0; i < n; i++) {
        cin >> a;
        haha.push_back(a);
    }
    for(long long i = 0; i < n; i++) {
        cin >> a;
        bruh.push_back(a);
    }
    long long l = 0,r = 1e18;
    while(l < r) {
        long long mid = (l+r+1)/2;
        if(check(mid)) {
            l = mid;
        }
        else {
            r = mid-1;
        }
    }
    cout << l;
    return 0;
}
# 결과 실행 시간 메모리 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 1 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 1 ms 600 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 91 ms 11428 KB Output is correct
12 Correct 92 ms 11572 KB Output is correct
13 Correct 68 ms 9148 KB Output is correct
14 Correct 64 ms 10688 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 32 ms 10448 KB Output is correct
17 Correct 83 ms 17960 KB Output is correct
18 Correct 85 ms 14788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 32 ms 10448 KB Output is correct
3 Correct 83 ms 17960 KB Output is correct
4 Correct 85 ms 14788 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 500 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 360 KB Output is correct
13 Correct 44 ms 4564 KB Output is correct
14 Correct 29 ms 2776 KB Output is correct
15 Correct 21 ms 2516 KB Output is correct
16 Correct 17 ms 1496 KB Output is correct
17 Correct 1 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 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 568 KB Output is correct
23 Correct 2 ms 472 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 1 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 1 ms 600 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 91 ms 11428 KB Output is correct
12 Correct 92 ms 11572 KB Output is correct
13 Correct 68 ms 9148 KB Output is correct
14 Correct 64 ms 10688 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 500 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 44 ms 4564 KB Output is correct
24 Correct 29 ms 2776 KB Output is correct
25 Correct 21 ms 2516 KB Output is correct
26 Correct 17 ms 1496 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 568 KB Output is correct
33 Correct 2 ms 472 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 32 ms 10448 KB Output is correct
36 Correct 83 ms 17960 KB Output is correct
37 Correct 85 ms 14788 KB Output is correct
38 Correct 0 ms 348 KB Output is correct
39 Correct 0 ms 452 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 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 2 ms 708 KB Output is correct
46 Correct 3 ms 856 KB Output is correct
47 Correct 1 ms 344 KB Output is correct
48 Correct 17 ms 2776 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 600 KB Output is correct
52 Correct 1 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 50 ms 7516 KB Output is correct
56 Correct 31 ms 3796 KB Output is correct
57 Correct 22 ms 4056 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 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 500 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 360 KB Output is correct
9 Correct 44 ms 4564 KB Output is correct
10 Correct 29 ms 2776 KB Output is correct
11 Correct 21 ms 2516 KB Output is correct
12 Correct 17 ms 1496 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 568 KB Output is correct
19 Correct 2 ms 472 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 32 ms 10448 KB Output is correct
22 Correct 83 ms 17960 KB Output is correct
23 Correct 85 ms 14788 KB Output is correct
24 Correct 27 ms 2264 KB Output is correct
25 Correct 64 ms 7100 KB Output is correct
26 Correct 11 ms 1672 KB Output is correct
27 Correct 84 ms 16356 KB Output is correct
28 Correct 97 ms 15692 KB Output is correct
29 Correct 98 ms 15808 KB Output is correct
30 Correct 117 ms 15296 KB Output is correct
31 Correct 192 ms 15344 KB Output is correct
32 Correct 111 ms 10896 KB Output is correct
33 Correct 217 ms 16492 KB Output is correct
34 Correct 113 ms 11728 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 1 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 1 ms 600 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 91 ms 11428 KB Output is correct
12 Correct 92 ms 11572 KB Output is correct
13 Correct 68 ms 9148 KB Output is correct
14 Correct 64 ms 10688 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 500 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 360 KB Output is correct
23 Correct 44 ms 4564 KB Output is correct
24 Correct 29 ms 2776 KB Output is correct
25 Correct 21 ms 2516 KB Output is correct
26 Correct 17 ms 1496 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 568 KB Output is correct
33 Correct 2 ms 472 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 452 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 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 2 ms 708 KB Output is correct
42 Correct 3 ms 856 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 17 ms 2776 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 600 KB Output is correct
48 Correct 1 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 50 ms 7516 KB Output is correct
52 Correct 31 ms 3796 KB Output is correct
53 Correct 22 ms 4056 KB Output is correct
54 Correct 27 ms 2264 KB Output is correct
55 Correct 64 ms 7100 KB Output is correct
56 Correct 11 ms 1672 KB Output is correct
57 Correct 84 ms 16356 KB Output is correct
58 Correct 97 ms 15692 KB Output is correct
59 Correct 98 ms 15808 KB Output is correct
60 Correct 117 ms 15296 KB Output is correct
61 Correct 192 ms 15344 KB Output is correct
62 Correct 111 ms 10896 KB Output is correct
63 Correct 217 ms 16492 KB Output is correct
64 Correct 113 ms 11728 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 32 ms 10448 KB Output is correct
67 Correct 83 ms 17960 KB Output is correct
68 Correct 85 ms 14788 KB Output is correct
69 Correct 19 ms 1696 KB Output is correct
70 Correct 5 ms 720 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 30 ms 2288 KB Output is correct
73 Correct 6 ms 864 KB Output is correct
74 Correct 1 ms 500 KB Output is correct
75 Correct 103 ms 16952 KB Output is correct
76 Correct 112 ms 15160 KB Output is correct
77 Correct 114 ms 18192 KB Output is correct
78 Correct 145 ms 15736 KB Output is correct
79 Correct 199 ms 16552 KB Output is correct
80 Correct 205 ms 16980 KB Output is correct
81 Correct 206 ms 15260 KB Output is correct
82 Correct 204 ms 15408 KB Output is correct