Submission #936712

# Submission time Handle Problem Language Result Execution time Memory
936712 2024-03-02T15:14:19 Z kitlix Self Study (JOI22_ho_t2) C++17
0 / 100
277 ms 5140 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int INF = 1e18;

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int n, w;
    cin >> n >> w;
    vector<int> a(n), b(n);
    for (auto& el : a)
        cin >> el;
    for (auto& el : b)
        cin >> el;
    for (int i = 0; i < n; ++i)
        a[i] = max(a[i], b[i]);
    int l = 0, r = INF;
    while (l + 1 < r) {
        int m = (l + r) / 2;
        int extra = 0, need = 0;
        for (int i = 0; i < n; ++i) {
            if (a[i] * w >= m) {
                extra += w - ((m + a[i] - 1) / a[i]);
                continue;
            }
            need += (m - a[i] * w + b[i] - 1) / b[i];
        }
        if (extra >= need)
            l = m;
        else
            r = m;
    }
    cout << l << '\n';
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 143 ms 5140 KB Output is correct
12 Correct 144 ms 5136 KB Output is correct
13 Correct 132 ms 4956 KB Output is correct
14 Incorrect 277 ms 5140 KB Output isn't correct
15 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 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 73 ms 2792 KB Output is correct
10 Correct 51 ms 1884 KB Output is correct
11 Correct 37 ms 1628 KB Output is correct
12 Correct 29 ms 1420 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 600 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 4 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 143 ms 5140 KB Output is correct
12 Correct 144 ms 5136 KB Output is correct
13 Correct 132 ms 4956 KB Output is correct
14 Incorrect 277 ms 5140 KB Output isn't correct
15 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 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 73 ms 2792 KB Output is correct
10 Correct 51 ms 1884 KB Output is correct
11 Correct 37 ms 1628 KB Output is correct
12 Correct 29 ms 1420 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 600 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 4 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 143 ms 5140 KB Output is correct
12 Correct 144 ms 5136 KB Output is correct
13 Correct 132 ms 4956 KB Output is correct
14 Incorrect 277 ms 5140 KB Output isn't correct
15 Halted 0 ms 0 KB -