HDU 5762 Teacher Bo
Teacher Bo
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 752 Accepted Submission(s): 412
If there exists such tetrad,print "YES",else print "NO".
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,Yi)(0≤Xi,Yi≤M).
#include <bits/stdc++.h>
using namespace std; pair<int, int> p[100005];
bool vis[200005]; void solve(int n, int m)
{
memset(vis, 0, sizeof(vis));
for(int i = 0; i < n; ++i){
for(int j = i+1; j < n; ++j){
int dis = abs(p[i].first-p[j].first)+abs(p[i].second-p[j].second);
if(vis[dis]){
puts("YES");
return;
}
else
vis[dis] = true;
}
}
puts("NO");
} int main()
{
int t, n, m;
scanf("%d", &t);
while(t--){
scanf("%d%d", &n, &m);
for(int i = 0; i < n; ++i)
scanf("%d%d", &p[i].first, &p[i].second);
solve(n, m);
}
return 0;
}
HDU 5762 Teacher Bo的更多相关文章
- 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 暴力
Teacher Bo 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 Description Teacher BoBo is a geogra ...
- 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
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5762 题目大意: 给n个点,坐标范围0~m(n,m<=105),求是否存在2个点对满足哈夫曼距 ...
- 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 ( 暴力 )
链接:传送门 题意:给出N个点( Xi , Yi ),和点的最远位置M,询问是否有这样的四个点 (A,B,C,D)(A<B,C<D,A≠CorB≠D) ,AB的曼哈顿路径长度等于CD的曼哈 ...
- HDU 5762
Teacher Bo Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Tot ...
- hdu 5761 Rowe Bo 微分方程
1010 Rower Bo 首先这个题微分方程强解显然是可以的,但是可以发现如果设参比较巧妙就能得到很方便的做法. 先分解v_1v1, 设船到原点的距离是rr,容易列出方程 \frac{ dr} ...
- hdu-5762 Teacher Bo(抽屉原理+暴力)
题目链接: Teacher Bo Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Other ...
随机推荐
- Stateless Iterators
As the name implies, a stateless iterator is an iterator that does not keep any state by itself. The ...
- 【hadoop2.6.0】一句话形容mapreduce
网上看到的: We want to count all the books in the library. You count up shelf #1, I count up shelf #2. Th ...
- http://jingyan.baidu.com/article/08b6a591f0fafc14a9092275.html
http://jingyan.baidu.com/article/08b6a591f0fafc14a9092275.html http://jingyan.baidu.com/article/414e ...
- lintcode: search for a range 搜索区间
题目 搜索区间 给定一个包含 n 个整数的排序数组,找出给定目标值 target 的起始和结束位置. 如果目标值不在数组中,则返回[-1, -1] 样例 给出[5, 7, 7, 8, 8, 10]和目 ...
- lintcode:First Missing Positive 丢失的第一个正整数
题目 丢失的第一个正整数 给出一个无序的整数数组,找出其中没有出现的最小正整数. 样例 如果给出 [1,2,0], return 3 如果给出 [3,4,-1,1], return 2 挑战 只允许时 ...
- SendMessage、PostMessage原理
SendMessage.PostMessage原理 本文讲解SendMessage.PostMessage两个函数的实现原理,分为三个步骤进行讲解,分别适合初级.中级.高级程序员进行理解,三个步骤分别 ...
- iOS 用命令实现简单的打包过程
`xcode-select --print-path`/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication // 获得打包 ...
- 浅析CDN安全
目前CDN技术到处可见.像网宿.蓝讯.加速乐等都依靠CDN过活,连安全宝也都使用了CDN技术,当然很多域名空间商现在也提供CDN服务.从以往互联网的发展上看,CDN是个趋势,很多厂商也都多多少少购买了 ...
- android下activity中多个listview只允许主界面滚动
之前发现了自己的APP在处理两个listview时产生的一个bug.当两个listview中的item数量多出手机屏幕时,listview不能显示完全.一开始觉得只要加一个scrollview就可以了 ...
- Ubuntu链接ubuntu服务器
以前在windows下用ssh工具putty连接 linux服务器, 很简单,在linux下要连接linux的服务器, 找了下,果然putty在linux中也行1,sudo apt-get insta ...