题目链接:http://codeforces.com/contest/883/problem/B There are n military men in the Berland army. Some of them have given orders to other military men by now. Given m pairs (xi, yi), meaning that the military man xi gave the i-th order to another milita…
[CF883B]Berland Army 题意:给出n个点,m条有向边,有的点的点权已知,其余的未知,点权都在1-k中.先希望你确定出所有点的点权,满足: 对于所有边a->b,a的点权>b的点权对于i=1..k,至少有一个点的点权为i n,m,k<=100000 题解:像菜肴制作一样奇怪的拓扑排序题,直接上方法吧,不会证. 先正反跑两边拓扑排序,得出每个点点权的下界Li和上界Ri. 将所有点按上界从小到大排序,然后枚举权值i.将所有上界为i的点都扔到堆中,再从堆里取出下界最大的那个点,将…
题解:最大流板题:增加两个源点,一个汇点.第一个源点到第二个源点连边,权为K,然后第一个源点再连其他点(英雄点)边权各为1,然后英雄和怪物之间按照所给连边(边权为1). 每个怪物连终点,边权为1: 参考代码: #include<bits/stdc++.h> using namespace std; #define INF 0x3f3f3f3f ; int n,m,k,s,t,u,v,w,num,num1; struct Edge { int from, to, cap, flow; }; ve…
[BZOJ5109][CodePlus 2017]大吉大利,晚上吃鸡! Description 最近<绝地求生:大逃杀>风靡全球,皮皮和毛毛也迷上了这款游戏,他们经常组队玩这款游戏.在游戏中,皮皮和毛毛最喜欢做的事情就是堵桥,每每有一个好时机都能收到不少的快递.当然,有些时候并不能堵桥,皮皮和毛毛会选择在其他的必经之路上蹲点.K博士作为一个老年人,外加有心脏病,自然是不能玩这款游戏的,但是这并不能妨碍他对这款游戏进行一些理论分析,比如最近他就对皮皮和毛毛的战士很感兴趣.[题目描述]游戏的地图可…
确定比赛名次 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10358    Accepted Submission(s): 4046 Problem Description 有N个比赛队(1<=N<=500),编号依次为1,2,3,....,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接…
Here N (N ≥ 3) rabbits are playing by the river. They are playing on a number line, each occupying a different integer. In a single move, one of the outer rabbits jumps into a space between any other two. At no point may two rabbits occupy the same p…
Consider a un-rooted tree T which is not the biological significance of tree or plant, but a tree as an undirected graph in graph theory with n nodes, labelled from 1 to n. If you cannot understand the concept of a tree here, please omit this problem…
Little boxes on the hillside. Little boxes made of ticky-tacky. Little boxes. Little boxes. Little boxes all the same. There are a green boxes, and b pink boxes. And c blue boxes and d yellow boxes. And they are all made out of ticky-tacky. And they…
The ant Welly now dedicates himself to urban infrastructure. He came to the kingdom of numbers and solicited an audience with the king. He recounted how he had built a happy path in the kingdom of happiness. The king affirmed Welly’s talent and hoped…
A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integers t−1, t, t+ 1 and thatits area is an integer. Now, for given n you need to find a Heron’s triangle associated with the smallest t bigger than or equa…