Submission #56083

# Submission time Handle Problem Language Result Execution time Memory
56083 2018-07-09T21:54:50 Z gabrielsimoes Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3768 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAXN = 1e5+10;

int n;
vector<double> va, vb;

int main() {
    scanf("%d", &n);


    for (int i = 0; i < n; i++) {
        double a, b;
        scanf("%lf %lf", &a, &b);
        va.push_back(a);
        vb.push_back(b);
    }

    sort(va.rbegin(), va.rend());
    sort(vb.rbegin(), vb.rend());

    for (int i = 1; i < n; i++) {
        va[i] += va[i-1];
        vb[i] += vb[i-1];
    }

    va.insert(va.begin(), 0);
    vb.insert(vb.begin(), 0);

    double ans = 0;
    for (int i = 0; i <= n; i++) {
        for (int k = 0; k <= n; k++) {
            ans = max(ans, min(va[i] - (i+k), vb[k] - (i+k)));
        }
    }

    printf("%.4lf\n", ans);
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
sure.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lf %lf", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 6 ms 612 KB Output is correct
13 Correct 7 ms 652 KB Output is correct
14 Correct 7 ms 668 KB Output is correct
15 Correct 7 ms 684 KB Output is correct
16 Correct 6 ms 700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 560 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 2 ms 600 KB Output is correct
6 Correct 2 ms 600 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 3 ms 600 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 6 ms 612 KB Output is correct
13 Correct 7 ms 652 KB Output is correct
14 Correct 7 ms 668 KB Output is correct
15 Correct 7 ms 684 KB Output is correct
16 Correct 6 ms 700 KB Output is correct
17 Execution timed out 2058 ms 3768 KB Time limit exceeded
18 Halted 0 ms 0 KB -