Submission #1028923

# Submission time Handle Problem Language Result Execution time Memory
1028923 2024-07-20T10:21:51 Z tvladm2009 Self Study (JOI22_ho_t2) C++17
0 / 100
92 ms 10904 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 += (a[i] * m - mid) / 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 348 KB Output is correct
2 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 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 604 KB Output is correct
11 Correct 92 ms 10768 KB Output is correct
12 Correct 83 ms 10904 KB Output is correct
13 Correct 76 ms 8788 KB Output is correct
14 Incorrect 85 ms 8960 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 58 ms 5468 KB Output is correct
10 Correct 28 ms 3932 KB Output is correct
11 Correct 21 ms 2908 KB Output is correct
12 Correct 18 ms 2396 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 548 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 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 604 KB Output is correct
11 Correct 92 ms 10768 KB Output is correct
12 Correct 83 ms 10904 KB Output is correct
13 Correct 76 ms 8788 KB Output is correct
14 Incorrect 85 ms 8960 KB Output isn't correct
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 58 ms 5468 KB Output is correct
10 Correct 28 ms 3932 KB Output is correct
11 Correct 21 ms 2908 KB Output is correct
12 Correct 18 ms 2396 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 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 2 ms 548 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 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 604 KB Output is correct
11 Correct 92 ms 10768 KB Output is correct
12 Correct 83 ms 10904 KB Output is correct
13 Correct 76 ms 8788 KB Output is correct
14 Incorrect 85 ms 8960 KB Output isn't correct
15 Halted 0 ms 0 KB -