QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106160#6401. Classic: N Real DNA Pots4_ss#WA 3ms3740kbC++171.0kb2023-05-16 19:04:252023-05-16 19:04:27

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-16 19:04:27]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3740kb
  • [2023-05-16 19:04:25]
  • 提交

answer

#include<bits/stdc++.h>

#define x first
#define y second
#define void inline void
#define int long long

using namespace std;

typedef pair<int,int> PII;

const int N = 2e6 + 10;

map<PII,int> mp;

int t,k,n,m;
double ans = -N;
vector<PII>v,tree;
set<double>o;
void DFS(int start)
{
	if((int)tree.size() == k)
	{
		for(int i = 0;i < k;++i)
		{
			for(int j = 0;j < k;++j)
			{
				if(i == j) continue;
				double num = ((double)(tree[i].y - tree[j].y)) / ((double)(tree[i].x - tree[j].x));
//				cout << "k = " << num << endl;
				o.insert(num);
			}
		}
		return ;
	}
	for(int i = start;i < v.size();++i)
	{
		tree.push_back(v[i]);
		DFS(i + 1);
		tree.pop_back();
	}
	return ;
}
double poi = 1e5+10;

signed main()
{
	cin >> t >> k;
	while(t--)
	{
		int x,y;
		cin >> x >> y;
		v.push_back({x,y});
	}
//	system("cls");
	DFS(0);
	int pos = 0;
	for(set<double>::iterator i = o.begin();i != o.end();++i,pos++)
	{
		if(pos == k) break;
		ans = max(ans,*i);
	}
	printf("%.1lf",ans);

	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3572kb

input:

4 3
1 2
2 4
3 3
4 1

output:

-1.0

result:

ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3740kb

input:

2 2
1 1
5 3

output:

0.5

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3568kb

input:

2 2
222640995 547139825
489207317 725361095

output:

0.7

result:

wrong answer 1st numbers differ - expected: '0.6685813', found: '0.7000000', error = '0.0314187'