Submission #858377

# Submission time Handle Problem Language Result Execution time Memory
858377 2023-10-08T09:26:48 Z Tenis0206 Sure Bet (CEOI17_sure) C++11
60 / 100
2000 ms 3156 KB
#include <bits/stdc++.h>

using namespace std;

const int nmax = 1e5;

int n;
double a[nmax + 5], b[nmax + 5];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    #ifdef home
    freopen("nr.in","r",stdin);
    freopen("nr.out","w",stdout);
    #endif // home
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
    }
    sort(a+1,a+n+1,greater<double>());
    sort(b+1,b+n+1,greater<double>());
    double rez = 0;
    double sum_a = 0;
    for(int nra=0;nra<=n;nra++)
    {
        sum_a += a[nra];
        double sum_b = 0;
        for(int nrb=0;nrb<=n;nrb++)
        {
            sum_b += b[nrb];
            rez = max(rez, min(sum_b - (nra + nrb), sum_a - (nra + nrb)));
        }
    }
    cout<<fixed<<setprecision(4);
    cout<<rez<<'\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 460 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 3 ms 500 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 460 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 3 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 3 ms 500 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Execution timed out 2009 ms 3156 KB Time limit exceeded
18 Halted 0 ms 0 KB -