답안 #734407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734407 2023-05-02T11:24:21 Z Josia Self Study (JOI22_ho_t2) C++17
0 / 100
542 ms 5068 KB
#include <bits/stdc++.h>

using namespace std;

#define int int64_t

int n, m;

bool check(int pos, vector<int>&a, vector<int>&b) {
    int free = 0;
    int req = 0;

    for (int i=0; i<n; i++) {
        int thisNeedsFromA = (pos+a[i]-1)/a[i];

        if (thisNeedsFromA <= m) {
            free += m-thisNeedsFromA;
        }
        else {
            req += (pos-a[i]*m + b[i]-1)/b[i];
        }
    }

    return free >= req;
}



signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin >> n >> m;

    vector<int> a(n), b(n);

    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]);



    int l = 0, r = INT64_MAX;

    while (l < r) {
        int pos = (l + r + 1) / 2;

        if (check(pos, a, b)) {
            l = pos;
        } else {
            r = pos-1;
        }
    }


    cout << l << "\n";


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 205 ms 4948 KB Output is correct
12 Correct 206 ms 4948 KB Output is correct
13 Correct 219 ms 5012 KB Output is correct
14 Incorrect 542 ms 5068 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 116 ms 2656 KB Output is correct
10 Correct 74 ms 1900 KB Output is correct
11 Correct 57 ms 1504 KB Output is correct
12 Correct 45 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 6 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 205 ms 4948 KB Output is correct
12 Correct 206 ms 4948 KB Output is correct
13 Correct 219 ms 5012 KB Output is correct
14 Incorrect 542 ms 5068 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 116 ms 2656 KB Output is correct
10 Correct 74 ms 1900 KB Output is correct
11 Correct 57 ms 1504 KB Output is correct
12 Correct 45 ms 1236 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Incorrect 6 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 205 ms 4948 KB Output is correct
12 Correct 206 ms 4948 KB Output is correct
13 Correct 219 ms 5012 KB Output is correct
14 Incorrect 542 ms 5068 KB Output isn't correct
15 Halted 0 ms 0 KB -