POJ 2932 Coneology(平面扫描/计算最外层圆个数)

【SpringBoot 3.x 第57节】Spring Boot 3 启动快得不讲武德?揭秘 Spring AOT 编译引擎背后的真相! 🏆本文收录于《滚雪球学SpringBoot 3》,专门攻坚指数提升,本年度国内最系统+最专业+最详细(永久更新)。    本专栏致力打造最硬核 SpringBoot3 从零基础到进阶系列学习内容,🚀均为全网独家首发,打造精品专栏,专栏持续更新中…欢迎大家订阅持续学习。 如果想快速定位学习,可以看这篇【SpringBoot3教程导航帖】,你想学习的都被收集在内,快速投入学习!!两不误。    若还想学习更多,可直接前往《滚雪球学SpringBoot(全版本合集)》,涵盖SpringBoot所有版本教学文章 阅读详情

题目链接:
POJ 2932 Coneology
题意:
平面上有n个两两没有公共点的圆,i号圆的圆心在(xi,yi),半径为ri,编号从1开始。求所有最外层的,即不包含于其他圆内部的圆。输出符合要求的圆的个数和编号。n<=40000.
分析:

由于有任意两圆都没有公共点这一条件,要判断一个圆是否在其他圆内部,只要判断其圆心是否在其他圆内即可。这样判断每个圆是否是最外层的复杂度为 O(N) ,因此很容易得到 O(N2) 复杂度的算法,但是这样显然会 TLE 。
下面介绍平面扫描技术的 O(NlogN) 复杂度算法。所谓平面扫描是指扫描线在平面上按给定轨迹移动的同时,不断根据扫描线扫过部分更新信息,从而得到整体所要求的结果的方法。扫描的方法,既可以从左向右与y轴平行的直线,也可以固定射线的端点逆时针转动。
对于这道题我们在从左向右平移与y轴平行的直线的同时,维护与扫描线相交的最外层的圆的集合。从左向右移动的过程中,只有扫描线移动到圆的左右两端时,圆与扫描线的相交关系才会发生变化。因此我们先将所有这样的x坐标枚举出来并排好序。(即 ri−xi和ri+xi )
首先,我们来看一下扫描线移动到某个的左端时的情形。此时,我们需要判断该圆是否包含在其他圆中。为此,我们只需从当前与扫描线相交的外层圆中,找到上下两侧y坐标方向距离最近的两个圆,并检查它们就足够了。这是因为,假设该圆被包含与更远的圆中,却不被包含于最近的圆中,就会得到两圆相交的结论。这与题目所给的条件不符。于是,只要用二叉查找树来维护这些圆,就能够在 O(logn) 的时间内取得待检查的圆了。
其次我们看一下扫描线移动到某个圆的右端时的情况。此时的处理很简单,如果该圆已经包含于其他圆中就什么也不做,如果是最外层的圆就将它从二叉树中删除。综上,总的复杂度为 O(NlogN) 。

以上摘自《挑战程序设计竞赛》。

思考:
①:如果存在一排这样的圆,纵坐标和半径都一样只是横坐标不一样,那扫描线在扫描过程中,假设扫到了第i个圆
根据下面代码中的查找: it=outers.lowerbound(makepair(y[id],id)); ,返回的it是什么呢?我们都知道 lowerbound(k) 返回的是第一个>=k的迭代器,那么会返回代表i-1的迭代器吗?答案是不会的。因为在扫到第i个圆之前,就已经扫描到
第i-1个圆的右端了,所以集合中已经将第i-1圆“剔除”了,所以返回的应该是 outers.begin() ,也就是第i圆也是合法圆。
②:假设一个集合s,s中并无元素y,删除y即 s.erase(y) 对s并没有任何影响。

//5324K 1735MS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <climits>
#include <cmath>
#include <set>
#include <vector>
using namespace std;
const int MAX_N=40010;

int n;
double x[MAX_N],y[MAX_N],r[MAX_N];

inline int inside(int i,int j) //判断圆i是否在圆j内
{
    double dx=x[i]-x[j],dy=y[i]-y[j];
    return dx*dx+dy*dy <= r[j]*r[j];
}

int main()
{
    //freopen("2932in.txt","r",stdin);
    while(~scanf("%d",&n)){
        vector<pair<double,int> > events;
        for(int i=0;i<n;i++){
            scanf("%lf%lf%lf",&r[i],&x[i],&y[i]);
            events.push_back(make_pair(x[i]-r[i],i)); //圆左端坐标
            events.push_back(make_pair(x[i]+r[i],i+n)); //圆右端坐标
        }
        sort(events.begin(),events.end()); //将所有圆左右端点排序

        //平面从左到右与y轴平行扫描
        set<pair<double,int> > outers; //与扫描线相交的最外层圆的集合,存储圆心纵坐标
        vector<int> res;
        for(int i=0;i<events.size();i++){
            int id=events[i].second % n;
            //printf("id=%d events[i].first=%.0lf\n",id,events[i].first);
            if(events[i].second<n){ //扫描到圆的左端
                set<pair<double,int> >::iterator it=outers.lower_bound(make_pair(y[id],id));
                //it是outers中在id圆上方的最接近id圆的迭代器
                if(it!=outers.end()&&inside(id,it->second)) continue;
                //it->second是上侧y坐标方向距离最近的圆编号
                if(it!=outers.begin()&&inside(id,(--it)->second)) continue;
                //(--it)->second是下侧y坐标方向距离最近的圆编号
                res.push_back(id);
                outers.insert(make_pair(y[id],id));
            } else { //扫描到圆的右端
                outers.erase(make_pair(y[id],id));
            }
        }

        sort(res.begin(),res.end());
        printf("%d\n",res.size());
        for(int i=0;i<res.size();i++){
            printf("%d%c",res[i]+1,i+1==res.size()?'\n':' ');
        }
    }
    return 0;
}
从零学懂车载 TSN(二):802.1AS、Qbv、Qbu 是如何让 Ethernet “按时发送”的? 假设有两台设备: ECU A 认为: 但 Switch B 认为: 如果我们规定: 问题就来了。ECU:Switch:整个调度立即失效。因此 TSN 要做时间调度,第一件事就是:这就是:IEEE 802.1AS 定义时间敏感网络里的:工程中通常会看到:gPTP也就是:generalized Precision Time Protocol可以先简单理解成: 核心表达:所有 TSN 节点使用共同时间。后面抓包时你会经常遇到: 刚入门时不用急着研究每个 bit。先搞清楚它们解决什么问题。两个设备连接: A 需要知 阅读详情

相关推荐

音频测试专题

麦克风与扬声器单体测试指标及整机性能测试概述 麦克风测试指标包括频率响应、灵敏度、指向性等10项关键参数,用于评估声音捕捉和信号转换性能。扬声器测试包含频率响应、灵敏度等12项指标,涉及声学特性和物理参数。整机性能测试覆盖安静、嘈杂和正常三种环境,重点检测麦克风底噪、清晰度、扬声器音量及通话质量等12项功能指标。两类单体测试与整机测试共同构成完整的音频设备质量评估体系,确保产品在不同场景下的性能表现。

weixin_52640906的博客 1327

POJ2932 扫描线

#include <cstdlib> #include <cstdio> #include <iostream> #include <vector> #include <set> #include <algorithm>using namespace std;double x[400005]; double y[400005]; double r[400005];int n; int inside(

点羽染墨 565

MitoZ|动物线粒体基因组组装注释软件

一、MitoZ是什么 是基于python3开发的可以自动过滤双端测序的原始数据、mt基因组组装、mt基因组注释以及mt基因组可视化的工具。 官方的说明文档地址:https://gitee.com/CHANyp/MitoZ#citation 二、MitoZ的安装 git clone https://gitee.com/CHANyp/MitoZ.git cd MitoZ/version_2.4-alpha tar -jxvf release_MitoZ_v2.4-alpha.tar.bz2 三、运行Mito

qq_50637636的博客 1万+

POJ 2932 Coneology(平面扫描)

题目链接: http://poj.org/problem?id=2932 解题思路: 题目大意: 平面上有n个两两没有公共点的圆,i号圆的圆心在(x[i],y[i]),半径为r[i]。求所有最外层的,即不包含于其他圆内部的圆。 算法思想: 因为题目内的圆不存在相交的情况, 所以直接储存每个圆的左端点和右端点的x坐标,然后从左扫到右。我们在从左向右平移与y轴 平行的直线的同时,维护

piaocoder 1003

AR1020触摸控制器驱动开发:嵌入式I²C/SPI底层集成指南

电容式触摸控制器是现代嵌入式人机交互(HMI)系统的核心感知单元,其工作原理基于寄生电容变化检测与数字信号处理。Microchip AR1020 作为典型单芯片方案,内置硬件滤波、多点跟踪与手势识别引擎,通过I²C或SPI接口输出结构化事件数据,显著降低主控MCU负载。该类器件的技术价值在于平衡精度、功耗与实时性,广泛应用于工业HMI、医疗设备及车载终端等对可靠性要求严苛的场景。本文聚焦AR1020的寄存器映射、中断驱动模型、坐标解析机制及在STM32平台的HAL/LL级工程实现,涵盖硬件时序约束、固件配置

