Submission #67159

# Submission time Handle Problem Language Result Execution time Memory
67159 2018-08-13T12:20:28 Z Megumi_Tadokoro Sure Bet (CEOI17_sure) C++14
100 / 100
125 ms 7416 KB
#include <bits/stdc++.h>
using namespace std;

int n, L = 0, R = 0;
double a[100010], b[100010], A = 0, B = 0, ans = 0;

int main() {
    iostream::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i] >> b[i];
    sort(a, a + n, greater<double> ());
    sort(b, b + n, greater<double> ());
    while(L < n && R < n) {
        if(A < B) {
            A += a[L] - 1.0, B -= 1.0;
            ans = max(ans, min(A, B)), L++;
        }
        else {
            B += b[R] - 1.0, A -= 1.0;
            ans = max(ans, min(A, B)), R++;
        }
    }
    while(L < n) {
        A += a[L] - 1.0, B -= 1.0;
        ans = max(ans, min(A, B)), L++;
    }
    while(R < n) {
        B += b[R] - 1.0, A -= 1.0;
        ans = max(ans, min(A, B)), R++;
    }
    cout << fixed << setprecision(4) << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 3 ms 564 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 2 ms 648 KB Output is correct
10 Correct 2 ms 652 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 3 ms 660 KB Output is correct
13 Correct 4 ms 676 KB Output is correct
14 Correct 3 ms 692 KB Output is correct
15 Correct 3 ms 708 KB Output is correct
16 Correct 3 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 3 ms 564 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 2 ms 648 KB Output is correct
10 Correct 2 ms 652 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 3 ms 660 KB Output is correct
13 Correct 4 ms 676 KB Output is correct
14 Correct 3 ms 692 KB Output is correct
15 Correct 3 ms 708 KB Output is correct
16 Correct 3 ms 724 KB Output is correct
17 Correct 100 ms 3796 KB Output is correct
18 Correct 125 ms 5056 KB Output is correct
19 Correct 102 ms 6420 KB Output is correct
20 Correct 100 ms 7156 KB Output is correct
21 Correct 106 ms 7164 KB Output is correct
22 Correct 102 ms 7416 KB Output is correct
23 Correct 106 ms 7416 KB Output is correct
24 Correct 98 ms 7416 KB Output is correct
25 Correct 98 ms 7416 KB Output is correct
26 Correct 107 ms 7416 KB Output is correct