# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
130477 |
2019-07-15T09:43:38 Z |
neki |
Sure Bet (CEOI17_sure) |
C++14 |
|
2 ms |
256 KB |
#include <bits/stdc++.h>
#define loop(i, a, b) for(int i=a;i<b;i++)
#define cc(a) cout<< a << endl;
using namespace std;
int main() {
int n; cin >> n;
vector<double> arr, brr;arr.resize(n),brr.resize(n);
loop(i, 0, n) cin >> arr[i]>>brr[i];
sort(arr.begin(), arr.end(), greater<double>());
sort(brr.begin(), brr.end(), greater<double>());
loop(i, 1, n) arr[i]+=arr[i-1];
loop(i, 1, n) brr[i]+=brr[i-1];
double ans=0;
loop(i, 0, n) ans=max(ans, arr[i]-2-i-(lower_bound(brr.begin(), brr.end(), arr[i])-brr.begin()));
loop(i, 0, n) ans=max(ans, brr[i]-2-i-(lower_bound(arr.begin(), arr.end(), brr[i])-arr.begin()));
printf("%.4lf", ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |