样例过了,自己试了,也过,全WA
查看原帖
样例过了,自己试了,也过,全WA
1271339
Lukas_gaoxi_yan楼主2024/8/15 09:21
#include<bits/stdc++.h>
using namespace std;
long long p,x_0,y_0,x_1,y_1; 
int main(){
	cin>>p>>x_0>>y_0>>x_1>>y_1;
	if(p==2){
		cout<<"NO"; 
		return 0;
	}
	if(p==1){
		if(x_0==x_1||y_0==y_1){
			cout<<"YES";
		}
		else{
			cout<<"NO";
		}
	}
	if(p==3){
		if(x_0+2==x_1&&y_0+1==y_1||x_0+2==x_1&&y_0-1==y_1||x_0-2==x_1&&y_0+1==y_1||x_0-2==x_1&&y_0-1==y_1||x_0+1==x_1&&y_0+2==y_1||x_0+1==x_1&&y_0-2==y_1||x_0-1==x_1&&y_0+2==y_1||x_0-1==x_1&&y_0-2==y_1){
			cout<<"YES";
		}
		else{
			cout<<"NO";
		}
	}
	if(p==4){
		if(x_0+2==x_1&&y_0+2==y_1||x_0+2==x_1&&y_0-2==y_1||x_0-2==x_1&&y_0+2==y_1||x_0-2==x_1&&y_0-2==y_1){
			cout<<"YES";
		}
		else{
			cout<<"NO";
		}
	}
	return 0;
}
2024/8/15 09:21
加载中...