# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
46943 |
2018-04-25T09:25:48 Z |
dqhungdl |
Sure Bet (CEOI17_sure) |
C++17 |
|
130 ms |
16832 KB |
#include <bits/stdc++.h>
using namespace std;
const double EXP=1e-6;
int T,m=0,n=0;
double a[100005],b[100005];
bool Check(double lim)
{
for(int i=1;i<=m;i++)
{
int lim2=min(int(max(a[i]-lim,0.0)),n);
if(b[lim2]-double(i)>=lim)
return true;
}
return false;
}
int main()
{
ios_base::sync_with_stdio(false);
//freopen("TEST.INP","r",stdin);
cin>>T;
double x,y;
while(T--)
{
cin>>x>>y;
if(x>=1.0)
a[++m]=x-1.0;
if(y>=1)
b[++n]=y-1.0;
}
sort(a+1,a+m+1,greater<double>());
sort(b+1,b+n+1,greater<double>());
for(int i=1;i<=m;i++)
a[i]+=a[i-1];
for(int i=1;i<=n;i++)
b[i]+=b[i-1];
double res,l=0,r=1e9;
while(r-l>=EXP)
{
double mid=(l+r)/2.0;
if(Check(mid)==true)
{
res=mid;
l=mid+EXP;
}
else
r=mid-EXP;
}
cout<<setprecision(4)<<fixed<<res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
420 KB |
Output is correct |
5 |
Correct |
2 ms |
476 KB |
Output is correct |
6 |
Correct |
2 ms |
480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
420 KB |
Output is correct |
5 |
Correct |
2 ms |
476 KB |
Output is correct |
6 |
Correct |
2 ms |
480 KB |
Output is correct |
7 |
Correct |
2 ms |
484 KB |
Output is correct |
8 |
Correct |
2 ms |
616 KB |
Output is correct |
9 |
Correct |
2 ms |
660 KB |
Output is correct |
10 |
Correct |
2 ms |
660 KB |
Output is correct |
11 |
Correct |
2 ms |
716 KB |
Output is correct |
12 |
Correct |
3 ms |
720 KB |
Output is correct |
13 |
Correct |
3 ms |
864 KB |
Output is correct |
14 |
Correct |
3 ms |
864 KB |
Output is correct |
15 |
Correct |
3 ms |
864 KB |
Output is correct |
16 |
Correct |
3 ms |
864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
2 ms |
416 KB |
Output is correct |
4 |
Correct |
2 ms |
420 KB |
Output is correct |
5 |
Correct |
2 ms |
476 KB |
Output is correct |
6 |
Correct |
2 ms |
480 KB |
Output is correct |
7 |
Correct |
2 ms |
484 KB |
Output is correct |
8 |
Correct |
2 ms |
616 KB |
Output is correct |
9 |
Correct |
2 ms |
660 KB |
Output is correct |
10 |
Correct |
2 ms |
660 KB |
Output is correct |
11 |
Correct |
2 ms |
716 KB |
Output is correct |
12 |
Correct |
3 ms |
720 KB |
Output is correct |
13 |
Correct |
3 ms |
864 KB |
Output is correct |
14 |
Correct |
3 ms |
864 KB |
Output is correct |
15 |
Correct |
3 ms |
864 KB |
Output is correct |
16 |
Correct |
3 ms |
864 KB |
Output is correct |
17 |
Correct |
110 ms |
3832 KB |
Output is correct |
18 |
Correct |
111 ms |
5076 KB |
Output is correct |
19 |
Correct |
112 ms |
6704 KB |
Output is correct |
20 |
Correct |
113 ms |
7956 KB |
Output is correct |
21 |
Correct |
130 ms |
9596 KB |
Output is correct |
22 |
Correct |
107 ms |
10952 KB |
Output is correct |
23 |
Correct |
108 ms |
12448 KB |
Output is correct |
24 |
Correct |
114 ms |
13928 KB |
Output is correct |
25 |
Correct |
110 ms |
15200 KB |
Output is correct |
26 |
Correct |
117 ms |
16832 KB |
Output is correct |