답안 #920181

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
920181 2024-02-02T08:11:59 Z Alihan_8 Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define ar array
#define pb push_back
#define ln '\n'
#define int long long

using i64 = long long;

template <class F, class _S>
bool chmin(F &u, const _S &v){
    bool flag = false;
    if ( u > v ){
        u = v; flag |= true;
    }
    return flag;
}

template <class F, class _S>
bool chmax(F &u, const _S &v){
    bool flag = false;
    if ( u < v ){
        u = v; flag |= true;
    }
    return flag;
}

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

    int n; cin >> n;
    vector <double> a(n), b(n);
    for ( int i = 0; i < n; i++ ){
        cin >> a[i] >> b[i];
    }
    sort(all(a), greater <double> ());
    sort(all(b), greater <double> ());
    double opt = 0, pf = 0;
    for ( int i = 0; i < n; i++ ){
        double cnt = 0;
        for ( int j = 0; j < n; j++ ){
            chmax(opt, min(cnt, pf) - (i + j));
            cnt += b[j];
        } pf += a[i];
    }
    cout << opt;

    cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -