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 ...
随机推荐
- 数字信号处理实验(一)——DTFT
1.MATLAB自编绘图函数 function [] = signal_write(X,w,flag) % X:数据 % w:频率向量 magX=abs(X);angX=angle(X); realX ...
- 最值得学习的10个C语言开源项目
最好别下载最新版,因为代码量比较大,可以下载很早的版本 搜索词:开源 C Webbench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我 ...
- Attribute在.net编程中的应用
Attribute FYI Link: Attribute在.net编程中的应用(一) Attribute在.net编程中的应用(二) Attribute在.net编程中的应用(三) Attribut ...
- jquery replace用法汇总
//只替换匹配到的第一个目标 var str="Visit Microsoft! Microsoft"document.write(str.replace(/Microsoft/, ...
- 用padding与margin做多个元素的等间距分布
这样做的好处是不管有多少个元素等间距分布,都可以直接写在li中,而且由于是给a设定的样式,所以在字数不一致的情况下,样式仍然是统一的. html: <!DOCTYPE html> < ...
- express-2 express介绍
脚手架 大多数项目都需要一定数量的"套路化"代码,所有可以创建一个通用的项目骨架,每次开始新项目时,只需复制这个骨架,或者说是模板. RoR把这个概念向前推进了一步,它提供了一个可 ...
- .NET开源项目常用记录
综合类 微软企业库 微软官方出品,是为了协助开发商解决企业级应用开发过程中所面临的一系列共性的问题, 如安全(Security).日志(Logging).数据访问(Data Access).配置管理( ...
- Python学习笔记02
元组:圆括号的,不能进行赋值操作,即不可更改. 列表:方括号的,可以修改. 访问:均使用下标访问 # 元组是一个静态列表,初始化之后就不可以修改,可以试任意类型 tuple1 = ('a st ...
- jQuery入门第二天
3种选择器:元素选择器:$("button").class选择器:$(".btn").id选择器:$("#target1"). <sc ...
- HDU5724 Chess(SG定理)
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5724 Description Alice and Bob are playing a spe ...