题目链接 POJ-3608 Bridge Across Islands 题意 依次按逆时针方向给出凸包,在两个凸包小岛之间造桥,求最小距离. 题解 旋转卡壳的应用之一:求两凸包的最近距离. 找到凸包 p 的 y 值最小点 yminP 和 q 的 y 值最大点ymaxQ,然后分别做切线如图. 那么\(AC\times AD> AC\times AB\)则说明B还不是离AC最近的点,所以++ymaxQ. 否则用 \(AC\) 和 \(BD\) 两个线段的距离更新最近距离,并且++yminP,即考察P…
题目:Bridge Across Islands 分析:以下内容来自:http://blog.csdn.net/acmaker/article/details/3178696 考虑如下的算法, 算法的输入是两个分别有m和n个顺时针给定顶点的凸多边形P和Q. 1.计算P上y坐标值最小的顶点(称为 yminP )和Q上y坐标值最大的顶点(称为 ymaxQ). 2.为多边形在 yminP 和 ymaxQ 处构造两条切线 LP 和 LQ 使得他们对应的多边形位于他们的右侧.   此时 LP 和 LQ 拥…
Bridge Across Islands Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7202   Accepted: 2113   Special Judge Description Thousands of thousands years ago there was a small kingdom located in the middle of the Pacific Ocean. The territory…
Bridge Across Islands Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10455   Accepted: 3093   Special Judge Description Thousands of thousands years ago there was a small kingdom located in the middle of the Pacific Ocean. The territory…
题目链接:http://poj.org/problem?id=3608 #include<cstdio> #include<cstring> #include<cmath> #include<iostream> #include<algorithm> #include<queue> using namespace std; ; ; const int INF = 0x3f3f3f; ; const double PI = acos(-…
Bridge Across Islands Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9768   Accepted: 2866   Special Judge Description Thousands of thousands years ago there was a small kingdom located in the middle of the Pacific Ocean. The territory…
#include <iostream> #include <cmath> #include <vector> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <algorithm> using namespace std; #define MAX_N 110 /*------------------常量区----------------…
给定平面上的一些散点集,求最远两点距离的平方值. 题解: 旋转卡壳求出凸包,然后根据单调性,求出最远两点的最大距离 #pragma GCC optimize(2) #pragma G++ optimize(2) #include<cstring> #include<cmath> #include<iostream> #include<algorithm> #include<cstdio> #define eps 0.00000001 #defin…
0前言 感谢yxy童鞋的dp及暴力做法! 1 算法标签 优先队列.dp动态规划+滚动数组优化 2 题目难度 提高/提高+ CF rating:2300 3 题面 「POJ 3666」Making the Grade 路面修整 4 分析题面 4.1 简要描述 给出数列 \(A\), 求非严格单调不上升或单调不下降, 且\(S=\sum^N_{i=1}|A_i-B_i|\) 最小的序列\(B\),输出\(S\) 4.2 模型转换 输入\(N\), 然后输入\(N\)个数,求最小的改动这些数使之成非严…
链接: http://poj.org/problem?id=2187 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=22013#problem/E Beauty Contest Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 24254   Accepted: 7403 Description Bessie, Farmer John's prize cow, h…