# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
92953 |
2019-01-06T08:48:04 Z |
Kastanda |
Sure Bet (CEOI17_sure) |
C++11 |
|
102 ms |
3736 KB |
#include<bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
long long A[N], B[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0); cin >> n;
for (int i = 1; i <= n; i++)
{
long double a, b;
cin >> a >> b;
A[i] = (long long)(a * 10000000000LL);
B[i] = (long long)(b * 10000000000LL);
}
sort(A + 1, A + n + 1);
sort(B + 1, B + n + 1);
reverse(A + 1, A + n + 1);
reverse(B + 1, B + n + 1);
for (int i = 1; i <= n; i++)
{
A[i] += A[i - 1];
B[i] += B[i - 1];
}
long long Mx = 0;
for (int k = 1; k <= n + n; k ++)
{
int l = 0, r = k, md;
if (k > n)
l = k - n, r = n;
while (r - l > 1)
{
md = (l + r) >> 1;
if (B[md] >= A[k - md])
r = md;
else
l = md;
}
for (int i = max(k - n, l - 2); i <= min(n, r + 2); i++)
Mx = max(Mx, min(B[i], A[k - i]) - k * 10000000000LL);
}
long double res = Mx; res /= (long double)(10000000000.0);
cout << fixed << setprecision(4) << res << endl;
return (0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
94 ms |
1912 KB |
Output is correct |
18 |
Correct |
98 ms |
3292 KB |
Output is correct |
19 |
Correct |
99 ms |
3272 KB |
Output is correct |
20 |
Correct |
101 ms |
3320 KB |
Output is correct |
21 |
Correct |
101 ms |
3704 KB |
Output is correct |
22 |
Correct |
95 ms |
3448 KB |
Output is correct |
23 |
Correct |
94 ms |
3320 KB |
Output is correct |
24 |
Correct |
96 ms |
3320 KB |
Output is correct |
25 |
Correct |
97 ms |
3420 KB |
Output is correct |
26 |
Correct |
102 ms |
3736 KB |
Output is correct |