Codeforces 190E - Counter Attack】的更多相关文章

[题意]给一个无向图的反图(即给定的边实际上不存在,而未给的边是存在的),求连通块数.(点数n<=5*10^5,边数m<=10^6) 一开始我想的用DFS,枚举每一个点,跳过不存在的点,直接扫描,时间复杂度是O(n^2)的.然后,这种方案就被抛弃了. 我们可以设一个集合st,一开始st中包含所有点,每扫描到一个连通块,就把这个连通块从st中删掉. 那么怎么求连通块,可以使用BFS+二分查找.使用邻接表存储图,vector <int> G[i]为结点i相邻的结点,预处理时将其排序为有…
A. Vasya and the Bus 根据\(n,m\)是否为0分类讨论下. B. Surrounded 判断两圆是否有交点,否则构造的圆与两圆相切. C. STL 看代码比较清楚. void type() { if (cin >> str) { ans += str; if (str == "pair") ans += "<", type(), ans += ",", type(), ans += ">&q…
XSS攻击及防御 - 高爽|Coder - CSDN博客 https://blog.csdn.net/ghsau/article/details/17027893 XSS又称CSS,全称Cross SiteScript,跨站脚本攻击,是Web程序中常见的漏洞,XSS属于被动式且用于客户端的攻击方式,所以容易被忽略其危害性.其原理是攻击者向有XSS漏洞的网站中输入(传入)恶意的HTML代码,当其它用户浏览该网站时,这段HTML代码会自动执行,从而达到攻击的目的.如,盗取用户Cookie.破坏页面结…
题目链接:http://codeforces.com/problemset/problem/495/A 这个题目意思好绕好绕~~好绕~~~~~,昨天早上做得 virtual 看不懂,晚上继续看还是,差点就想求救 XX 兽了,最终还是打住,尽量不要依赖人嘛.今天终于想到了,大感动 ~_~ 理解能力有待提高... One of the sticks of the counter was broken    这句话有一点误导人的成分,我刚开始就以为只有一条 stick 坏了= =,再看这句 becau…
A. Robot Bicorn Attack Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/175/problem/A Description Vasya plays Robot Bicorn Attack. The game consists of three rounds. For each one a non-negative integer amount of points is gi…
B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasya has the square chessboard of size n × n and m rooks. Initially the chessboard is empty. Vasya will consequen…
题目链接:http://codeforces.com/problemset/problem/701/B 题目大意: 输入一个数n,m, 生成n*n的矩阵,用户输入m个点的位置,该点会影响该行和该列,每输入一个点则输出剩余未受影响的单元数. 解题思路: 吃饭...留坑 2016.09.11 12:05 AC code: #include<bits/stdc++.h> using namespace std; int main() { int n,m,x,y,ans; long long sx,s…
Cells Not Under Attack 题意: 给出n*n的地图,有给你m个坐标,是棋子,一个棋子可以把一行一列都攻击到,在根据下面的图,就可以看出让你求阴影(即没有被攻击)的方块个数 题解: 我先是认真的看了前面之后,发现看不懂,最后一看图,就明白了,这就似乎证明了图片已经超越了语言,MD 扯远了. 这题要这么想,增加了一个点,就要减少一行一列,之后再把他们拼到一起,之后发现也就是求x*y了(x是行没有出现的个数,y是列没有出现的个数) 还有就是要注意这题是longlong,又被ll坑了…
比赛的时候 long long sum=n*n,计算不出1e10长度到数,没有搞掉. 哎,以后要注意这个地方.这个题其实不难: 统计能被攻击到的个数,然后用总的个数减掉就可以了.注意有些地方重复计算,要给去掉.     B. Cells Not Under Attack time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vasy…
题目链接: B. Cells Not Under Attack 题意: n*n的棋盘,现在放m个棋子,放一个棋子这一行和这一列就不会under attack了,每次放棋子回答有多少点还可能under attack; 思路:对行和列标记; AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #incl…