[BZOJ4276][ONTAK2015]Bajtman i Okrągły Robin Description 有n个强盗,其中第i个强盗会在[a[i],a[i]+1],[a[i]+1,a[i]+2],...,[b[i]-1,b[i]]这么多段长度为1时间中选出一个时间进行抢劫,并计划抢走c[i]元.作为保安,你在每一段长度为1的时间内最多只能制止一个强盗,那么你最多可以挽回多少损失呢? Input 第一行包含一个正整数n(1<=n<=5000),表示强盗的个数. 接下来n行,每行包含三个正…
建立线段树, S向每个叶子连边,容量1,费用0. 孩子向父亲连边,容量inf,费用0. 每个强盗向T连边,容量1,费用为c[i]. 对应区间内的点向每个强盗,容量1,费用0. 求最大费用流即可. #include<cstdio> const int inf=~0U>>2,N=15010,M=1000000; int n,i,A,B,C,ans,cl[N],cr[N],tot=1;unsigned short l,r; int u[M],v[M],c[M],co[M],nxt[M],…
Bajtman i Okrągły Robin 题目描述 你是一个保安,你发现有n个强盗,其中第i个强盗会在[a[i],a[i]+1],[a[i]+1,a[i]+2],...,[b[i]-1,b[i]]这么多段长度为1时间进行抢劫,并计划抢走c[i]元.你在一个强盗任何一个作案的时间阻止他,你就可以挽回这个强盗带来的损失.显然,对于每个强盗,你只能挽回一次损失.不幸的是,你在每一段长度为1的时间内最多只能制止一个强盗,那么你最多可以挽回多少损失呢? 输入 第一行包含一个正整数n(1<=n<=5…
Problem G: Array C Time Limit: 1 Sec Memory Limit: 128 MB Description Giving two integers and and two arrays and both with length , you should construct an array also with length which satisfied: 1.0≤Ci≤Ai(1≤i≤n) 2. and make the value S be min…
1112 - Curious Robin Hood PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 64 MB Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another tri…
G. Raffles 题目连接: http://www.codeforces.com/contest/626/problem/G Description Johnny is at a carnival which has n raffles. Raffle i has a prize with value pi. Each participant can put tickets in whichever raffles they choose (they may have more than o…