题意: n 只哥布林,每只哥布林都有一个位置坐标. m 个炮台,每个炮台都有一个位置坐标和一个攻击半径. 如果一个哥布林在任何一个炮台的攻击范围内,都会被杀死. 求最后没有被杀死的哥布林的数量. 这题暴力加一些小小的优化可以爆过去...然后场上并不敢试. 标算是扫描线.炮台攻击范围内的每个横坐标都拉一个扫描线,把线的两端的点和哥布林的点一起加进一个数组. 然后排序,就会发现能被杀死的哥布林的点在一根线的两个端点之间. 直接扫一遍统计答案就可以了.注意存点的数组要开够. 另外就是...排序的时候…
平面上有100000个哥布林和20000个圆,问你不在圆内的哥布林有多少个. 将每个圆从左到右切2r+1次,形成(2r+1)*2个端点,将上端点记作入点,下端点记作出点,再将这些点和那些哥布林一起排序(x第一关键字,y第二关键字,类型(入 哥布林 出)第三关键字),扫一遍就好了. #include<cstdio> #include<cmath> #include<algorithm> using namespace std; const double EPS=0.000…
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…
链接:http://codeforces.com/gym/101982/attachments 思路: 问被覆盖次数为奇数次的矩阵的面积并 扫描线求矩阵面积并我们是上界赋为-1,下界赋为1,因为要求覆盖次数为奇数次的,我们直接上下界都赋值为1,然后每次区间更新的时候对这段区间取异或就好了 实现代码; #include<bits/stdc++.h> using namespace std; #define ll long long #define lson l,m,rt<<1 #de…
假设初始人数为0, 将每个时刻在等待的人数写下来,就是求个和. 如果纵坐标看成人数,横坐标看成时间,就是求个面积. 因为初始人数不一定为零,所以离线后扫描线即可回答所有询问. #include<cstdio> #include<algorithm> using namespace std; typedef long long ll; int n,m,e; struct LINE{ int y,l,id; }ls[200010]; bool cmp(const LINE &a…
题意: 给你n个点,m个横着的线段.你能够横移这些线段,可是这些线段的相对位置不能改变.假设一个点,在它的正上方和和正下方都有线段(包含线段的终点).则这个点被视为被"屏蔽".问通过随意平移我们能够遮住最多的点的数量. 解题思路: 首先把全部的点向右平移1000000个单位.然后那些线段位置不变,我们開始平移这些点,这样我们保证点向左移动的距离肯定是一个正数,方便处理. 这样我们仅仅要求出每一个点向左移动的距离后能够满足题目条件的集合W.然后在求出某个距离值在全部的集合中出现最多次数的…
题意:有一个二维平面,以及n个操作,每个操作会选择一个矩形,使得这个二维平面的一部分被覆盖.现在你可以取消其中的2个操作,问最少有多少块地方会被覆盖? 思路:官方题解简洁明了,就不细说了:https://codeforces.com/blog/entry/63729. 此处重点记录一下两种做法的巧妙之处. 1:二维差分+解方程 二维差分:假设在矩形[(x1, y1), (x2, y2)]上加一个数,那么在(x1, y1), (x2 + 1, y2 + 1)加1, (x1, y2 + 1), (x…
题目链接:https://codeforces.com/gym/101982/attachments 要你求覆盖奇数次的矩形面积并,每次更新时减去原先的值即可实现奇数次有效,下推时为保证线段长度不变左儿子的值为x[mid]-x[l]再减原来的值,右儿子的值为x[r]-x[mid]再减原来的值 #include<iostream> #include<algorithm> using namespace std; #define ll long long #define maxn 20…
题面传送门 题意: 有一个 \(10^6\times 10^6\) 的地图.其中 \(m\) 个位置上有花,\(f\) 个矩形外围用栅栏围了起来.保证 \(f\) 个矩形两两之间没有公共点. \(q\) 组询问,每组询问给出两个整数 \(x,y\),求出: 从点 \((x,y)\) 出发,只能向下或向右走,不能越过栅栏,总共可以摘到多少朵花. \(0\leq m,f,q\leq 2\times 10^5\) 先考虑 \(f=0\) 的情况,那就是一个弱智的扫描线.从低往高扫,如果 \((x_i,…
题意及思路 题目主要是讲先给出所有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这个词,即边界…
F. Monkeying Around time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output When the monkey professor leaves his class for a short time, all the monkeys go bananas. N monkeys are lined up sitting side by sid…
题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5977 Description When God made the first man, he put him on a beautiful garden, the Garden of Eden. Here Adam lived with all animals. God gave Adam eternal life. But Adam was lonely in the garden, s…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
题目链接: Garden of Eden Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 210    Accepted Submission(s): 75 Problem Description When God made the first man, he put him on a beautiful garden, the G…
D. Slalom time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Little girl Masha likes winter sports, today she's planning to take part in slalom skiing. The track is represented as a grid comp…
题目链接:http://codeforces.com/contest/522/problem/D 题目大意:  给你一个长度为n的序列,然后有m次查询,每次查询输入一个区间[li,lj],对于每一个查询,输出在这个区间内的两个相等的数的最短距离,如果没有相等的则输出-1. 线段树+扫描线,线段树维护的值是区间的最小值,从后往前扫,然后每次要做的事有两个: 1.判断当前这个位置 i 的数刚刚是不是出现过,假设刚刚出现的位置是 l ,如果出现过,则在线段树中把l这个位置的值更新为 l - i,同时更…
nginx+iis实现负载均衡 在win2008R2上使用(NLB)网络负载均衡 NLB网路负载均衡管理器详解 [译文]Web Farm和Web Garden的区别? IIS负载均衡-Application Request Route详解第一篇: ARR介绍 IIS负载均衡-Application Request Route详解第四篇:使用ARR实现三层部署架构…
/* 大连热身B题 不要低头,不要放弃,不要气馁,不要慌张 题意: 坐标平面内给很多个点,放置一个边长为r的与坐标轴平行的正方形,问最多有多少个点在正方形内部. 思路: 按照x先排序,然后确定x在合法范围内后按照y排序,进行扫描线. */ #include<bits/stdc++.h> using namespace std; ]; struct st{ void read(){ scanf("%d%d",&x,&y); } int x,y; }; st j…
Atitit 图像扫描器---基于扫描线 调用范例 * @throws FileExistEx */ public static void main(String[] args) throws FileExistEx { String s = "C:\\00p\\a1115_210836_162 dilate.jpg.png"; String ext = filex.getExtName(s); // s="C:\\00capch\\p5.jpg"; Buffere…
题目链接 http://codeforces.com/gym/101102/problem/J Description standard input/output You are given an array A of integers of size N, and Q queries. For each query, you will be given a set of distinct integers S and two integers L and R that represent a…
题目链接 http://codeforces.com/gym/100917/problem/J Description standard input/outputStatements The jury of Berland regional olympiad in informatics does not trust to contest management systems, so the Berland regional programming contest is judged by th…