Gym - 100781G-Goblin Garden Guards】的更多相关文章

平面上有100000个哥布林和20000个圆,问你不在圆内的哥布林有多少个. 将每个圆从左到右切2r+1次,形成(2r+1)*2个端点,将上端点记作入点,下端点记作出点,再将这些点和那些哥布林一起排序(x第一关键字,y第二关键字,类型(入 哥布林 出)第三关键字),扫一遍就好了. #include<cstdio> #include<cmath> #include<algorithm> using namespace std; const double EPS=0.000…
题意: n 只哥布林,每只哥布林都有一个位置坐标. m 个炮台,每个炮台都有一个位置坐标和一个攻击半径. 如果一个哥布林在任何一个炮台的攻击范围内,都会被杀死. 求最后没有被杀死的哥布林的数量. 这题暴力加一些小小的优化可以爆过去...然后场上并不敢试. 标算是扫描线.炮台攻击范围内的每个横坐标都拉一个扫描线,把线的两端的点和哥布林的点一起加进一个数组. 然后排序,就会发现能被杀死的哥布林的点在一根线的两个端点之间. 直接扫一遍统计答案就可以了.注意存点的数组要开够. 另外就是...排序的时候…
In an unprecedented turn of events, goblins recently launched an invasion against the Nedewsian city of Mlohkcots. Goblins—small, green critters—love nothing more than to introduce additional entropy into the calm and ordered lives of ordinary people…
题目链接:https://nanti.jisuanke.com/t/28882 解题思路:单纯的判断点是否在圆内,一一遍历圆外切正方形内的点即可,注意,该题要建个结构体数组存每个地精的位置,再bool个map数组用来标记点是否在圆内,map数组不能用int否则会超内存. #include<iostream> using namespace std; int n,m,ans; ][]; int in(int x,int y) { ||x>||y<||y>) ; ; } stru…
A:Adjoin the Networks One day your boss explains to you that he has a bunch of computer networks that are currently unreachable from each other, and he asks you, the cable expert's assistant, to adjoin the networks to each other using new cables. Exi…
题意及思路 题目主要是讲先给出所有guard的位置,再给出所有incidents的位置,求出guard到达每个incident处最小的steps,其中guard每次可以向四周8个方向移动. 思路:对于每个guard使用bfs遍历它周围的点,算出相应的点到它的距离. AC代码 #include<bits/stdc++.h> using namespace std; int N, Q; struct Pla { int x, y; }; int dist[5000+10][5000+10]; in…
Weird Cryptography Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935B Description standard input/output Khaled was sitting in the garden under an apple tree, suddenly! , well... you should guess what happened, a…
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/G Description An owner of a small company FacePalm has recently learned that the city authorities plan to offer to small businesses to partic…
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/G Description An owner of a small company FacePalm has recently learned that the city authorities plan to offer to small businesses to partic…
原题链接:http://codeforces.com/gym/100650/attachments/download/3269/20052006-acmicpc-east-central-north-america-regional-contest-ecna-2005-en.pdf 题意 玩过这个游戏的人会比较熟悉,题目指出,每个细胞如果四周细胞太少了,就会孤独而死,如果细胞周围细胞太多了,就会挤死.给你个布局,问你他的上一代布局会有几种.不过这道题的关键在于wrap around这个词,即边界…