# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
303929 | 2020-09-20T19:23:57 Z | peuch | Sure Bet (CEOI17_sure) | C++17 | 1 ms | 384 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); } printf("%0.4lf", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 1 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |