Submission #1028937

# Submission time Handle Problem Language Result Execution time Memory
1028937 2024-07-20T10:34:58 Z tvladm2009 Self Study (JOI22_ho_t2) C++17
0 / 100
86 ms 10896 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(n + 1);
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i) cin >> b[i];
    for (int i = 1; i <= n; ++i) a[i] = max(a[i], b[i]);

    int l = 1, r = 1e18, sol = 0;
    while (l <= r) {
        int mid = (l + r) / 2;
        int days = 0;
        int need = 0;
        for (int i = 1; i <= n; ++i) {
            if (a[i] * m >= mid) {
                days += m - (mid + a[i] - 1) / a[i];
            } else {
                need += (mid - a[i] * m + b[i] - 1) / b[i];
            }
        }
        if (need <= days) {
            sol = mid;
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }
    cout << sol << "\n";
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 448 KB Output is correct
2 Correct 1 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 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 85 ms 10896 KB Output is correct
12 Correct 86 ms 10836 KB Output is correct
13 Correct 73 ms 9040 KB Output is correct
14 Incorrect 86 ms 8784 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 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 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 42 ms 5480 KB Output is correct
10 Correct 28 ms 3940 KB Output is correct
11 Correct 21 ms 2904 KB Output is correct
12 Correct 15 ms 2396 KB Output is correct
13 Correct 0 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 448 KB Output is correct
2 Correct 1 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 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 85 ms 10896 KB Output is correct
12 Correct 86 ms 10836 KB Output is correct
13 Correct 73 ms 9040 KB Output is correct
14 Incorrect 86 ms 8784 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 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 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 42 ms 5480 KB Output is correct
10 Correct 28 ms 3940 KB Output is correct
11 Correct 21 ms 2904 KB Output is correct
12 Correct 15 ms 2396 KB Output is correct
13 Correct 0 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 448 KB Output is correct
2 Correct 1 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 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 604 KB Output is correct
11 Correct 85 ms 10896 KB Output is correct
12 Correct 86 ms 10836 KB Output is correct
13 Correct 73 ms 9040 KB Output is correct
14 Incorrect 86 ms 8784 KB Output isn't correct
15 Halted 0 ms 0 KB -