# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
303930 | 2020-09-20T19:25:07 Z | peuch | Sure Bet (CEOI17_sure) | C++17 | 74 ms | 3576 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 100010; int n; double a[MAXN], b[MAXN]; double bWin, aWin, cost; double ans; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i++) scanf("%lf %lf", &a[i], &b[i]); sort(a + 1, a + 1 + n); sort(b + 1, b + 1 + n); int aID = n, bID = n; while(aID > 0 && bID > 0){ cost--; if(aWin < bWin || (aWin == bWin && a[aID] > b[bID])) aWin += a[aID--]; else bWin += b[bID--]; ans = max(ans, min(aWin, bWin) + cost); } while(aID > 0){ cost--; aWin += a[aID--]; ans = max(ans, min(aWin, bWin) + cost); } while(bID > 0){ cost--; bWin += b[bID--]; ans = max(ans, min(aWin, bWin) + cost); } printf("%0.4lf", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 0 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 0 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 0 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 0 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 70 ms | 3192 KB | Output is correct |
18 | Correct | 73 ms | 3192 KB | Output is correct |
19 | Correct | 70 ms | 3192 KB | Output is correct |
20 | Correct | 71 ms | 3192 KB | Output is correct |
21 | Correct | 72 ms | 3576 KB | Output is correct |
22 | Correct | 68 ms | 3192 KB | Output is correct |
23 | Correct | 70 ms | 3288 KB | Output is correct |
24 | Correct | 71 ms | 3320 KB | Output is correct |
25 | Correct | 70 ms | 3320 KB | Output is correct |
26 | Correct | 74 ms | 3576 KB | Output is correct |