답안 #868656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
868656 2023-11-01T06:06:52 Z Desh03 Self Study (JOI22_ho_t2) C++17
0 / 100
273 ms 8684 KB
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n);
    for (int &x : a) {
        cin >> x;
    }
    for (int &x : b) {
        cin >> x;
    }
    auto check = [&](long long x) {
        long long t = 0;
        for (int i = 0; i < n; i++) {
            if (b[i] >= a[i]) {
                t += m - (x + b[i] - 1) / b[i];
            } else {
                if ((long long) a[i] * m >= x) t += m - (x + a[i] - 1) / a[i];
                else t -= (x - (long long) a[i] * m + b[i] - 1) / b[i];
            }
        }
        return t >= 0;
    };
    long long l = 0, r = 1e18;
    while (l < r) {
        long long m = l + r + 1 >> 1;
        if (check(m)) l = m;
        else r = m - 1;
    }
    cout << l << '\n';
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:31:29: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |         long long m = l + r + 1 >> 1;
      |                       ~~~~~~^~~
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 151 ms 8684 KB Output is correct
12 Correct 151 ms 8528 KB Output is correct
13 Correct 139 ms 6480 KB Output is correct
14 Incorrect 273 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 464 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 456 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 72 ms 4420 KB Output is correct
10 Correct 48 ms 3156 KB Output is correct
11 Correct 36 ms 2448 KB Output is correct
12 Correct 29 ms 2088 KB Output is correct
13 Correct 1 ms 344 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 344 KB Output is correct
18 Incorrect 5 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 151 ms 8684 KB Output is correct
12 Correct 151 ms 8528 KB Output is correct
13 Correct 139 ms 6480 KB Output is correct
14 Incorrect 273 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 464 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 456 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 72 ms 4420 KB Output is correct
10 Correct 48 ms 3156 KB Output is correct
11 Correct 36 ms 2448 KB Output is correct
12 Correct 29 ms 2088 KB Output is correct
13 Correct 1 ms 344 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 344 KB Output is correct
18 Incorrect 5 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
7 Correct 0 ms 456 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 151 ms 8684 KB Output is correct
12 Correct 151 ms 8528 KB Output is correct
13 Correct 139 ms 6480 KB Output is correct
14 Incorrect 273 ms 6608 KB Output isn't correct
15 Halted 0 ms 0 KB -