地址:http://poj.org/problem?id=2932

题目:

Coneology
Time Limit: 5000MS   Memory Limit: 65536K
Total Submissions: 4170   Accepted: 886

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 how some cones dominate other cones: a cone A dominates another cone B when cone B is completely within the cone A. Furthermore, he noted that there are some cones that not only dominate others, but are themselves dominated, thus creating complex domination relations. After studying the intricate relations of the cones in more depth, the student reached an important conclusion: there exist some cones, all-powerful cones, that have unique properties: an all-powerful cone is not dominated by any other cone. The student became so impressed by the mightiness of the all-powerful cones that he decided to worship these all-powerful cones.

Unfortunately, after having arranged a huge number of cones and having worked hard on developing this grandiose cone theory, the student become quite confused with all these cones, and he now fears that he might worship the wrong cones (what if there is an evil cone that tries to trick the student into worshiping it?). You need to help this student by finding the cones he should worship.

Input

The input le specifies an arrangement of the cones. There are in total N cones (1 ≤ N ≤ 40000). Cone i has radius and height equal to Rii = 1 … N. Each cone is hollow on the inside and has no base, so it can be placed over another cone with smaller radius. No two cones touch.

The first line of the input contains the integer N. The next N lines each contain three real numbers Rixiyi separated by spaces, where (xiyi) are the coordinates of the center of the base of cone i.

Output

The first line of the output le should contain the number of cones that the student should worship. The second line contains the indices of the cones that the student should worship in increasing order. Two consecutive numbers should be separated by a single space.

Sample Input

5
1 0 -2
3 0 3
10 0 0
1 0 1.5
10 50 50

Sample Output

2
3 5

Source

思路:

  圆的扫描线算法。

 #include <cstdio>
#include <algorithm>
#include <set>
#include <vector> #define MP make_pair
#define lc first
#define rc second using namespace std; const double eps = 1e-;
const int N = 1e5; int vis[N];
double r[N],cr[N][];
pair<double,int>pt[N];
set<pair<double,int> >st;
vector<int>ans;
set<pair<double,int> >::iterator it;
int sc(int a,int b)
{
double ta = (cr[a][]-cr[b][])*(cr[a][]-cr[b][])+(cr[a][]-cr[b][])*(cr[a][]-cr[b][]);
double tb = (r[a]+r[b])*(r[a]+r[b]);
return ta<tb;
}
int main(void)
{
int n;
while(~scanf("%d",&n))
{
st.clear(),ans.clear();
int cnt=;
for(int i=;i<=n;i++)
{
scanf("%lf%lf%lf",r+i,&cr[i][],&cr[i][]);
pt[cnt++]=MP(cr[i][]-r[i],i);
pt[cnt++]=MP(cr[i][]+r[i],i+n);
vis[i]=;
}
sort(pt,pt+cnt);
for(int i=;i<cnt;i++)
{
int k=pt[i].rc;
if(k>n&&vis[k-n])
st.erase(MP(cr[k-n][],k-n));
else if(k<=n)
{
it = st.lower_bound(MP(cr[k][],));
if(it!=st.end()&&sc(k,it->rc)) continue;
if(it!=st.begin()&&sc(k,(--it)->rc)) continue;
st.insert(MP(cr[k][],k));
vis[k]=,ans.push_back(k);
}
}
sort(ans.begin(),ans.end());
printf("%d\n",ans.size());
for(int i=;i<ans.size();i++)
printf("%d%c",ans[i],i==ans.size()-?'\n':' ');
printf("\n");
} return ;
}

poj2932 Coneology的更多相关文章

  1. POJ2932 Coneology【圆扫描线】

    POJ2932 Coneology 题意: 给出一些不相交的圆,问有多少个圆不被其他圆包围 题解: 扫描线,把所有圆的左边界和右边界放到\(vector\)里排序,遍历到圆左边界的时候判断是否满足条件 ...

  2. poj2932 Coneology (扫描线)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Coneology Time Limit: 5000MS   Memory Lim ...

  3. 计算几何值平面扫面poj2932 Coneology

    Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4097   Accepted: 859 Descript ...

  4. [扫描线]POJ2932 Coneology

    题意:有n个圆 依次给了半径和圆心坐标  保证输入的圆不相交(只有 相离 和 内含/外含 的情况)   问 有几个圆 不内含在其他圆中,并分别列出这几个圆的编号(1~n) (n的范围是[1, 4000 ...

  5. 刷题总结——coneology(poj2932 扫描线)

    题目: Description A student named Round Square loved to play with cones. He would arrange cones with d ...

  6. poj 2932 Coneology(扫描线+set)

    Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 3574   Accepted: 680 Descript ...

  7. poj 2932 Coneology (扫描线)

    题意 平面上有N个两两不相交的圆,求全部最外层的,即不被其它圆包括的圆的个数并输出 思路 挑战程序竞赛P259页 代码 /* ************************************* ...

  8. Coneology(POJ 2932)

    原题如下: Coneology Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 4937   Accepted: 1086 D ...

  9. POJ 2932 Coneology计算最外层圆个数

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

随机推荐

  1. VI 你不知道的事

    1G 顶部 G 底部 ctrl+F 前进 ctrl+B 后退 /text   向前搜索 ?text 向后搜索 I i 插入字符串 a 光标后插入字符 A 跳到句末尾 wq 写入并退出 h k j l ...

  2. 完美解决Android SDK Manager无法更新

    由于国内的各种屏蔽现在Android SDK Manager出现无法更新或更新太慢,如下方法可完美解决此问题 1. 打开..\Android\sdk\SDK Manager.exe  2.

  3. iOS - 开源框架、项目和学习资料汇总(动画篇)

    动画 1. Core Animation笔记,基本的使用方法 – Core Animation笔记,基本的使用方法:1.基本动画,2.多步动画,3.沿路径的动画,4.时间函数,5.动画组.2. awe ...

  4. vue--非父子组件之间的传值

    一个项目都有一个根组件 App.vue 一个根组件下面可能会有多个自组件,例如:Hello.vue 和 Header.vue Hello.vue 和 Header.vue 就是兄弟组件,那么这两个兄弟 ...

  5. ibatitsnet 因为会Dao.config 配置数据版本太低导致的问题

    ProjectReview.Test.SqlMapTest.TestSqlMap:IBatisNet.Common.Exceptions.ConfigurationException : - The ...

  6. pyAudio介绍

    概要 pyaudio有这么几个功能: - 提取特征 - 训练并且使用分类器 - 语音分割功能 - 内容关系可视化 python实现,好处有这么几个 - 适合做计算分析类型操作(编码少,效率不低) - ...

  7. Gym - 101149K Revenge of the Dragon 脑洞题,样例题

    http://codeforces.com/gym/101149/problem/K 题意:题目贼长,但其实是个脑筋急转弯... 题解:题目要求某图形面积.该图形只有一个自由度,就是起点与终点距离x. ...

  8. Oracle备份恢复之无备份情况下恢复undo表空间

    UNDO表空间存储着DML操作数据块的前镜像数据,在数据回滚,一致性读,闪回操作,实例恢复的时候都可能用到UNDO表空间中的数据.如果在生产过程中丢失或破坏了UNDO表空间,可能导致某些事务无法回滚, ...

  9. Effective Objective-C 笔记之熟悉OC

    1.在一个类的头文件中尽量少引用其他头文件 如果Person.h 引入了EmployeePerson.h,而后续又有其他类如Human.h又引入了Person.h, 那么EmployeePerson. ...

  10. cdn,wsgi框架

    CDN:分布式服务器 wsgi:http请求----wsgi----web框架