首页 > TAG信息列表 > 1821

【YBTOJ】【POJ 1821】Fence

题目大意: 有 \(n\) 块木板从左到右排成一行,有 \(m\) 个工匠对这些木板进行粉刷,每块木板至多被粉刷一次。 第 \(i\) 个木匠要么不粉刷,要么粉刷包含木板 \(S_i\) 且长度不超过 \(L_i\) 的连续的一段木板,每粉刷一块可以得到 \(P_i\) 的报酬。不同工匠的 \(S_i\) 不同。 请问如何安排

POJ 1821 Fence

http://poj.org/problem?id=1821 题目 有n块木板排成一行,有k个工人,第$i$个工人坐在第$s_i$块木板处,每刷一块木板的工钱是$p_i$,他只能选择粉刷长度不超过$l_i$,包含$s_i$的连续的一段木板,也可以不粉刷。 每块木板要么只由一个工人粉刷,要么不粉刷 问这些工人能得到的工钱的和最大是多

【POJ 1821】Fence

【原题题面】传送门 【题解大意】 当两个决策k1<k2且 f[i-1,k1] - p*k1 <= f[i-1,k2]-p*k2,那么此时k1就是无用决策。 可以用单调队列优化。 需要支持的操作: 1.当j变大时,b把小于j-L的决策出队; 2.有新的决策入队时,在队尾检查f[i-1,k]的单调性,把无用决策从队尾直接出队,然后把新决策入

【洛谷 1821】银牛派对Silver Cow Party

题目描述 One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roads connects pairs of farms; road i requires

【洛谷 1821】捉迷藏 Hide and Seek

题目描述 Bessie is playing hide and seek (a game in which a number of players hide and a single player (the seeker) attempts to find them after which various penalties and rewards are assessed; much fun usually ensues). She is trying to figure out in which of