# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
92948 |
2019-01-06T08:41:27 Z |
Kastanda |
Sure Bet (CEOI17_sure) |
C++11 |
|
97 ms |
3348 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] = (int)(a * 1000000);
B[i] = (int)(b * 1000000);
}
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 * 1000000);
}
long double res = Mx; res /= (long double)(1000000.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 |
376 KB |
Output is correct |
3 |
Correct |
3 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 |
376 KB |
Output is correct |
3 |
Correct |
3 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 |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
504 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 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 |
376 KB |
Output is correct |
3 |
Correct |
3 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 |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
504 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Incorrect |
97 ms |
3348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |