# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
879290 |
2023-11-27T05:44:39 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
93 ms |
11968 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define sz size
#define mp make_pair
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(a) a.begin(),a.end()
const int N=1e6+1;
const ll inf=1e18+1;
int n,k=0,mx=0,o=0;
ld v[N*2],d[N*2];
ld bin(int x)
{
int l=0,m,r=x;
while(l+1<r)
{
m=(l+r)>>1;
if(v[m]>=d[x-m])
{
r=m;
}
else
{
l=m;
}
}
return (max(v[r-1],d[x-r])-x);
}
int main()
{
ios
cin>>n;
ld a[n],b[n],ans=0;;
for(int i=0;i<n;++i)
{
cin>>a[i]>>b[i];
}
sort(a,a+n);sort(b,b+n);
v[0]=d[0]=0;
for(int i=0;i<=n*2;++i)
{
v[i+1]=v[i];
d[i+1]=d[i];
if(i<n)
{
v[i+1]+=a[n-i-1];
d[i+1]+=b[n-1-i];
}
}
for(int i=0;i<=n*2;++i)
{
ans=max(ans,bin(i));
}
cout<<fixed<<setprecision(4)<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2552 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2552 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
78 ms |
11792 KB |
Output is correct |
18 |
Correct |
93 ms |
11776 KB |
Output is correct |
19 |
Correct |
81 ms |
11788 KB |
Output is correct |
20 |
Correct |
81 ms |
11788 KB |
Output is correct |
21 |
Correct |
84 ms |
11784 KB |
Output is correct |
22 |
Correct |
78 ms |
11784 KB |
Output is correct |
23 |
Correct |
79 ms |
11860 KB |
Output is correct |
24 |
Correct |
87 ms |
11860 KB |
Output is correct |
25 |
Correct |
83 ms |
11968 KB |
Output is correct |
26 |
Correct |
91 ms |
11768 KB |
Output is correct |