题意:M个影片,其属性有开始时间S,结束时间T,类型op和权值val.有K个人,每个人可以看若干个时间不相交的影片,其获得的收益是这个影片的权值val,但如果观看的影片相邻为相同的属性,那么收益要减少W.每个影片只能被一个人看.求所有人能获得的收益值之和的最大值. 分析:因为人数不定,所以贪心和dp的思路被否定了.1对多的带权匹配,求最大权,这种问题显然KM是解决不了的,那么只能是最小费用最大流了.而这题要求的是最大收益,那么建负权边即可. 为了保证每个影片只被一个人观看,将其拆为入点和出点,入…
<题目链接> 题目大意: 一天有N个小时,有m个节目(每种节目都有类型),有k个人,连续看相同类型的节目会扣w快乐值.每一种节目有都一个播放区间[l,r].每个人同一时间只能看一个节目,看完可以获得快乐值,每个节目只能被人看一次.问最多可以获得多少快乐? 解题分析: 本题用费用流求解的方式还是比较直观的.因为本题要求的是最大费用,所以我们需要建图的时候需要将所有实际费用取反,然后将最后最小费用最大流求出的答案取反,就是要求的最大费用.具体建图过程见代码: #include <bits/s…
Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2653    Accepted Submission(s): 579 Problem Description A coding contest will be held in this university, in a huge playground. The…
题目链接:http://acm.hit.edu.cn/hoj/problem/view?id=2739 Time limit : 1 sec Memory limit : 64 M A Chinese postman is assigned to a small town in China to deliver letters. In this town, each street is oriented and connects exactly two junctions. The postma…
Practice Link J. Rikka with Nickname 题意: 给出\(n\)个字符串,要求依次合并两个串\(s, t\),满足将\(t\)合并到\(s\)中变成\(r\),使得\(s\)是\(r\)的前缀,并且\(t\)是\(r\)的一个子序列. 思路: 动态维护序列自动机,贪心插入即可. 代码: #include <bits/stdc++.h> using namespace std; #define N 1000010 char s[N], res[N]; int nx…
6343.Problem L. Graph Theory Homework 官方题解: 一篇写的很好的博客: HDU 6343 - Problem L. Graph Theory Homework - [(伪装成图论题的)简单数学题] 代码: //1012-6343-数学 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<bitset&g…
Problem L.Videos Problem Description: C-bacteria takes charge of two kinds of videos: ’The Collection of Silly Games’ and ’The Collection of Horrible Games’.For simplicity’s sake, they will be called as videoA and videoB.There are some people who wan…
Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1751    Accepted Submission(s): 374 Problem Description A coding contest will be held in this university, in a huge playground. The…
A - Problem A.Alkane 留坑. B - Problem B. Beads 留坑. C - Problem C. Calculate 留坑. D - Problem D. Permutation 留坑. E - Problem E. TeaTree 题意:每个点会存下任意两个以他为LCA的点对的GCD,求每个点存的GCD的最大值 思路:DSU on tree  用 set 维护子树中的因子,对于重儿子不要处理多次 每次查找的时候,枚举轻儿子中的因子 还有一种线段树合并的写法 #i…
Special Fish Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2189    Accepted Submission(s): 826 Problem Description There is a kind of special fish in the East Lake where is closed to campus of…