Submission #812642

# Submission time Handle Problem Language Result Execution time Memory
812642 2023-08-07T09:45:49 Z Cookie Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 332 KB
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
//ifstream fin("FEEDING.INP");
//ofstream fout("FEEDING.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const int base = 74;
const ll mod = 1e9 + 7, inf = 1e9, mxv = 1005, mxn = 2e5 + 5;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
ld a[mxn + 1], b[mxn + 1], pa[mxn + 1], pb[mxn + 1];
signed main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> a[i] >> b[i];
    }
    ld ans = -inf;
    sort(a + 1, a + n + 1, greater<ld>()); sort(b + 1, b + n + 1, greater<ld>());
    for(int i = 1; i <= n; i++){
        pa[i] = pa[i - 1] + a[i]; pb[i] = pb[i - 1] + b[i];
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= i; j++){
            ld cand = min((pa[j] - i), (pb[i - j] - i));
            ans = max(ans, cand);
        }
        
    }
    cout << fixed << setprecision(4) << ans;
    return(0);
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -