@codeforces - 793G@ Oleg and chess】的更多相关文章

目录 @description - translation@ @solution@ @part - 1@ @part - 2@ @part - 3@ @part - 4@ @accepted code@ @details@ @description - translation@ 给定一个 n*n 的棋盘,并划定一些不能放棋子的矩形区域. 现在要在棋盘上放最多的车(读作 ju),使得这些车两两之间不会攻击. input: 第一行整数 n --棋盘边长(1 <= n <= 10000). 第二行整…
题意: 给定一个n*n的矩阵,一个格子上可以放一个车.其中有q个子矩阵,且q个子矩阵互不相交或者是重叠(但边界可以衔接).这q个子矩阵所覆盖的地方都是不能够放车的.车可以越过子矩阵覆盖的地方进行攻击(车可以横着或者是竖着直走,就像象棋中的那样).现在问的是一共最多能够放多少个不能够互相攻击的车. 数据范围 1<=n<=10000,0<=q<=10000 输入格式 首先输入两个数字n,q,分别表示矩阵的大小和子矩阵的个数. 接下来有q行,每行四个正整数x1,y1,x2,y2,分别表示…
\(\mathcal{Description}\)   Link.   给一个 \(n\times n\) 的棋盘,其中 \(q\) 个互不重叠的子矩阵被禁止放棋.问最多能放多少个互不能攻击的车.   \(n,q\le10^4\). \(\mathcal{Solution}\)   如果把问题转化成"只允许在某些子矩阵上放棋",就是一个很显然的线段树优化建图最大流.源点连向行上的线段树叶子,流量为 \(1\):行上的线段树结点向父亲连边,流量为正无穷:对于每个矩阵,行在树上分裂的 $\…
Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to too simple, he uses an infinite one instead. The first task he faced is to check…
题目链接:http://codeforces.com/problemset/problem/1173/B 思路参考:https://www.cnblogs.com/blowhail/p/10991237.html AC代码: #include<bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n; m = n / +; cout << m << endl; ;i <= m;…
题意 现在有m个人,每一个人都特别喜欢狗.另外还有一棵n个节点的树. 现在每个人都想要从树上的某个节点走到另外一个节点,且满足要么这个人自带一条狗m,要么他经过的所有边h上都有一条狗. 2<=n<=2*10^4,1<=m<=10^4 输入格式 第一行为两个整数n,m,分别表示树的大小和人数. 接下来有n-1行,每一行有两个整数u,v,表示书上有一条u-v的边. 再接下来有m行,每一行两个整数x[i],y[i]表示第i个人想从x[i]走到y[i]. 输出格式 第一行为一个整数k,表示…
E - Qwerty78 Trip Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice Gym 100947E Description standard input/output Announcement   Statements Qwerty78 is a well known programmer (He is a member of the I…
Puzzle Lover CodeForces - 613E Oleg Petrov loves crossword puzzles and every Thursday he buys his favorite magazine with crosswords and other word puzzles. In the last magazine Oleg found a curious puzzle, and the magazine promised a valuable prize f…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
D. Anton and Chess 题目连接: http://codeforces.com/contest/734/problem/D Description Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to…