POJ 2187 Beauty Contest(凸包)

c++洗盘子 栈 以较为通俗,容易理解的语言让人听懂;以较为完整,仔细详细的语言让人理解 我是nameQWQ_优快云. 废话不多说(废话),切入正题。 题目描述 洗盘子 Bessie和Canmuu将联手洗掉N (1<= N< = 10,000)个脏盘子。Bessie负责洗盘子,Canmuu来擦干它们。 每个盘子有一个指定的编号,范围1..N。开始,所有盘子按顺序排列在栈中,1号盘子在顶端,N号盘子在底端。 Bessie会先洗一些盘子,然后放在洗过的盘子栈里(这样原来... 阅读详情
Beauty Contest
Time Limit: 3000MS Memory Limit: 65536K
Total Submissions: 34900 Accepted: 10800

Description

Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) farms around the world in order to spread goodwill between farmers and their cows. For simplicity, the world will be represented as a two-dimensional plane, where each farm is located at a pair of integer coordinates (x,y), each having a value in the range -10,000 ... 10,000. No two farms share the same pair of coordinates. 

Even though Bessie travels directly in a straight line between pairs of farms, the distance between some farms can be quite large, so she wants to bring a suitcase full of hay with her so she has enough food to eat on each leg of her journey. Since Bessie refills her suitcase at every farm she visits, she wants to determine the maximum possible distance she might need to travel so she knows the size of suitcase she must bring.Help Bessie by computing the maximum distance among all pairs of farms. 

Input

* Line 1: A single integer, N 

* Lines 2..N+1: Two space-separated integers x and y specifying coordinate of each farm 

Output

* Line 1: A single integer that is the squared distance between the pair of farms that are farthest apart from each other. 

Sample Input

4
0 0
0 1
1 1
1 0

Sample Output

2

Hint

Farm 1 (0, 0) and farm 3 (1, 1) have the longest distance (square root of 2) 

Source

USACO 2003 Fall


大体题意:给出n个点,求相距最远的两个点之间距离的平方。

思路:凸包的模板题,相距最远的点肯定在所求凸包的边界上,所以求出凸包后枚举即可。


#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;

struct Point
{
    int x,y;
    Point(int x = 0, int y = 0) : x(x), y(y) {}
    friend Point operator - (const Point& A, const Point& B)
    {
        return Point(A.x-B.x, A.y-B.y);
    }
    bool operator < (const Point& B) const
    {
        return x < B.x || x == B.x && y < B.y;
    }

};

int Cross(const Point& A, const Point& B)
{
        return A.x*B.y - A.y*B.x;
}

ll dist(const Point& A, const Point& B)
{
    return (ll)(A.x-B.x)*(A.x-B.x) + (ll)(A.y-B.y)*(A.y-B.y);
}

const int maxn = 50000 + 5;
Point p[maxn];

int n;

void solve()
{
    sort(p,p+n);
    vector<Point> ch(n*2);
    int m = 0;
    for (int i = 0; i < n; i++) {
        while (m > 1 && Cross(ch[m-1]-ch[m-2], p[i]-ch[m-1]) <= 0) m--;
        ch[m++] = p[i];
    }
    int k = m;
    for (int i = n-2; i >= 0; i--) {
        while (m > k && Cross(ch[m-1]-ch[m-2], p[i]-ch[m-1]) <= 0) m--;
        ch[m++] = p[i];
    }
    ch.resize(m);
    ll mx = -1;
    for (int i = 0; i < ch.size(); i++)
      for (int j = i+1; j < ch.size(); j++)
         mx = max(mx, dist(ch[i],ch[j]));
    cout << mx << endl;
}

int main()
{
   scanf("%d",&n);
   for (int i = 0; i < n; i++) {
      scanf("%d%d",&p[i].x,&p[i].y);
   }
   solve();
}


uni-app - 在纯 JS 文件中调用自定义弹框组件 / 封装全局 API 调用弹框组件(解决小程序、APP 无法使用 document.body.appendChild 插入组件节点)适配全端 uni-app-在纯JS文件中调用自定义弹框组件/封装全局API调用弹框组件(解决小程序、APP无法使用document.body.appendChild插入组件节点)适配全端,uni-appappendChild怎么向小程序中插入节点,如何开发类似uni.showModal全局组件。h5端可以通过document.body.appendChild挂载,请问app跟微信小程序怎么弄,请问uniapp如何封装全局api调用弹窗组件?uniapp怎么设置所有页面共用的组件Uni 阅读详情

相关推荐

RU.EXE实用指南:从基础操作到高级调试技巧

本文是RU.EXE(RW Everything)的实用指南,详细介绍了这款硬件调试工具从基础操作到高级技巧的全过程。文章阐述了RU.EXE作为直接读写硬件寄存器、内存和PCI配置空间的强大工具,如何帮助硬件工程师和开发人员高效进行底层系统调试与故障排查,并强调了安全操作的重要性。

weixin_29228203的博客 278

实验7map和stack

国际大学生程序设计竞赛已经发展成为最具影响力的大学生计算机竞赛,ACM-ICPC以团队的形式代表各学校参赛,每队由3名队员组成,一个队每做出来一个题该队就会获得该题对应颜色的气球,气球越多就说明该队做的题目越多。当然如果一个颜色的气球越多就说明该气球对应的题也就越简单。现在给你很多很多的颜色的气球,问你那个颜色的气球最多,哈哈,聪明的acmer这题对你肯定很简单吧假设只有6种颜色,green,red,blue,pink,orange,black。

weixin_62671257的博客 532

企业微信——智能表格学习

企业微信报表

qq_15138049的博客 1万+

2020年 1月6日 OJ习题【栈】

栈-程序员输入问题 #include <bits/stdc++.h> using namespace std; int main() { stack<char>x1; stack<char>x2; char str[110]; gets(str); int l=strlen(str); for(int i=0;i...

shiroi2333的博客 494

Google AdSense收款前必做:W-8BEN税务认证的3个关键选择与1个提交时机小技巧

本文深入解析Google AdSense收款前必须完成的W-8BEN税务认证,重点介绍账号类型选择、特殊税率勾选、美国活动界定等3个关键决策,并分享提交时机的小技巧,帮助站长高效通过审核,确保广告收入顺利到账。

weixin_30443731的博客 671

RAG-Anything 实战:构建企业级多模态知识图谱问答系统

本文详细介绍了如何利用RAG-Anything构建企业级多模态知识图谱问答系统,解决跨模态文档处理的痛点。通过架构设计解析、部署实战指南和典型业务场景解决方案,帮助企业实现高效的知识管理和智能检索,提升决策效率。

weixin_29089057的博客 385

【WZOI】(基础题库)第823题 洗盘子

Bessie 和 Canmuu 将联手洗掉N (1<= N <= 10,000) 个脏盘子。Bessie 负责洗盘子,Canmuu 来擦干它们。每个盘子有一个指定的编号,范围1..N。开始,所有盘子按顺序排列在栈中, 1号盘子在顶端,N号盘子在底端。Bessie会先洗一些盘子,然后放在洗过的盘子栈里(这样原来的顺序颠倒)。然后Canmuu擦干Bessie已经洗好的部分或全部的盘子,放在擦干的盘子栈里。

2301_80275839的博客 335

YOLOv8改进,YOLOv8添加可变性卷积DCNv2

DCNv2对原始的DCNv1进行了改进,可变形卷积网络的卓越性能源于其适应对象几何变化的能力。通过对其自适应行为的检查,虽然对其神经特征的空间支持比常规的ConvNets更接近于对象结构,但这种支持可能远远超出感兴趣区域,导致特征受到不相关图像内容的影响。为了解决这个问题,我们提出了一种可变形卷积网的重新表述,通过提高建模能力和更强的训练,提高了其专注于相关图像区域的能力。通过更全面地集成网络中的可变形卷积,并引入扩展变形建模范围的调制机制,增强了建模能力。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 3606

{题解}[jzoj1299] 洗盘子(cleanup.pas/cpp)

jzoj1299 有N(1<=N<=40000)个奶牛到FJ的餐厅吃饭,餐厅里有M(1<=M<=N)种菜,每头牛有自己喜欢的菜的编号P_i(1<=P_i<=M),每头牛只吃自己喜欢的这道菜。   牛儿们在外面排着队进来,按照排队顺序一批一批进来,每批可以同时进来任意头牛,每一批吃完(注意包括最后一批)都要进行打扫,如果这批牛中一共需要K种菜,那么吃完后的打扫时间为K*K。

FarmerJohn 2930

学Simulink——控制执行场景实例:基于Simulink的智能车辆电子稳定控制(ESC)仿真

本文完成了基于 Simulink 的智能车辆电子稳定控制(ESC),实现了:✅ 构建含轮胎非线性的车辆动力学模型✅ 设计滑模横摆稳定性控制器✅ 实现四轮制动力分配逻辑✅ 验证在双移线低附着场景下的卓越稳定性✅ 为主动安全控制系统开发提供完整范式。

xiaoheshang_123的博客 528

RK3568笔记十七:LVGL v8.2移植

若该文为原创文章,转载请注明原文出处。本文介绍嵌入式图形库移植到Linux开发板ATK-RK3568上的步骤。

4230

【计算几何】 Andrew凸包算法 + 旋转卡壳(以求点对最长距离为例) -- 以 POJ 2187 Beauty Contest 为例

Part One 求凸包 凸包的算法有很多种,我这里使用的是是Andrew那个凸包算法,就是先循环所有点求出下凸包,再逆向循环所有点定求出上凸包的那个算法。 时间复杂度为O(NlogN) 一个java的Applet演示算法执行过程 Monotone Chain Convex Hull 算法伪代码: 输入:一个在平面上的点集P 点集 P 按 先x后y 的递增排序 声明两个栈:U,L U -

生命有一种绝对 4151

MIPI D-PHY TX 一致性测试实例解析 Part 01 续

本文为MIPI D-PHY TX一致性测试实例解析part01章节的第二部分

一只豌豆象的博客 6042

poj2187 Beauty Contest 凸包

DescriptionBessie, Farmer John’s prize cow, has just won first place in a bovine beauty contest, earning the title ‘Miss Cow World’. As a result, Bessie will make a tour of N (2 <= N <= 50,000) farms a

xtulollipop 781

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

POJ 2187 Beauty Contest (凸包 旋转卡壳)

题目链接:POJ 2187 Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 &...

G19850917的博客 235

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

POJ 2187 Beauty Contest(凸包优化 || 凸包+旋转卡壳)

http://poj.org/problem?id=2187 大意:求解点和点之间的最大距离的平方。 记得曾经有一道CF的题自己写了一个3重循环也过了,当时自己怀疑计算机一秒是运算10^9吗,还是数据太弱。。。写了一个1e9的程序,果断超时。看来1e8才是保险值 #include #include using namespace std; const int N=5e4+10; st

theArcticOcean 1072

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

【凸包直径&平面最远点对&对锺点(旋转卡壳)】poj 2187 Beauty Contest

poj 2187 Beauty Contesthttp://poj.org/problem?id=2187问题描述:平面点集上最远点对&凸包直径&对锺点首先构造凸包,遍历所有点与点距离,取最大值。这是利用了凸包上的点相比 点集中的点 一般是很少的 平均情况很好 并且我们也能AC这个问题但是这是有局限性的 当凸包上的点达到O(N)的级别时 凸包的优化作用就不存在了不过我们还要考虑到 凸包还起了对凸包上

Hacker_vision 684

poj 2187 Beauty Contest(凸包求解多节点的之间的最大距离)

/* poj 2187 Beauty Contest 凸包:寻找每两点之间距离的最大值 这个最大值一定是在凸包的边缘上的! 求凸包的算法: Andrew算法! */ #include<iostream> #include<cstdio> #include<cstring> ...

weixin_34218890的博客 155

POJ 2187 Beauty Contest (凸包)

POJ 2187 Beauty Contest 大致题意: 给定平面上的一些散点集,求最远两点距离的平方值。 解题思路: 别想着暴力枚举任意亮点距离找最大,行不通,想想三点共线吧! 平面上的散点集的最远的两点距离必然在这个散点集的凸包的某两个顶点上出现。 那么先求凸包,再枚举顶点距离就OK了。 问题是用栈构造凸包之前要对散点集进行排序,水平序我不说了,我没看懂,听说很简单。我用的是极坐标排序。 利用叉积的旋向 配合 比较排序 (如插入排序,冒泡,快排等)可以对极坐标排序,推荐用qsort,不要用冒泡之类的

Ⅶ的专栏 630

POJ 2187 Beauty Contest(凸包)

Description Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) fa

Shannon-Nansen 537

POJ 2187 Beauty Contest 凸包+旋转卡壳

凸包+选择卡壳 ..... 测试模板 Beauty Contest Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 29721   Accepted: 9192 Description Bessie, Farmer John's

码代码的猿猿 972

POJ 2187 Beauty Contest(凸包+旋转卡壳)

转载请注明出处,谢谢 http://blog.youkuaiyun.com/ACM_cxlove?viewmode=contents           by---cxlove 题目:求出凸包的最大直径。 http://poj.org/problem?id=2187 先对多边形求凸包,以前的知识不多说。 然后用旋转卡壳求出最大直径。 其实就是两条平行线夹出凸包,旋转。 如果pa,pb为最远

窝不是爱酱,喵~~~~ 1641

【POJ 2187】 Beauty Contest (凸包-Graham扫描算法)

【POJ 2187】 Beauty Contest (凸包-Graham扫描算法) 找平面最远点对 数据很大 用暴力会T..我感觉…… 扫描出个凸包 然后枚举凸包上的点即可 没坑 int也可过 注意重边跟共线就行 代码下附赠几组数据 代码如下: #include #include #include #include #include #include #include

ACMer' 1102

POJ-2187-Beauty Contest凸包 —— 旋转卡壳

凸包 —— 旋转卡壳 POJ-2187-Beauty Contest 题意: 给 n 个顶点的坐标,求在这个图中,距离最远的两个点的 距离的平方 思路: 距离最远的点,肯定在凸包上,那么先求出凸包,然后直接枚举每两个点的距离(O(n^2)) 旋转卡壳优化: 先在凸包上找到一条边 A ,并找到距离这条边最远的点 a(最远的两点可能是 A 的某个端点和 a 的距离) ,当逆时针换边 B 的时候,距离...

HappyCode 327

POJ 2187 Beauty Contest( 凸包求最远点对 )

链接:传送门 题意:给出 n 个点,求出这 n 个点中最远的两个点距离的平方 思路:最远点对一定会在凸包的顶点上,然后直接暴力找一下凸包顶点中距离最远的两个点 /************************************************************************* > File Name: poj2187.cpp &...

dijingzhou4259的博客 154

POJ 2187 Beauty Contest——凸包

因为点都是整点,所以这些点构成的凸包的顶点不会超过根号(m)个,m为坐标系的范围,因此只要构造出凸包二重循环枚举就可以了,另外当m太大时可以用旋转卡壳做,这里就不写了,以后有时间会补上#include &lt;cstdio&gt; #include &lt;cstring&gt; #include &lt;iostream&gt; #include &lt;algorithm&gt; #inclu...

hao_zong_yin的博客 481
上一篇: UVa 1001 Say Cheese (Floyd)
下一篇: POJ 3311 Hie with the Pie(状态压缩DP)
Interstellar_
博客等级 码龄10年 8粉丝 121原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值