HDU 5762 [简单复杂度分析]
来源:互联网 发布:短信轰炸软件免费版 编辑:程序博客网 时间:2024/05/16 06:43
Description
给定
Solution
曼哈顿距离的个数应该也是
#include <bits/stdc++.h>using namespace std;const int N = 201010;inline char get(void) { static char buf[100000], *S = buf, *T = buf; if (S == T) { T = (S = buf) + fread(buf, 1, 100000, stdin); if (S == T) return EOF; } return *S++;}inline void read(int &x) { static char c; x = 0; for (c = get(); c < '0' || c > '9'; c = get()); for (; c >= '0' && c <= '9'; c = get()) x = x * 10 + c - '0';}int test, n, m, d, ans;struct Point { int x, y; Point (int _x = 0, int _y = 0):x(_x), y(_y) {}};Point a[N];int vis[N];inline int Dis(Point &a, Point &b) { return fabs(a.x - b.x) + fabs(a.y - b.y);}int main(void) { freopen("1.in", "r", stdin); read(test); for (int t = 1; t <= test; t++) { read(n); read(m); ans = 0; for (int i = 1; i <= n; i++) { read(a[i].x); read(a[i].y); } for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { d = Dis(a[i], a[j]); if (vis[d] == t) { ans = 1; break; } vis[d] = t; } if (ans) break; } puts(ans ? "YES" : "NO"); }}
阅读全文
2 0
- HDU 5762 [简单复杂度分析]
- [复杂度分析+暴力] HDU 5762 Teacher Bo 题解
- 欧几里得算法时间复杂度简单分析
- [杂题 简单复杂度分析]HDU5762. Teacher Bo
- 复杂度分析
- 对一个简单递归的 时间复杂度的分析
- 比较排序算法的简单介绍和复杂度分析
- 复杂度分析(1)-渐进复杂度,空间复杂度
- 时间复杂度&空间复杂度分析
- hdu 5778 算复杂度
- 算法复杂度分析
- 算法复杂度分析
- 算法复杂度分析
- 算法复杂度分析
- STL_list_sort算法复杂度分析
- 时间复杂度分析
- (转载)算法复杂度分析
- 算法时间复杂度分析
- Ubuntu中Apache2启动失败报错Job for apache2.service failed because the cont...
- nginx安装并安装Lua模块
- 将String字符串中的数字和运算符输出
- 流程引擎调研 业务系统中使用流程引擎 疑问中
- 原型模式(Prototype)
- HDU 5762 [简单复杂度分析]
- 在cmd中使用cd命令切不到D盘
- 全卷积网络(FCN)与图像分割
- 感受
- Android-仿今日头条评论
- artTemplate和uEditor编辑器的问题
- 基础练习 BASIC-6 杨辉三角形
- Day8
- 更新式中值滤波算法