# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
409071 |
2021-05-20T06:56:47 Z |
iulia13 |
Sure Bet (CEOI17_sure) |
C++14 |
|
1 ms |
312 KB |
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 1e5 + 5;
double a[N];
double b[N];
int main()
{
int i, n;
double ans = 0;
double sumA = 0, sumB = 0;
cin >> n;
for (i = 1; i <= n; i++)
{
cin >> a[i] >> b[i];
a[i] -= 1.0;
b[i] -= 1.0;
}
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
reverse(a + 1, a + n + 1);
reverse(b + 1, b + n + 1);
int j = 1;
for (i = 1; i <= n; i++)
{
sumA += a[i];
sumB -= 1.0;
double prv = min(sumA, sumB);
ans = max(ans, prv);
int h = j;
while (h <= n)
{
if (min(sumA - 1.0, sumB + b[h]) > prv)
{
sumA -= 1.0;
sumB += b[h];
prv = min(sumA, sumB);
ans = max(ans, prv);
h++;
}
else
break;
}
j = h;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |