답안 #527520

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
527520 2022-02-17T14:40:47 Z voventa Self Study (JOI22_ho_t2) C++17
62 / 100
268 ms 9448 KB
#include <bits/stdc++.h>
#define x first
#define y second
#define sz(a) (int)a.size()
#define pb push_back
#define int long long

using namespace std;
typedef long long ll;

const int K = 5000;

void solve();

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--)
        solve();
    return 0;
}

int a[300010], b[300010];

int n, m;

int check(int x) {
    int cnt = m * n;
    for (int i = 0; i < n; ++i) {
        if (a[i] > b[i]) {
            int f = (x + a[i] - 1) / a[i];
            if (f <= m)
                cnt -= f;
            else {
                cnt -= m;
                cnt -= (x - a[i] * m + b[i] - 1) / b[i];
            }
        } else {
            cnt -= (x + b[i] - 1) / b[i];
        }
        if (cnt < 0)
            return false;
    }
    return true;
}

void solve() {
    cin >> n >> m;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    for (int i = 0; i < n; ++i)
        cin >> b[i];
    int l = 0, r = 1e18;
    l = 0, r = 1e18;
    while (r - l > 1) {
        int mid = (r + l) / 2;
        if (check(mid))
            l = mid;
        else
            r = mid;
    }
    cout << l << endl;

}
//923953850098595069
//890909762780980010

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 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 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 452 KB Output is correct
11 Correct 105 ms 9448 KB Output is correct
12 Correct 115 ms 9324 KB Output is correct
13 Correct 88 ms 6480 KB Output is correct
14 Correct 74 ms 8528 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 31 ms 5260 KB Output is correct
17 Correct 107 ms 5744 KB Output is correct
18 Correct 92 ms 6100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 31 ms 5260 KB Output is correct
3 Correct 107 ms 5744 KB Output is correct
4 Correct 92 ms 6100 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 51 ms 4788 KB Output is correct
14 Correct 36 ms 2632 KB Output is correct
15 Correct 25 ms 2132 KB Output is correct
16 Correct 22 ms 1820 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 1 ms 320 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 3 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 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 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 452 KB Output is correct
11 Correct 105 ms 9448 KB Output is correct
12 Correct 115 ms 9324 KB Output is correct
13 Correct 88 ms 6480 KB Output is correct
14 Correct 74 ms 8528 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 296 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 320 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 51 ms 4788 KB Output is correct
24 Correct 36 ms 2632 KB Output is correct
25 Correct 25 ms 2132 KB Output is correct
26 Correct 22 ms 1820 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 332 KB Output is correct
31 Correct 1 ms 320 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 440 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 31 ms 5260 KB Output is correct
36 Correct 107 ms 5744 KB Output is correct
37 Correct 92 ms 6100 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 0 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 2 ms 448 KB Output is correct
46 Correct 4 ms 524 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 20 ms 1676 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 3 ms 456 KB Output is correct
52 Correct 0 ms 320 KB Output is correct
53 Correct 0 ms 204 KB Output is correct
54 Correct 1 ms 204 KB Output is correct
55 Correct 57 ms 4332 KB Output is correct
56 Correct 32 ms 2360 KB Output is correct
57 Correct 29 ms 2500 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 1 ms 296 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 51 ms 4788 KB Output is correct
10 Correct 36 ms 2632 KB Output is correct
11 Correct 25 ms 2132 KB Output is correct
12 Correct 22 ms 1820 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 3 ms 440 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 31 ms 5260 KB Output is correct
22 Correct 107 ms 5744 KB Output is correct
23 Correct 92 ms 6100 KB Output is correct
24 Correct 31 ms 1308 KB Output is correct
25 Correct 69 ms 3264 KB Output is correct
26 Correct 15 ms 892 KB Output is correct
27 Correct 94 ms 6700 KB Output is correct
28 Correct 119 ms 6732 KB Output is correct
29 Correct 104 ms 6652 KB Output is correct
30 Correct 128 ms 6728 KB Output is correct
31 Correct 211 ms 7860 KB Output is correct
32 Correct 118 ms 5600 KB Output is correct
33 Incorrect 268 ms 6660 KB Output isn't correct
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 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 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 ms 452 KB Output is correct
11 Correct 105 ms 9448 KB Output is correct
12 Correct 115 ms 9324 KB Output is correct
13 Correct 88 ms 6480 KB Output is correct
14 Correct 74 ms 8528 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 296 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 320 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 51 ms 4788 KB Output is correct
24 Correct 36 ms 2632 KB Output is correct
25 Correct 25 ms 2132 KB Output is correct
26 Correct 22 ms 1820 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 332 KB Output is correct
31 Correct 1 ms 320 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 3 ms 440 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 0 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 2 ms 448 KB Output is correct
42 Correct 4 ms 524 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 20 ms 1676 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 3 ms 456 KB Output is correct
48 Correct 0 ms 320 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 1 ms 204 KB Output is correct
51 Correct 57 ms 4332 KB Output is correct
52 Correct 32 ms 2360 KB Output is correct
53 Correct 29 ms 2500 KB Output is correct
54 Correct 31 ms 1308 KB Output is correct
55 Correct 69 ms 3264 KB Output is correct
56 Correct 15 ms 892 KB Output is correct
57 Correct 94 ms 6700 KB Output is correct
58 Correct 119 ms 6732 KB Output is correct
59 Correct 104 ms 6652 KB Output is correct
60 Correct 128 ms 6728 KB Output is correct
61 Correct 211 ms 7860 KB Output is correct
62 Correct 118 ms 5600 KB Output is correct
63 Incorrect 268 ms 6660 KB Output isn't correct
64 Halted 0 ms 0 KB -