好吧,细节决定成败。
[cpp]
#include
#include
using namespace std;
class runner
{
public:
int meter;
int rank;
};
bool cmp(runner n1,runner n2)
{
return n1.rank
}
int main()
{
int testcase;
cin>>testcase;
while(testcase--)
{
int taoquanshu=0;
runner pack[115];
int maxroute,yu;
int athlete,distance;
cin>>athlete>>distance;
maxroute=(distance/400)-1;
yu=distance%400;
for(int i=0;i
{
cin>>pack[i].meter>>pack[i].rank;
}
sort(pack,pack+athlete,cmp);
for(int j=0;j
{
if(pack[j].meter>pack[j+1].meter)
{
continue;
}
else
{
taoquanshu++;
}
}
if((taoquanshu*400+pack[athlete-1].meter)>distance)
{
cout<<"NO"<
}
else
{
cout<<"YES"<
}
}
return 0;
}