# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
139711 |
2019-08-01T09:42:42 Z |
RiscadoA |
Sure Bet (CEOI17_sure) |
C++14 |
|
227 ms |
3684 KB |
#include <bits/stdc++.h>
const int MAX_N = 100000;
int N;
double S[2][MAX_N];
inline double min(double a, double b)
{
return a < b ? a : b;
}
int main()
{
std::cin >> N;
for (int i = 0; i < N; ++i)
std::cin >> S[0][i] >> S[1][i];
std::sort(std::begin(S[0]), std::begin(S[0]) + N, std::greater<double>());
std::sort(std::begin(S[1]), std::begin(S[1]) + N, std::greater<double>());
double best = 0.0;
double a = 0.0, b = 0.0;
for (int i = 0, j = 0;;) {
if (i >= N && j >= N)
break;
else if ((i < N && a <= b) || j >= N) {
a += S[0][i] - 1.0;
b -= 1.0;
i += 1;
} else {
b += S[1][j] - 1.0;
a -= 1.0;
j += 1;
}
if (min(a, b) > best)
best = min(a, b);
}
printf("%.4lf", best);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
380 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
356 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
412 KB |
Output is correct |
15 |
Correct |
4 ms |
376 KB |
Output is correct |
16 |
Correct |
6 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 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 |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
380 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
2 ms |
356 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
4 ms |
376 KB |
Output is correct |
13 |
Correct |
4 ms |
376 KB |
Output is correct |
14 |
Correct |
4 ms |
412 KB |
Output is correct |
15 |
Correct |
4 ms |
376 KB |
Output is correct |
16 |
Correct |
6 ms |
376 KB |
Output is correct |
17 |
Correct |
196 ms |
3320 KB |
Output is correct |
18 |
Correct |
191 ms |
3520 KB |
Output is correct |
19 |
Correct |
197 ms |
3320 KB |
Output is correct |
20 |
Correct |
192 ms |
3324 KB |
Output is correct |
21 |
Correct |
225 ms |
3648 KB |
Output is correct |
22 |
Correct |
193 ms |
3200 KB |
Output is correct |
23 |
Correct |
191 ms |
3260 KB |
Output is correct |
24 |
Correct |
190 ms |
3192 KB |
Output is correct |
25 |
Correct |
203 ms |
3272 KB |
Output is correct |
26 |
Correct |
227 ms |
3684 KB |
Output is correct |