2017CCPC QinHuangDao M题
来源:互联网 发布:ei compendex数据库 编辑:程序博客网 时间:2024/06/10 06:32
PUBG is a multiplayer online battle royale video game. In the game, up to one hundred players parachute onto an island and scavenge for weapons and equipment to kill others while avoiding getting killed themselves. BaoBao is a big fan of the game, but this time he is having some trouble selecting the safest building.
There are buildings scattering on the island in the game, and we consider these buildings as points on a two-dimensional plane. At the beginning of each round, a circular safe area whose center is located at (0, 0) with radius will be spawned on the island. After some time, the safe area will shrink down towards a random circle with radius (). The whole new safe area is entirely contained in the original safe area (may be tangent to the original safe area), and the center of the new safe area is uniformly chosen within the original safe area.
The buildings covered by the new safe area is called the safe buildings. Given the radius of the safe areas and the positions of the buildings, BaoBao wants to find all the buildings with the largest probability to become safe buildings.
Input
There are multiple test cases. The first line of input contains an integer , indicating the number of test cases. For each test case:
The first line contains three integers (), and (), indicating the number of buildings and the radius of two safe circles.
The following lines each contains 2 integers and (), indicating the coordinate of the buildings. Here we assume that the center of the original safe circle is located at , and all the buildings are inside the original circle.
It's guaranteed that the sum of over all test cases will not exceed 5000.
Output
For each test case output two lines.
The first line contains an integer , indicating the number of buildings with the highest probability to become safe buildings.
The second line contains integers separated by a space in ascending order, indicating the indices of safest buildings.
Please, DO NOT output extra spaces at the end of each line.
Sample Input
23 10 53 43 53 63 10 4-7 -64 55 4
Sample Output
1122 3
/* 2017ccpc QingHuangDao M @author jsphlim*/#include<iostream>#include<algorithm>using namespace std;struct point{int x;int y;int index;int pc;};bool cmp(point x,point y){return x.pc<=y.pc;}point p[100005];point ps[100005];int main(){ int t,n,r,R; cin>>t; while(t--){ cin>>n>>R>>r; int flag=0; for(int i=1;i<=n;i++) {cin>>p[i].x>>p[i].y; p[i].index=i; p[i].pc=p[i].x*p[i].x+p[i].y*p[i].y;} int temp; if(R>2*r){ temp = R-2*r; } else{ temp = 2*r-R; } int indx = 0; for(int i=1;i<=n;i++){ if(p[i].pc<=temp*temp){ ps[indx++]=p[i]; } } if(indx!=0){ cout<<indx<<endl; for(int i=0;i<indx-1;i++) cout<<ps[i].index<<" "; cout<<ps[indx-1].index<<endl; } else{ sort(p+1,p+n+1,cmp); int inx=2; while(p[1].pc==p[inx].pc) inx++; cout<<inx-1<<endl; int sets[10005]; int setsize=0; for(int i=1;i<inx;i++) sets[setsize++]=p[i].index; sort(sets,sets+setsize); for(int i=0;i<setsize-1;i++) cout<<sets[i]<<" "; cout<<sets[setsize-1]<<endl; } }}
- 2017CCPC QinHuangDao M题
- 2017 CCPC 秦皇岛 M
- 2017CCPC 秦皇岛现场赛 M-String of CCPC
- 2017 ccpc 秦皇岛 M(几何)
- 2017CCPC秦皇岛 M:Safest Buildings
- 2017CCPC秦皇岛站 M.Safest Buildings
- 2017 CCPC 哈尔滨站 --M --- Geometry Problem
- 2017 ccpc秦皇岛M Safest Buildings
- 2017 秦皇岛CCPC M题 Safest Buildings(概率+思维+计算几何)
- 2017 CCPC 秦皇岛站 M题题解 ZOJ 3993 Safest Buildings
- ZOJ 3993(2017CCPC秦皇岛站M题)Safest Buildings
- ZOJ 3993 && 2017CCPC秦皇岛 M:Safest Buildings
- 2017CCPC哈尔滨 M:Geometry Problem(随机)
- (ccpc秦皇岛站)M
- 2017 CCPC 秦皇岛 G题
- 2017 CCPC 秦皇岛 G题
- CCPC 2017 哈尔滨 F题
- 2017 CCPC
- Eclipse下的maven工程自动热部署方案(不用编译,不用重启tomcat)
- 微信支付total_fee 长度不正确
- Unity3d 二维Camera跟随
- 51单片机中变量的存储 xdata bdata idata pdata区别
- 电灯切换-LintCode
- 2017CCPC QinHuangDao M题
- 两台windows电脑共享文件技巧
- 【tensorflow实战笔记-分类篇】思路构思
- BZOJ1046 [HAOI2007]上升序列 【LIS + 字典序最小】
- js、函数、对象、arguments
- Python Tips
- Mongodb更新数组操作$each修饰符
- 一行多列的下拉多选框
- Mysql数据类型