QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#470461 | #6401. Classic: N Real DNA Pots | UESTC_DebugSimulator# | WA | 15ms | 3920kb | C++17 | 781b | 2024-07-10 13:57:39 | 2024-07-10 13:57:39 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 100010
int n,K;
int x[N],y[N];
int check(double k)
{
for(int ci=1;ci<=n;ci++)
{
int cnt=1;
int px=x[ci],py=y[ci];
for(int i=ci+1;i<=n;i++)
{
double nk=(y[i]-py)*1.0/(x[i]-px);
if(nk<=k)
{
cnt++;
px=x[i];py=y[i];
}
}
if(cnt>=K) return 1;
}
return 0;
}
signed main()
{
//freopen("a.in","r",stdin);
//freopen("aa.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>n>>K;
for(int i=1;i<=n;i++)
{
cin>>x[i]>>y[i];
}
double l=-1e9,r=1e9;
for(int i=1;i<=80;i++)
{
double m=(l+r)/2;
if(check(m))
{
r=m;
}
else
{
l=m;
}
}
cout<<setprecision(10)<<l<<"\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3876kb
input:
4 3 1 2 2 4 3 3 4 1
output:
-1
result:
ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
2 2 1 1 5 3
output:
0.5
result:
ok found '0.5000000', expected '0.5000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
2 2 222640995 547139825 489207317 725361095
output:
0.6685813446
result:
ok found '0.6685813', expected '0.6685813', error '0.0000000'
Test #4:
score: -100
Wrong Answer
time: 15ms
memory: 3804kb
input:
1000 20 545612 774435015 828317 212155588 5294705 85926095 5648835 764528941 6159263 570820268 7177330 744079287 8446124 162286636 8735551 586528841 9263030 524140841 9505706 636254627 12111352 182639083 12750780 238494418 13149143 913232250 13382784 11485121 13699797 414697815 14263990 423817548 15...
output:
0.03663278059
result:
wrong answer 1st numbers differ - expected: '3.7932105', found: '0.0366328', error = '0.9903425'