Submission #878001

# Submission time Handle Problem Language Result Execution time Memory
878001 2023-11-24T02:01:00 Z Sunlight Sure Bet (CEOI17_sure) C++14
100 / 100
62 ms 2932 KB
#include<bits/stdc++.h>
using namespace std;

const int MAX = 2e5 + 5;
double arr[MAX], brr[MAX];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;

    for(int i = 1; i <= n; i ++) cin >> arr[i] >> brr[i];
    sort(arr + 1, arr + 1 + n, greater<double>());
    sort(brr + 1, brr + 1 + n, greater<double>());

    double sA = 0, sB = 0, ans = 0;
    int cA = 0, cB = 0;

    for(int i = 1; i <= 2 * n; i ++)
    {
        if(sA < sB)
        {
            cA ++;
            sA += arr[cA];
        }
        else
        {
            cB ++;
            sB += brr[cB];
        }

        ans = max(ans, min(sA, sB) - i);
    }

    cout << fixed << setprecision(4) << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 2 ms 2396 KB Output is correct
15 Correct 1 ms 2512 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 2 ms 2396 KB Output is correct
15 Correct 1 ms 2512 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 56 ms 2652 KB Output is correct
18 Correct 59 ms 2712 KB Output is correct
19 Correct 57 ms 2728 KB Output is correct
20 Correct 56 ms 2652 KB Output is correct
21 Correct 59 ms 2700 KB Output is correct
22 Correct 59 ms 2932 KB Output is correct
23 Correct 59 ms 2648 KB Output is correct
24 Correct 57 ms 2648 KB Output is correct
25 Correct 56 ms 2672 KB Output is correct
26 Correct 62 ms 2680 KB Output is correct