poj 1912 A highway and the seven dwarfs】的更多相关文章

A highway and the seven dwarfs Time Limit: 8000MS   Memory Limit: 30000K Total Submissions: 2622   Accepted: 535 Case Time Limit: 3000MS Description Once upon a time, there was a land where several families of dwarfs were living. This land was called…
[题目链接] http://poj.org/problem?id=1912 [题目大意] 给出一些点,表示一些屋子,这些屋子共同组成了村庄,现在要建一些高速公路 问是否经过了村庄. [题解] 这些屋子的关键点一定在凸包上,所以我们只要求出凸包,判断是否和线相交即可 我们求出与高速公路相近和近似相反的向量,判断连线是否与这条公路相交即可. [代码] #include <cstdio> #include <algorithm> #include <cmath> #inclu…
POJ1912 给定n个点 和若干条直线,判断对于一条直线,是否存在两个点在直线的两侧. 显然原命题等价于 凸包与直线是否相交. O(n)的算法是显而易见的 但是直线数量太多 就会复杂到O(n^2)由于n<=100000 会TLE 凸包有个很好的性质,我们没有利用, 那就是凸包的边相对于要判断的直线是极角有序的! 于是得到算法: 构造好凸包后,二分找凸包上第一个与正向直线夹角大于0的线段和第一个与反向直线夹角大于0的线段 然后判断两线段的起点是否在直线两侧即可. 代码实现有一点注意的细节:不要用…
题目: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <vector> #include <queue> #include <stack> #include <map> #include <algorithm> #include &…
( ̄▽ ̄)" //求最短总路径中的最大边长,Prim还需要一个Max变量 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<vector> #include<queue> using namespace std; ; const int INF=10e8; int k,minn; int c[MAXN][MAX…
题目连接 http://poj.org/problem?id=2485 Highways Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They…
Highways Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1751 Appoint description:  System Crawler  (2015-06-02) Description The island nation of Flatopia is perfectly flat. Unfortunately, Flato…
Highways 题目链接: http://acm.hust.edu.cn/vjudge/contest/124434#problem/G Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware of this problem an…
Fire   Description Country Z has N cities, which are numbered from 1 to N. Cities are connected by highways, and there is exact one path between two different cities. Recently country Z often caught fire, so the government decided to build some fireh…
Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is aware of this problem. They're planning to build some highways so that i…