1831: 周末出游 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 22  Solved: 8 SubmitStatusWeb Board Description 周末天气真好,大家组织一起出去玩(玩你妹,不好好学习),可是,有些人要知道(有好朋友了不起呀)自己最要好的朋友接受邀请了,他才会去,只有邀请到他们最好的朋友才会去(贱人就是矫情).可是作为负责人的你(冤大头)必须判断是否能够办好这次聚会(气死爸爸拉,哼),邀请到所有的人. Input…
  Codeforces Round #267 (Div. 2) CF#267D D - Fedor and Essay D. Fedor and Essay time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After you had helped Fedor to find friends in the «Call of S…
You are given nn integer numbers a1,a2,…,ana1,a2,…,an. Consider graph on nn nodes, in which nodes ii, jj (i≠ji≠j) are connected if and only if, aiaiAND aj≠0aj≠0, where AND denotes the bitwise AND operation. Find the length of the shortest cycle in th…
#include<iostream> #include<algorithm> #include<string.h> #include<stdio.h> #include<queue> #include <vector> #include <map> int s,t; int n,m; using namespace std; ; struct Node{ int to; int w; }; struct Node temp…
Vertex Coloring PAT-1154 #include<iostream> #include<cstring> #include<string> #include<algorithm> #include<cstdio> #include<sstream> #include<set> #include<map> #include<cmath> #include<vector>…
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=2647 老板给员工发工资,每个人的基本工资都是888,然后还有奖金,然后员工之间有矛盾,有的员工希望比某员工的奖金多,老板满足了所以员工的这种心思,而且老板下午发的总工资最少,问最少是多少?比如 a b 表示a的工资比b要高(高一块钱),当出现a b   b c   c a这种环的时候输出-1 拓扑排序http://www.cnblogs.com/tonghao/p/4721072.html 小指向大…
After hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has committed to create a bovine marathon for his cows to run. The marathon route will include a pair of farms and a path comprised of a se…
T1 sign 题目大意:给出一棵 N 个节点的树,求所有起点为叶节点的有向路径,其 上每一条边权值和的和.N<=10000 水题.考试的时候毒瘤出题人(学长orz)把读入顺序改了一下,于是很多人爆零(包括我QAQ. 先dfs序把以$i$为根的子树大小$size[i]$和所含叶子结点个数$s[i]$求出.考虑每条边对答案的贡献. 1.子树里的叶子结点往外走,这一部分的贡献为$s[i]*(n-size[i])*dis$ 2.子树外的叶子结点往里走,这一部分的贡献为$(sum-s[i])*size[…
题意: 有两家公司都想向政府申请某些资源的使用权,并且他们都提供了一些申请列表,列表中含有申请费用和资源种类,同一家公司的申请列表之间不含有重复的资源.政府只可以完整地接受和拒绝谋一份申请列表,问政府的最大收益是多少. SOL: 建图很糜啊...神一样的建图,虽然这种类型...怎么说呢...反正就是这种类型...都会去想到最小割但是建不来图... 因为题目有点看不懂...感觉树上跟题目完全是两个题目...(今天完全没有状态...) 也没有什么打的心情...就贴一下别人的题解学习以下这样建图好了…
Problem D: Candy As a teacher of a kindergarten, you have many things to do during a day, one of which is to allot candies to all children in your class. Today you have N candies for the coming M children. Each child likes different candy, and as a t…