답안 #681399

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
681399 2023-01-13T02:20:21 Z vjudge1 Sure Bet (CEOI17_sure) C++14
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define pb push_back
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<double, double> pdd;

void print() {cerr << '\n';} template <typename T1, typename... T2>
void print(const T1 &a, const T2 &...b) { cerr << a << ' ', print(b...); }

const int N = 1e5;
const int mod = 1e9 + 7;

double a[N], b[N];
double res = -1e18;
int n;

void solve()
{
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i] >> b[i];
        
    sort(a + 1, a + 1 + n, greater<double>());
    sort(b + 1, b + 1 + n, greater<double>());
    
    for(int i = 1; i <= n; i++)
    {
        a[i] += a[i - 1];
        b[i] += b[i - 1];
    }
    
    for(int num = 1; num <= n; num++)
        for(int i = 0; i <= num; i++)
            res = max(res, min(a[i] - num, b[num - i] - num));
    cout << setprecision(4) << fixed << res;
}

signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -