# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
142997 |
2019-08-12T14:33:05 Z |
Milki |
Sure Bet (CEOI17_sure) |
C++14 |
|
2 ms |
376 KB |
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl
typedef long long ll;
typedef pair<int, int> point;
const int MAXN = 1e5 + 5;
int n;
double a[MAXN], b[MAXN];
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n;
REP(i, n){
cin >> a[i] >> b[i];
}
sort(a, a + n, greater<double>());
sort(b, b + n, greater<double>());
double sol = 0;
double lt = 0, rt = 0;
int pnt = 0, total = 0;
REP(i, n){
lt += a[i];
total ++;
while(pnt < n && lt > rt){
rt += b[pnt];
pnt ++;
total ++;
sol = max(sol, min(lt, rt) - total);
}
sol = max(sol, min(lt, rt) - total);
}
cout << setprecision(4) << fixed << sol;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |