답안 #595496

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
595496 2022-07-13T19:13:47 Z someone Self Study (JOI22_ho_t2) C++14
0 / 100
307 ms 10796 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int N = 3e5 + 42, INF = 1e18;

int n, m, a[N], b[N];

bool possible(int mini) {
    int need = 0;
    for(int i = 0; i < n; i++)
        if(m * a[i] < mini)
            need += (mini - m * a[i] + b[i] - 1) / b[i];
        else
            need -= m - (mini + a[i] - 1) / a[i];
    return need <= 0;
}

int dicho(int deb, int fin) {
    if(deb + 1 == fin)
        return deb;

    int mid = (deb + fin) >> 1;
    if(possible(mid))
        return dicho(mid, fin);
    return dicho(deb, mid);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> n >> m;
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 0; i < n; i++)
        cin >> b[i];
    for(int i = 0; i < n; i++)
        a[i] = max(a[i], b[i]);

    cout << dicho(0, INF);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 162 ms 10796 KB Output is correct
12 Correct 173 ms 10772 KB Output is correct
13 Correct 171 ms 8792 KB Output is correct
14 Incorrect 307 ms 8820 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 97 ms 5564 KB Output is correct
10 Correct 55 ms 3808 KB Output is correct
11 Correct 46 ms 2936 KB Output is correct
12 Correct 35 ms 2424 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Incorrect 5 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 162 ms 10796 KB Output is correct
12 Correct 173 ms 10772 KB Output is correct
13 Correct 171 ms 8792 KB Output is correct
14 Incorrect 307 ms 8820 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 97 ms 5564 KB Output is correct
10 Correct 55 ms 3808 KB Output is correct
11 Correct 46 ms 2936 KB Output is correct
12 Correct 35 ms 2424 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Incorrect 5 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 328 KB Output is correct
10 Correct 3 ms 468 KB Output is correct
11 Correct 162 ms 10796 KB Output is correct
12 Correct 173 ms 10772 KB Output is correct
13 Correct 171 ms 8792 KB Output is correct
14 Incorrect 307 ms 8820 KB Output isn't correct
15 Halted 0 ms 0 KB -