hdu-5762 Teacher Bo(抽屉原理+暴力)
题目链接:
Teacher Bo
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 324 Accepted Submission(s): 175
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 <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>
#include <stack> using namespace std; #define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss)); typedef unsigned long long LL; template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {
if(!p) { puts("0"); return; }
while(p) stk[++ tp] = p%10, p/=10;
while(tp) putchar(stk[tp--] + '0');
putchar('\n');
} const LL mod=1e9+7;
const double PI=acos(-1.0);
const int inf=1e9;
const int N=1e5+10;
const int maxn=1000+10;
const double eps=1e-8; int n,m,vis[2*N]; struct node
{
int x,y;
}po[N];
int check()
{
For(i,1,n)
{
For(j,i+1,n)
{
int dis=abs(po[i].x-po[j].x)+abs(po[i].y-po[j].y);
if(vis[dis])return 1;
vis[dis]=1;
}
}
return 0;
}
int main()
{
int t;
read(t);
while(t--)
{
read(n);read(m);
For(i,0,2*m+1)vis[i]=0;
For(i,1,n)
{
read(po[i].x);read(po[i].y);
}
if(check())printf("YES\n");
else printf("NO\n");
}
return 0;
}
hdu-5762 Teacher Bo(抽屉原理+暴力)的更多相关文章
- 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 题目连接: 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
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的曼哈 ...
- HDU 5776 sum(抽屉原理)
题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=5776 Problem Description Given a sequence, you're ask ...
- hdu 1205 吃糖果 (抽屉原理<鸽笼原理>)
吃糖果Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submissi ...
随机推荐
- RNN推导
http://www.cnblogs.com/YiXiaoZhou/p/6058890.html RNN求解过程推导与实现 RNN LSTM BPTT matlab code opencv code ...
- Spin.js-CSS动画进度载入器
spin.js是一款很easy的CSS载入器,他是一款使用了VML(Vector Makeup Language)的CSS动画效果. spin.js的特性 他有着很强大的适应性.有着下面几个特性: 1 ...
- 编写自己的UDTF
1. UDTF介绍 UDTF(User-Defined Table-Generating Functions) 用来解决 输入一行输出多行(On-to-many maping) 的需求. 2. 编写自 ...
- 【LeetCode】Word Break 解题报告
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separa ...
- windows 平台 ffmeg h264 硬编码
本文讲述windows 平台下ffmpeg如何利用intel media SDK 进行 h264硬编码(测试版本为3.2.2). ffmeg硬编编码的流程与软件编码流程相同,唯一不同的地方在初始化en ...
- Python+Selenium框架-unittest执行脚本方法之addTest
本文开始介绍如何通过unittest来管理和执行测试用例,这一篇介绍unittest下addTest()方法来加载测试用例到测试套件中去.为了演示效果,我在前面文章的脚本基础上,新建了一个测试脚本,这 ...
- 汇率换算自然语言理解功能JAVA DEMO
>>>>>>>>>>>>>>>>>>>>>>>> 欢迎转 ...
- iOS移动开发周报-第17期
lhq iOS移动开发周报-第17期 前言 欢迎国内的iOS同行或技术作者向我提交周报线索,线索可以是新闻.教程.开发工具或开源项目,将相关文章的简介和链接在微博上发布并 @唐巧_boy 即可. [摘 ...
- SpringMVC学习(一):搭建SpringMVC-注解-非注解
文章参考:http://www.cnblogs.com/Sinte-Beuve/p/5730553.html 一.环境搭建: 目录结构: 引用的JAR包: 如果是Maven搭建的话pom.xml配置依 ...
- 深入Garbage First垃圾收集器(一)术语
Garbage垃圾收集器的原理,在这篇博客中有讲到,可以拿来参考下, Getting Started with the G1 Garbage Collector(译) 另外在这篇博客中也有讲到很多垃圾 ...