weixin_29323977的博客 602

word多级列表为什么会变成黑块解决思路

今天在写文档时,发现WORD5级的标题都变黑块了,找了度娘的资料,终于解决了。 第一种 1、光标bai放在黑快的右边,按向左的箭头,然后ctrl+shift+s,点击重新应用。 2、点击“定义新的多级列表”(不知道从哪儿找这个按钮的百度下),直接点确定。 3、这里很重要!!!不要直接保存,而是直接关掉word,会提示保存还是不保存,这个地方再点击保存。 第二种 Word2016 使用宏代码修复方法 1.找到视图-宏,打开 查看宏 2.创建宏 3.贴...

霍力强的专栏 8587

poj2932(几何扫描线)

/* translation: 给出n个两两不相交的圆,求出那些不被任何圆包含的圆的编号 solution: 平面几何扫描线 note: * 首先对每一个圆的水平方向的两个端点进行排序处理。然后用一条扫描线从左到右扫描。遇到圆的左端点 就判断是否被其它圆包含,如果是,加进set容器中(保存的全是没有被包含的圆)。遇到右端点,从容器 中删除 *

林伏案的博客 582

基于物联网的门禁与考勤系统(阿里云)_81

本课题设计的基于物联网的门禁与考勤管理系统,结合现代信息技术,利用指纹识别、射频卡、密码输入和远程控制等多种开锁方式,提升门禁系统的安全性和灵活性;同时,通过物联网平台进行数据上传和远程管理,极大提高了管理效率。通过智能化的考勤功能,系统可以实时记录员工的出入情况,并通过云平台进行远程查询和管理,推动门禁与考勤管理的数字化、智能化和高效化。

1万+

poj 2932 计算几何入门题 平面扫描

链接:http://poj.org/problem?id=2932 题意: 有n个圆,给定每个圆的圆心和半径,求所有最外层的,即不包含在其他圆内部的圆。 (任意两圆都没有公共点) 思路: 由于两两没有公共点,所以如果圆不在其他圆内部,那么这个圆的圆心就不可以在任何一个圆的内部。很直观的就O(n2)O(n^2)的算法。这肯定是过不了的,学习一个新的方法。平面扫描法。 平面扫描: 将扫描线

liujc_的专栏 821

【DRAM存储器四十七】LPDDR5介绍--LPDDR5的低功耗技术之DVFS

讲述LPDDR5的DVFSC和DVFSQ的工作原理和要求

highman110的博客 909

加密算法:深度解析Ed25519原理

在 Solana 开发过程中,我一直对 Ed25519 加密算法 如何生成公钥、签名以及验证签名的机制感到困惑。为了弄清这一点,我查阅了大量相关资料,终于对其流程有了更清晰的理解。在此记录实现过程,方便日后查阅。

盹猫的博客 1万+

poj2932(计算几何平面扫描)

解题思路:其实就是把圆的左右两端记录下来,然后沿x轴从左到右进行扫描,扫到圆的左端点时,则判断其是否被其他圆包含,如果不被包含就加入set中维护,到碰到圆的右端点时,就从set中删除左端点。但做的时候调了一些时间,发现有个以前没注意到的语法问题。网上的版本都是用pair进行数据组合的,这样排序的时候就会默认先以first进行排,first一样时就按second的大小排序。而我用结构体,只按firs...

qq_39861441的博客 280

【100%通过率】华为OD机试真题 Java&Go 实现【查找单入口空闲区域】【2022.11 Q4 新题】

给定一个 m xn 的矩阵,由若干字符 和0构成,X表示该处已被占据,0"表示该处空闲,请找到最大的单入口空闲区域.解释:空闲区域是由连通的O组成的区域,位于边界的0可以构成入口,单入口空闲区域即有目只有一个位于边界的0作为入口的由连通的'O"组成的区域。 如果两个元素在水平或垂直方向相邻,则称它们是“连通”的。

MISAYAONE的博客 2万+

POJ2932Coneology(计算几何、平面扫描)

平面上有N NN个两两没有公共点的圆,i ii号圆的圆心在(xi,yi)(x_i,y_i)(xi​,yi​),半径为rir_iri​。求所有最外层的,即不包含与其他圆内部的圆。 解析: 利用垂直于x轴的线去从左往右扫描,观察点为圆的左右端点。因为圆是没有公共点的,这使得包含的判断变得简单。如果某个圆被包含那么一定是被最近的两个外圈的其中一个圆包含(y轴上),假设这个圆已经被包含,如果远的圆如果想包含这个圆必须把两个圆都包住,那么第一层包裹已经不再是外层。所以如果存在被包括在某个外层里,一定是被包裹在最近的.

繁凡さん的博客 526

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

POJ 2932 Coneology (平面扫描)

Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3713   Accepted: 720 Description A student named Round Square loved to play with cones. He would ar

MADE_Y 2127

深度学习工具包 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")

POJ-2932 Coneology 圆的扫描线

POJ-2932题目链接:传送门 Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would admire the intrinsic beauty of the arrangement. The student even began theorizing about

hrdate(菜菜菜带带带) 222

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

POJ 2932-Coneology(平面扫描-最外层的圆)

Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3827   Accepted: 760 Description A student named Round Square loved to play with cones. He would

Some. 711

POJ 2932 Coneology (平面扫描)

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1775 详细题解:很好的一道计算几何题目,考的就是想法,想到了就很简单了…… 先算出每两个圆心间的距离,dis[i][j]表示第i和第j个圆心的距离 然后再以每条线段ij为边,求出以这样的线段为直线的左右两边的点的个数cnt和距离len[cnt],直线

忆梦 1178

poj 2932 Coneology

依然是圆有关的扫描线.感觉额.上一篇说得自己都看不太懂的样子. 这个题目吧。是要问你有哪个圆没有被其他的圆覆盖住.说白了就是他的被覆盖层数为0.和上一篇的题相比.简单了点。 同样的.没有相交的圆.. 啊.直接说做法.加入set的集合的元素是.额.是不相互包含的圆.也就是说两两关系是相离.那么一个圆只要和它上下两圆无关系,自然也不会和这之外的圆有关系了. 然后这里判断一个圆的上下,就没有那么

ch2010091的专栏 1181

[扫描线]POJ2932 Coneology

题意:有n个圆 依次给了半径和圆心坐标 保证输入的圆不相交(只有 相离 和 内含/外含 的情况)   问 有几个圆 不内含在其他圆中,并分别列出这几个圆的编号(1~n)     (n的范围是[1, 40000]) 案例画出来大概是这样的 (那个原点为(50,50)的太远了,就意思一下) 所以答案是3号圆和5号圆 不被包含 好了,若这道题n只有1000,那...

aicheng4794的博客 195

圆的扫描线合集

题目链接http://poj.org/problem?id=2932 题意 给出n个不相交的圆,问有那些圆不被包含 题解 题目不存在圆相交,可以扫描线解。把每个圆拆成两个点,左端点和右端点,然后从左到右扫描。 扫到左端点,判断这个点代表的圆是否会被其他圆包含,如果不被包含就加入set内。判断只需在set内查找在该圆上下的两个圆进行判断即可。 扫到右端点就把set内的圆删掉。 #include...

Eliot的博客 686

poj 2932 Coneology(平面扫描)

题意:给定n个圆,求有多少个园

Baoli1008的专栏 807

poj 2932 Coneology (扫描线)

题意平面上有N个两两不相交的圆,求所有最外层的,即不被其他圆包含的圆的个数并输出思路挑战程序竞赛P259页代码/* ********************************************** Auther: xueaohui Created Time: 2015-7-25 16:56:13 File Name : poj2932.cpp ********************

wuhulala的休息室 1320

POJ 2932 Coneology (扫描线判断最外面的圆&set维护最近的圆)

http://poj.org/problem?id=2932 先给圆的最左端和最右端的点排个序,当两点x相同时,左端点排在前面。 然后就是扫描了, 若扫描到的是圆的左端点,就判断圆心(y坐标)在其上方且离其最近的圆是否包含此圆,以及圆心(y坐标)在其下方且离其最近的圆是否包含此圆,若包含就continue,不包含就insert到set中; 若扫描到的是圆的右端点,就从set中era

AC,∑ndless 1268

POJ-2932 Coneology[平面扫描]

Coneology Time Limit: 5000MS Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would admire the intr...

weixin_34268610的博客 124

Coneology(poj2932)

Description A student named Round Square loved to play with cones. He would arrange cones with different base radii arbitrarily on the floor and would admire the intrinsic beauty of the arrangement. T

某某某的博客 331
上一篇: ZOJ 3662 Math Magic(构造K个和为N且最小公倍数为M的正整数的方案数/dp)
下一篇: 模板--判断两线段是否相交
ramay7
博客等级 码龄11年 64粉丝 464原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值