# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
963516 |
2024-04-15T08:37:05 Z |
LucaIlie |
Sure Bet (CEOI17_sure) |
C++17 |
|
113 ms |
3668 KB |
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
#define nmax 100001
#define mod 10000
double a[nmax], b[nmax];
int main()
{
int n, i, ia, ib;
double maxx, sa, sb;
cin >> n;
for( i = 1; i <= n; i++ )
cin >> a[i] >> b[i];
sort( a + 1, a + n + 1 );
sort( b + 1, b + n + 1 );
ia = ib = n ;
sa = sb = maxx = 0;
while( ia > 0 || ib > 0 ) {
if( ib == 0 || min(sa + a[ia] - 1, sb - 1) > min(sa - 1, sb + b[ib] - 1) ) {
maxx = max( maxx, min(sa + a[ia] - 1, sb - 1));
sa += a[ia] - 1;
sb -= 1;
ia--;
} else {
maxx = max( maxx, min(sa - 1, sb + b[ib] - 1));
sa += - 1;
sb += b[ib] - 1;
ib--;
}
//cout << maxx << " " << ia << " " << sa << " " << ib << " " << sb << "\n";
}
cout << fixed << setprecision( 4 ) << maxx;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
2 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
92 ms |
3296 KB |
Output is correct |
18 |
Correct |
90 ms |
3152 KB |
Output is correct |
19 |
Correct |
100 ms |
3516 KB |
Output is correct |
20 |
Correct |
113 ms |
3332 KB |
Output is correct |
21 |
Correct |
102 ms |
3664 KB |
Output is correct |
22 |
Correct |
91 ms |
3336 KB |
Output is correct |
23 |
Correct |
113 ms |
3200 KB |
Output is correct |
24 |
Correct |
92 ms |
3340 KB |
Output is correct |
25 |
Correct |
90 ms |
3348 KB |
Output is correct |
26 |
Correct |
101 ms |
3668 KB |
Output is correct |