QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#470456#6401. Classic: N Real DNA PotsUESTC_DebugSimulator#WA 0ms3816kbC++17722b2024-07-10 13:55:552024-07-10 13:55:55

Judging History

你现在查看的是最新测评结果

  • [2024-07-10 13:55:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-07-10 13:55:55]
  • 提交

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)
{
	int cnt=1;
	double nk=0;
	for(int ci=1;ci<=n;ci++)
	{
		int px=x[ci],py=y[ci];
		for(int i=ci+1;i<=n;i++)
		{
			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()
{
	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;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3816kb

input:

4 3
1 2
2 4
3 3
4 1

output:

-1.5

result:

wrong answer 1st numbers differ - expected: '-1.0000000', found: '-1.5000000', error = '0.5000000'