# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1085409 |
2024-09-08T08:11:35 Z |
juicy |
Sure Bet (CEOI17_sure) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
int n; cin >> n;
vector<double> a(n), b(n);
for (int i = 0; i < n; ++i) {
cin >> a[i] >> b[i];
}
sort(a.rbegin(), a.rend());
sort(b.rbegin(), b.rend());
double res = 0, A = 0, B = 0;
for (int i = 0, j = 0; i < n && j < n; ) {
if (A < B) {
A += a[i++];
} else {
B += b[j++];
}
res = max(res, min(A, B) - i - j);
}
cout << fixed << setprecision(4) << res;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |