QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#179538 | #6401. Classic: N Real DNA Pots | ucup-team1001 | WA | 1ms | 5776kb | C++20 | 902b | 2023-09-14 22:08:01 | 2023-09-14 22:08:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int n,k;
struct node
{
long double x,y;
bool operator<(node a)
{
return x<a.x;
}
}nod[maxn];
long double d[maxn];
bool check(long double now)
{
for(int i=1;i<=n;i++)
d[i]=1e18;
d[n+1]=1e18;
d[0]=-1e18;
for(int i=0;i<n;i++)
{
long double nowd=nod[i].y-now*nod[i].x;
int p=lower_bound(d,d+n,nowd)-d;
d[p]=nowd;
}
for(int i=n;i>=0;i--)
{
if(d[i]!=d[n+1]&&i>=k)
return 1;
}
return 0;
}
long double solve()
{
long double l=-1e18,r=1e18;
while(r-l>1e-10)
{
long double m=(l+r)/2;
if(check(m))
l=m;
else
r=m;
}
return l;
}
int main()
{
//freopen("1.in","r",stdin);
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>nod[i].x>>nod[i].y;
sort(nod,nod+n);
printf("%0.12lf",solve());
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5776kb
input:
4 3 1 2 2 4 3 3 4 1
output:
0.000000000000
result:
wrong answer 1st numbers differ - expected: '-1.0000000', found: '0.0000000', error = '1.0000000'