P2694 接金币 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
#include<bits/stdc++.h>
using namespace std;
struct node
{
int x,y;
}a[60];
bool cmp(node a,node b)
{
return a.y < b.y;//y坐标小的在前面
}
int main()
{
int g,n;
scanf("%d",&g);
while(g--)
{
memset(a,0,sizeof(a));//数组初始化
scanf("%d",&n);
for(int i = 1; i <= n; i++)
scanf("%d%d",&a[i].x,&a[i].y);
sort(a + 1, a + 1 + n, cmp);
int flag = 0;
for(int i = 1; i <= n; i++)
{
if(abs(a[i].x - a[i-1].x) > a[i].y - a[i-1].y)
{
flag = 1;
cout << "Notabletocatch" << endl;
break;
}
}
if(flag == 0) cout << "Abletocatch" << endl;
}
return 0;
}