Submission #570722

# Submission time Handle Problem Language Result Execution time Memory
570722 2022-05-31T07:13:52 Z nttt Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;
#define MASK(i) (1LL << (i))
#define BIT(x, i) ((x >> (i)) & 1)
#define fi first
#define se second
#define ll long long
#define task "name" 

const int oo = 1e9 + 7;
const ll loo = (ll)1e18 + 7;
const int MOD = 1e9 + 7;
const int N = 1e5 + 3;
const int BASE = 10;

template <typename T1, typename T2> bool minimize(T1 &a, T2 b)
{
    if (a > b) {a = b; return true;} return false;
}
template <typename T1, typename T2> bool maximize(T1 &a, T2 b)
{
    if (a < b) {a = b; return true;} return false;
}

int n;
long double a[N], b[N];
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(task".inp" , "r" , stdin);
    //freopen(task".out" , "w" , stdout);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i] >> b[i];
    sort(a + 1, a + 1 + n, greater<long double>());
    sort(b + 1, b + 1 + n, greater<long double>());
    for (int i = 1; i <= n; i++)
    {
        a[i] += a[i - 1];
        b[i] += b[i - 1];
    }
    long double ans = -oo;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
            maximize(ans, min(a[i], b[j]) - j - i);
    cout << fixed << setprecision(4) << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -