답안 #1053797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1053797 2024-08-11T17:46:15 Z Alebn Self Study (JOI22_ho_t2) C++14
0 / 100
74 ms 13304 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);
    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]);
    }
    int l = 0, r = 1e18 + 1, mid, ans;
    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(mid == 18) cout << over << " " << under << "\n";
        if(over >= under) {
            l = mid + 1;
            ans = mid;
        } else r = mid - 1;
    }
    cout << ans << "\n";
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# 결과 실행 시간 메모리 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 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 2 ms 604 KB Output is correct
11 Correct 69 ms 13304 KB Output is correct
12 Correct 70 ms 13260 KB Output is correct
13 Correct 64 ms 11100 KB Output is correct
14 Incorrect 74 ms 11356 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 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 35 ms 6668 KB Output is correct
10 Correct 26 ms 4696 KB Output is correct
11 Correct 17 ms 3676 KB Output is correct
12 Correct 14 ms 2908 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 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 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 2 ms 604 KB Output is correct
11 Correct 69 ms 13304 KB Output is correct
12 Correct 70 ms 13260 KB Output is correct
13 Correct 64 ms 11100 KB Output is correct
14 Incorrect 74 ms 11356 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 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 35 ms 6668 KB Output is correct
10 Correct 26 ms 4696 KB Output is correct
11 Correct 17 ms 3676 KB Output is correct
12 Correct 14 ms 2908 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 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 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 2 ms 604 KB Output is correct
11 Correct 69 ms 13304 KB Output is correct
12 Correct 70 ms 13260 KB Output is correct
13 Correct 64 ms 11100 KB Output is correct
14 Incorrect 74 ms 11356 KB Output isn't correct
15 Halted 0 ms 0 KB -