답안 #1053817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1053817 2024-08-11T18:00:27 Z Alebn Self Study (JOI22_ho_t2) C++14
0 / 100
77 ms 7512 KB
#include <bits/stdc++.h>
#define int long long

using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n), arr(n);
    int res = INT_MAX;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) {
        cin >> b[i];
        arr[i] = m * max(a[i], b[i]);
        res = min(res, arr[i]);
    }
    int l = 0, r = 1e18, mid;
    while(l <= r) {
        mid = (l + r) / 2;
        int over = 0, under = 0;
        for(int i = 0; i < n; i++) {
            if(arr[i] >= mid) over += (arr[i] - mid) / max(a[i], b[i]);
            else under += (mid - arr[i]) / b[i] + ((mid - arr[i]) % b[i] ? 1 : 0);
        }
        if(over >= under) {
            l = mid + 1;
            res = max(res, mid);
        } else r = mid - 1;
    }
    cout << res << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 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 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 1 ms 348 KB Output is correct
11 Correct 70 ms 7484 KB Output is correct
12 Correct 77 ms 7512 KB Output is correct
13 Correct 70 ms 7484 KB Output is correct
14 Incorrect 70 ms 7256 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 344 KB Output is correct
3 Correct 0 ms 348 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 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 34 ms 3928 KB Output is correct
10 Correct 25 ms 2652 KB Output is correct
11 Correct 18 ms 2140 KB Output is correct
12 Correct 14 ms 1884 KB Output is correct
13 Correct 0 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 1 ms 348 KB Output isn't correct
19 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 348 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 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 1 ms 348 KB Output is correct
11 Correct 70 ms 7484 KB Output is correct
12 Correct 77 ms 7512 KB Output is correct
13 Correct 70 ms 7484 KB Output is correct
14 Incorrect 70 ms 7256 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 344 KB Output is correct
3 Correct 0 ms 348 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 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 34 ms 3928 KB Output is correct
10 Correct 25 ms 2652 KB Output is correct
11 Correct 18 ms 2140 KB Output is correct
12 Correct 14 ms 1884 KB Output is correct
13 Correct 0 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 1 ms 348 KB Output isn't correct
19 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 348 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 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 1 ms 348 KB Output is correct
11 Correct 70 ms 7484 KB Output is correct
12 Correct 77 ms 7512 KB Output is correct
13 Correct 70 ms 7484 KB Output is correct
14 Incorrect 70 ms 7256 KB Output isn't correct
15 Halted 0 ms 0 KB -