Submission #343147

# Submission time Handle Problem Language Result Execution time Memory
343147 2021-01-03T12:50:13 Z benedict0724 Sure Bet (CEOI17_sure) C++17
60 / 100
3 ms 620 KB
#include <bits/stdc++.h>

using namespace std;

double a[1002];
double b[1002];

double sum_a[1002];
double sum_b[1002];

bool cmp(double x, double y){
    return x > y;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i] >> b[i];
    }
    sort(a, a+n, cmp);
    sort(b, b+n, cmp);

    double ans = 0;

    sum_a[0] = 0, sum_b[0] = 0;
    for(int i=1;i<=n;i++){
        sum_a[i] = sum_a[i-1] + a[i-1];
        sum_b[i] = sum_b[i-1] + b[i-1];
    }

    for(int m = 1;m<=2*n;m++){
        for(int k=max(0, m-n);k<=min(m, n);k++){
            ans = max(ans, min(sum_a[k] - m, sum_b[m-k] - m));
        }
    }

    printf("%.4lf", ans);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 3 ms 364 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 2 ms 364 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Runtime error 2 ms 620 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Halted 0 ms 0 KB -