# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
117088 |
2019-06-14T17:43:25 Z |
johutha |
Sure Bet (CEOI17_sure) |
C++14 |
|
2 ms |
384 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#define int int64_t
using namespace std;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<double> a(n);
vector<double> b(n);
for (int i = 0; i < n; i++)
{
cin >> a[i] >> b[i];
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
reverse(a.begin(), a.end());
reverse(b.begin(), b.end());
int bc = 0;
double glmax = 0;
double curra = 0;
double currb = 0;
for (int i = 0; i < n; i++)
{
curra += a[i];
curra -= (double)1;
currb -= (double)1;
glmax = max(glmax, min(curra, currb));
while (bc < n && currb < curra)
{
curra -= (double)1;
currb += b[bc] - (double)1;
bc++;
}
glmax = max(glmax, min(curra, currb));
}
printf("%.4lf",(double)glmax);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |