# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
614121 |
2022-07-30T19:15:21 Z |
lanmi7 |
Sure Bet (CEOI17_sure) |
C++14 |
|
123 ms |
3784 KB |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int N, ima_a = 0, ima_b = 0;
double a, b, rez = 0, suma_a = 0, suma_b = 0;
cin >> N;
vector <double> A;
vector <double> B;
for(int i = 1; i <= N; i++) {cin >> a >> b; A.push_back(a); B.push_back(b);}
sort(A.rbegin(), A.rend());
sort(B.rbegin(), B.rend());
for(int i = 0; i < 2*N; i++)
{
if(ima_a == N)
{
suma_b += B[ima_b];
ima_b++;
}
else if(ima_b == N)
{
suma_a += A[ima_a];
ima_a++;
}
else
{
if(suma_a > suma_b)
{
suma_b += B[ima_b];
ima_b++;
}
else
{
suma_a += A[ima_a];
ima_a++;
}
}
rez = max(rez, min(suma_a-i-1, suma_b-i-1));
}
cout << fixed << setprecision(4) << rez;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
324 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
2 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
316 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
324 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
2 ms |
328 KB |
Output is correct |
17 |
Correct |
80 ms |
3344 KB |
Output is correct |
18 |
Correct |
86 ms |
3380 KB |
Output is correct |
19 |
Correct |
72 ms |
3404 KB |
Output is correct |
20 |
Correct |
73 ms |
3448 KB |
Output is correct |
21 |
Correct |
82 ms |
3768 KB |
Output is correct |
22 |
Correct |
81 ms |
3440 KB |
Output is correct |
23 |
Correct |
70 ms |
3344 KB |
Output is correct |
24 |
Correct |
71 ms |
3384 KB |
Output is correct |
25 |
Correct |
72 ms |
3452 KB |
Output is correct |
26 |
Correct |
123 ms |
3784 KB |
Output is correct |