#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const double eps=1e-6;
struct counts{
int a,b,num;
double c,d;
}a[250];
int n,r1[250],r2[250],r3[250],r4[250],m;
bool cmp1(const counts &x,const counts &y)
{
return x.a>y.a;
}
bool cmp2(const counts &x,const counts &y)
{
return x.b>y.b;
}
bool cmp3(const counts &x,const counts &y)
{
return x.c>y.c;
}
bool cmp4(const counts &x,const counts &y)
{
return x.d>y.d;
}
int main()
{
cin>>n>>m;
for(int i=1,p;i<=n;i++)
{
cin>>a[i].a>>a[i].b>>p;
a[i].c=(double)a[i].a/p;
a[i].d=(double)a[i].b/p;
a[i].num=i;
}
sort(a+1,a+1+n,cmp1);
int ans=1;
for(int i=1;i<=n;i++)
{
if(a[i].a<a[i-1].a)
ans=i;
r1[a[i].num]=ans;
}
sort(a+1,a+1+n,cmp2);
ans=1;
for(int i=1;i<=n;i++)
{
if(a[i].b<a[i-1].b)
ans=i;
r2[a[i].num]=ans;
}
sort(a+1,a+1+n,cmp3);
ans=1;
for(int i=1;i<=n;i++)
{
if(a[i-1].c-a[i].c>eps)
ans=i;
r3[a[i].num]=ans;
}
sort(a+1,a+1+n,cmp4);
ans=1;
for(int i=1;i<=n;i++)
{
if(a[i-1].d-a[i].d>eps)
ans=i;
r4[a[i].num]=ans;
}
for(int i=1,j;i<=m;i++)
{
if(i>1) cout<<' ';
cin>>j;
j++;
int ac=min(r1[j],min(r2[j],min(r3[j],r4[j])));
cout<<ac<<':';
if(ac==r1[j])
cout<<1;
else if(ac==r2[j])
cout<<2;
else if(ac==r3[j])
cout<<3;
else
cout<<4;
}
return 0;
}
7-16 奥运排行榜
最新推荐文章于 2024-11-03 22:57:39 发布