QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106160 | #6401. Classic: N Real DNA Pots | 4_ss# | WA | 3ms | 3740kb | C++17 | 1.0kb | 2023-05-16 19:04:25 | 2023-05-16 19:04:27 |
Judging History
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'