Submission #812660

# Submission time Handle Problem Language Result Execution time Memory
812660 2023-08-07T09:55:02 Z Cookie Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 7916 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 = 0;
    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 <= 2 * n; i++){
        for(int j = 0; 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 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 10 ms 452 KB Output is correct
13 Correct 10 ms 344 KB Output is correct
14 Correct 11 ms 452 KB Output is correct
15 Correct 10 ms 340 KB Output is correct
16 Correct 10 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 10 ms 452 KB Output is correct
13 Correct 10 ms 344 KB Output is correct
14 Correct 11 ms 452 KB Output is correct
15 Correct 10 ms 340 KB Output is correct
16 Correct 10 ms 452 KB Output is correct
17 Execution timed out 2048 ms 7916 KB Time limit exceeded
18 Halted 0 ms 0 KB -