Submission #510350

# Submission time Handle Problem Language Result Execution time Memory
510350 2022-01-15T00:39:57 Z Monarchuwu Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3196 KB
#include<iostream>
#include<algorithm>
#include<iomanip>
using namespace std;
typedef long long ll;
typedef double db;

const int N = 1e5 + 9;
int n;
db a[N], b[N];

int main() {
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i] >> b[i];

    sort(a + 1, a + n + 1, greater<db>());
    sort(b + 1, b + n + 1, greater<db>());

    db ans(0), suma(0), sumb(0);
    for (int i = 0; i <= n; ++i) {
        suma += a[i];

        sumb = 0;
        for (int j = 0; j <= n; ++j) {
            sumb += b[j];
            ans = max(ans, min(suma, sumb) - i - j);
        }
    }
    cout << fixed << setprecision(4) << ans << '\n';
}
/**  /\_/\
 *  (= ._.)
 *  / >0  \>1
**/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 4 ms 388 KB Output is correct
14 Correct 5 ms 332 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 4 ms 332 KB Output is correct
13 Correct 4 ms 388 KB Output is correct
14 Correct 5 ms 332 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 3 ms 332 KB Output is correct
17 Execution timed out 2056 ms 3196 KB Time limit exceeded
18 Halted 0 ms 0 KB -