# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56079 | 2018-07-09T21:28:05 Z | gabrielsimoes | Sure Bet (CEOI17_sure) | C++17 | 3 ms | 468 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN = 1e5+10; int n; ll pa[MAXN], pb[MAXN]; ll ans = 0; void dfs(int i, ll a, ll b) { if (i == n) { ans = max(ans, min(a, b)); } else { dfs(i+1, a, b); dfs(i+1, a-10000, b+pb[i]-10000); dfs(i+1, a+pa[i]-10000, b-10000); } } int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { double a, b; scanf("%lf %lf", &a, &b); // printf("%lf %lf\n", a, b); pa[i] = 1e4 * a; pb[i] = 1e4 * b; } dfs(0, 0, 0); printf("%.4lf\n", double(ans) / 1e4); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 3 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 3 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 3 ms | 468 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |