Submission #467353

# Submission time Handle Problem Language Result Execution time Memory
467353 2021-08-22T17:53:34 Z idk321 Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3196 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 100005;
double odds [2][N];



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> odds[0][i] >> odds[1][i];
    }
    sort(odds[0], odds[0] + n, greater<double>());
    sort(odds[1], odds[1] + n, greater<double>());

    double res = 0;
    double val1 = 0;
    int j = -1;
    for (int i = 0; i < n; i++) {
        double val2 = 0;
        val1 += odds[0][i];
        for (int j = 0; j < n; j++) {
            val2 += odds[1][j];
            res = max(res, min(val1, val2) - i - j- 2);
        }
    }

    cout << fixed << setprecision(4) << res << "\n";
}

/*
4
1.4 3.7
1.2 2
1.6 1.4
1.9 1.5
*/

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:25:9: warning: unused variable 'j' [-Wunused-variable]
   25 |     int j = -1;
      |         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 3 ms 332 KB Output is correct
13 Correct 3 ms 332 KB Output is correct
14 Correct 3 ms 332 KB Output is correct
15 Correct 3 ms 332 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Execution timed out 2081 ms 3196 KB Time limit exceeded
18 Halted 0 ms 0 KB -