HDU 5762
Teacher Bo
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1052 Accepted Submission(s): 582
points in the map,the i
-th point is at (X
.He wonders,whether there is a tetrad (A,B,C,D)(A<B,C<D,A≠CorB≠D)
such that the manhattan distance between A and B is equal to the manhattan distance between C and D.
If there exists such tetrad,print "YES",else print "NO".
. There are T
test cases.(T≤50)
In each test case,the first line contains two intergers, N, M, means the number of points and the range of the coordinates.(N,M≤105
)
.
Next N lines, the i
-th line shows the coordinate of the i
-th point.(Xi
,Y
i
)(0≤X
i
,Y
i
≤M)
.
lines, each line is "YES" or "NO".
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<queue>
using namespace std;
struct point
{
int x,y;
};
int main()
{
int n,m,t;
cin>>t;
while(t--)
{
point p[];
int dis[];
cin>>n>>m;
for(int i=;i<n;i++)
{
cin>>p[i].x>>p[i].y;
}
int flag=;
memset(dis,,sizeof(dis));
for(int i=;i<n;i++)
{
for(int j=i+;j<n;j++)
{
int tem=abs(p[i].x-p[j].x)+abs(p[i].y-p[j].y);
if(dis[tem]==)
{
flag=;
break;
}
dis[tem]=;
}
if(flag==)
{
cout<<"YES"<<endl;
break;
}
}
if(flag==) cout<<"NO"<<endl;
}
return ;
}
HDU 5762的更多相关文章
- HDU 5762 Teacher Bo (暴力)
Teacher Bo 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
- 【模拟】HDU 5762 Teacher Bo
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 题目大意: 给n个点,坐标范围0~m(n,m<=105),求是否存在2个点对满足哈夫曼距 ...
- hdu 5762 Teacher Bo 暴力
Teacher Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
- HDU 5762 Teacher Bo (鸽笼原理) 2016杭电多校联合第三场
题目:传送门. 题意:平面上有n个点,问是否存在四个点 (A,B,C,D)(A<B,C<D,A≠CorB≠D)使得AB的横纵坐标差的绝对值的和等于CD的横纵坐标差的绝对值的和,n<1 ...
- hdu 5762 Teacher Bo 曼哈顿路径
Teacher Bo Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tota ...
- HDU 5762 Teacher Bo
Teacher Bo Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Tota ...
- HDU 5762 Teacher Bo ( 暴力 )
链接:传送门 题意:给出N个点( Xi , Yi ),和点的最远位置M,询问是否有这样的四个点 (A,B,C,D)(A<B,C<D,A≠CorB≠D) ,AB的曼哈顿路径长度等于CD的曼哈 ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
随机推荐
- Android基本认识
AndroidManifest.xml file missing! 是因为开始想当然的用中文当project名 no launcher activity found 第一次运行出了点问题,no lau ...
- Arduino101学习笔记(二)—— 一些注意的语法点
1.宏定义 2.整数常量 3.支持C++ String类 (1)String 方法 charAt() compareTo() concat() endsWith() equals() equalsIg ...
- eclipse文本域内只能输入繁体中文
背景:在文本编辑器下写纯文本时不知怎么回事儿,原来能输入简体字,但过了之后只能输入繁体中文了!我用的是sogou拼音输入法,我检查过,输入法设置的是简体中文,eclipse默认的编码方式是utf-8. ...
- Android学习系列(42)--Android Studio实战技巧
使用android studio开发项目的一些问题,功能和技巧. 1. 环境 Mac OSX 10.9.5 + Android Studio 0.8.9 2. gradle项目加载超慢 这是因为gra ...
- loopback 04
数据库相关 关系定义 relationship 定义关系之后的使用 relations: { "images": { "type": "hasMany ...
- css布局2
居中 常用居中 elemP{ text-align: center; } elelmP elemC{ display: inline-block; } elemP{ display: table; m ...
- 【虚拟机】苹果虚拟机mac10.11.6+Xcode8.1
[虚拟机]苹果虚拟机mac10.11.6+Xcode8.1本虚拟机加装Xcode8.1,方便大家更好学习Swift3.0语言以及iOS开发.安装注意事项:第一步:确认硬件:1.确认主板以及cpu支持虚 ...
- Color the ball(线段树)
Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission( ...
- Rock-Paper-Scissors Tournament[HDU1148]
Rock-Paper-Scissors TournamentTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Ja ...
- FastDFS 自动部署和配置脚本
写了一个自动安装和配置FastDFS的脚本,还没有写好关于nginx的配置.先贴上,如下: 自动安装FastDFS,(这部分是之前同事写好的) #!/bin/bash #instll gcc echo ...