# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1027438 | 2024-07-19T06:24:34 Z | vjudge1 | Sure Bet (CEOI17_sure) | C++14 | 61 ms | 4588 KB |
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define double long double const int MAXN = 100086; int main() { int n; vector<double> a(MAXN), b(MAXN); double sum1 = 0, sum2 = 0, maxx = 0; scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%Lf %Lf", &a[i], &b[i]); sort(a.begin() + 1, a.end(), greater<double>()); sort(b.begin() + 1, b.end(), greater<double>()); int r = 1; for (int l = 1; l <= n; ++l) { sum1 += a[l]; double res = 0; while (true) { res = min(sum1, sum2) - l - r + 1; if (min(sum1, sum2 + b[r]) - l - r > res) { sum2 += b[r++]; if (r > n) break; } else { break; } } maxx = max(maxx, min(sum1, sum2) - l - r + 1); } printf("%.4Lf", maxx); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 3416 KB | Output is correct |
2 | Correct | 12 ms | 3420 KB | Output is correct |
3 | Correct | 12 ms | 3600 KB | Output is correct |
4 | Correct | 12 ms | 3416 KB | Output is correct |
5 | Correct | 12 ms | 3592 KB | Output is correct |
6 | Correct | 12 ms | 3588 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 3416 KB | Output is correct |
2 | Correct | 12 ms | 3420 KB | Output is correct |
3 | Correct | 12 ms | 3600 KB | Output is correct |
4 | Correct | 12 ms | 3416 KB | Output is correct |
5 | Correct | 12 ms | 3592 KB | Output is correct |
6 | Correct | 12 ms | 3588 KB | Output is correct |
7 | Correct | 12 ms | 3420 KB | Output is correct |
8 | Correct | 12 ms | 3420 KB | Output is correct |
9 | Correct | 12 ms | 3588 KB | Output is correct |
10 | Correct | 12 ms | 3416 KB | Output is correct |
11 | Correct | 12 ms | 3420 KB | Output is correct |
12 | Correct | 12 ms | 3604 KB | Output is correct |
13 | Correct | 12 ms | 3420 KB | Output is correct |
14 | Correct | 14 ms | 3592 KB | Output is correct |
15 | Correct | 12 ms | 3420 KB | Output is correct |
16 | Correct | 13 ms | 3420 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 3416 KB | Output is correct |
2 | Correct | 12 ms | 3420 KB | Output is correct |
3 | Correct | 12 ms | 3600 KB | Output is correct |
4 | Correct | 12 ms | 3416 KB | Output is correct |
5 | Correct | 12 ms | 3592 KB | Output is correct |
6 | Correct | 12 ms | 3588 KB | Output is correct |
7 | Correct | 12 ms | 3420 KB | Output is correct |
8 | Correct | 12 ms | 3420 KB | Output is correct |
9 | Correct | 12 ms | 3588 KB | Output is correct |
10 | Correct | 12 ms | 3416 KB | Output is correct |
11 | Correct | 12 ms | 3420 KB | Output is correct |
12 | Correct | 12 ms | 3604 KB | Output is correct |
13 | Correct | 12 ms | 3420 KB | Output is correct |
14 | Correct | 14 ms | 3592 KB | Output is correct |
15 | Correct | 12 ms | 3420 KB | Output is correct |
16 | Correct | 13 ms | 3420 KB | Output is correct |
17 | Correct | 61 ms | 4440 KB | Output is correct |
18 | Correct | 54 ms | 4400 KB | Output is correct |
19 | Correct | 52 ms | 4468 KB | Output is correct |
20 | Correct | 52 ms | 4588 KB | Output is correct |
21 | Correct | 57 ms | 4376 KB | Output is correct |
22 | Correct | 52 ms | 4440 KB | Output is correct |
23 | Correct | 52 ms | 4444 KB | Output is correct |
24 | Correct | 52 ms | 4436 KB | Output is correct |
25 | Correct | 50 ms | 4440 KB | Output is correct |
26 | Correct | 52 ms | 4428 KB | Output is correct |