警钟撅烂了也接不到样例第四组
查看原帖
警钟撅烂了也接不到样例第四组
1120678
13288917088c楼主2024/1/11 12:31
#include<bits/stdc++.h>
using namespace std;
struct coin{
	int x,y;
}a[55];
bool cmp(coin x,coin y){
	return x.y<y.y;
}
int g,n,x,t;
bool b;
int main(){
	cin>>g;
	for(int i=0;i<g;i++){
		cin>>n;
		for(int j=0;j<n;j++){
			cin>>a[j].x>>a[j].y;
		}
		sort(a,a+n,cmp);
		b=1;
		for(int j=0;j<n;j++){
			if(t+abs(x-a[j].x)>a[j].y){
				b=0;
				break;
			}
			t=a[j].y;
			x=a[j].x;
		}
		if(b){
			cout<<"Abletocatch\n";
		}else{
			cout<<"Notabletocatch\n";
		}
	}
    return 0;
}
2024/1/11 12:31
加载中...