답안 #975627

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975627 2024-05-05T15:02:59 Z vjudge1 구경하기 (JOI13_watching) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define v(a) vector<a>

v(ll) arr;
ll n, p, q; 
ll binsearch(ll l, ll r, ll c1){
    if(l <= r){
        ll mid = (l+r)/2;
        ll cur = 2*mid*c1;
        bool ok = false;
        ll pos = upper_bound(arr.begin(), arr.end(), cur)-arr.begin()-1;
        // cout << pos << " " << mid <<  '\n';
        if(n-pos-1 <= p) ok = true;
        if(ok) return min(mid, binsearch(l, mid-1, c1));
        return binsearch(mid+1, r, c1);

    } return 1e9;
}
int main(){
    cin >> n >> p >> q;
    arr.resize(n);
    for(int i = 0; i < n; i++) cin >> arr[i];
    sort(arr.begin(), arr.end());
    if(p >= n || q >= n) cout << 1;
    else {
        cout << binsearch(1, 1e9, q);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -