# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
131552 |
2019-07-17T09:28:37 Z |
SamAnd |
Sure Bet (CEOI17_sure) |
C++17 |
|
125 ms |
5272 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n;
double a[N], b[N];
double sa[N], sb[N];
double ans;
int main()
{
ios_base::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(4);
cin >> n;
for (int i = 1; i <= n; ++i)
{
cin >> a[i] >> b[i];
}
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
for (int i = n; i >= 1; --i)
{
sa[i] = sa[i + 1] + a[i];
sb[i] = sb[i + 1] + b[i];
}
double ans = 0;
for (int i = n; i >= 1; --i)
{
int l = 1, r = n;
while ((r - l) > 3)
{
int m = (l + r) / 2;
if ((sa[i] - (n - i + 1) - (n - m + 1)) <= (sb[m] - (n - i + 1) - (n - m + 1)))
l = m;
else
r = m;
}
for (int m = max(1, l - 5); m <= min(n, r + 5); ++m)
{
ans = max(ans, min((sa[i] - (n - i + 1) - (n - m + 1)), (sb[m] - (n - i + 1) - (n - m + 1))));
}
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
4 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
376 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 |
504 KB |
Output is correct |
2 |
Correct |
2 ms |
376 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 |
4 ms |
348 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
3 ms |
376 KB |
Output is correct |
17 |
Correct |
116 ms |
4856 KB |
Output is correct |
18 |
Correct |
120 ms |
4956 KB |
Output is correct |
19 |
Correct |
118 ms |
4912 KB |
Output is correct |
20 |
Correct |
118 ms |
4780 KB |
Output is correct |
21 |
Correct |
125 ms |
5160 KB |
Output is correct |
22 |
Correct |
117 ms |
5112 KB |
Output is correct |
23 |
Correct |
117 ms |
4860 KB |
Output is correct |
24 |
Correct |
117 ms |
4856 KB |
Output is correct |
25 |
Correct |
117 ms |
4828 KB |
Output is correct |
26 |
Correct |
125 ms |
5272 KB |
Output is correct |