# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
121252 |
2019-06-26T09:10:01 Z |
miguel |
Sure Bet (CEOI17_sure) |
C++14 |
|
149 ms |
3664 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<double>
#define pb push_back
#define INF 1e9+7
int n;
vi a, b;
int main(){
cin>>n;
//cin.tie(0); //random_device dev;
//mt19937 rng(dev());
//uniform_int_distribution<std::mt19937::result_type> dist6(5,6);
//srand((unsigned)time(0));
//int i;
//i=(rand()%2)+5;
a.pb(INF); b.pb(INF);
for(int i=1; i<=n; i++){
double x,y;
cin>>x>>y;
a.pb(x);
b.pb(y);
}
sort(a.begin(), a.end(), greater<double>());
sort(b.begin(), b.end(), greater<double>());
//for(int i=1; i<=n; i++) cout<<a[i]<<" ";cout<<endl;
a[0]=0; b[0]=0;
for(int i=1; i<=n; i++){
a[i]+=a[i-1];
}
for(int i=1; i<=n; i++){
b[i]+=b[i-1];
}
double mx=0;
for(double x=0, y=0; x<=n && y<=n;){
if(a[x]<b[y]){
x++;
}
else y++;
mx=max(mx, min(a[x]-x-y, b[y]-x-y));
//cout<<x<<" "<<y<<" "<<min(a[x]-x-y, b[y]-x-y)<<endl;
}
printf("%.4lf",(double)mx);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
6 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
6 ms |
384 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
133 ms |
2100 KB |
Output is correct |
18 |
Correct |
136 ms |
3664 KB |
Output is correct |
19 |
Correct |
133 ms |
3464 KB |
Output is correct |
20 |
Correct |
129 ms |
3428 KB |
Output is correct |
21 |
Correct |
149 ms |
3620 KB |
Output is correct |
22 |
Correct |
133 ms |
3460 KB |
Output is correct |
23 |
Correct |
135 ms |
3512 KB |
Output is correct |
24 |
Correct |
131 ms |
3428 KB |
Output is correct |
25 |
Correct |
129 ms |
3416 KB |
Output is correct |
26 |
Correct |
147 ms |
3592 KB |
Output is correct |