shunfurh 于 2017.01.03 17:01 提问

Gangsters

Description

N gangsters are going to a restaurant. The i-th gangster comes at the time Ti and has the prosperity Pi. The door of the restaurant has K+1 states of openness expressed by the integers in the range [0, K]. The state of openness can change by one in one unit of time; i.e. it either opens by one, closes by one or remains the same. At the initial moment of time the door is closed (state 0). The i-th gangster enters the restaurant only if the door is opened specially for him, i.e. when the state of openness coincides with his stoutness Si. If at the moment of time when the gangster comes to the restaurant the state of openness is not equal to his stoutness, then the gangster goes away and never returns.
The restaurant works in the interval of time [0, T].
The goal is to gather the gangsters with the maximal total prosperity in the restaurant by opening and closing the door appropriately.
Input

?The first line of the input file contains the values N, K, and T, separated by spaces. (1 <= N <= 100 ,1 <= K <= 100 ,0 <= T <= 30000 )
?The second line of the input file contains the moments of time when gangsters come to the restaurant T1, T2, ..., TN, separated by spaces. ( 0 <= Ti <= T for i = 1, 2, ..., N)
?The third line of the input file contains the values of the prosperity of gangsters P1, P2, ..., PN, separated by spaces. ( 0 <= Pi <= 300 for i = 1, 2, ..., N)
?The forth line of the input file contains the values of the stoutness of gangsters S1, S2, ..., SN, separated by spaces. ( 1 <= Si <= K for i = 1, 2, ..., N)
All values in the input file are integers.
Output

Print to the output file the single integer ?the maximal sum of prosperity of gangsters in the restaurant. In case when no gangster can enter the restaurant the output should be 0.
Sample Input

4 10 20
10 16 8 16
10 11 15 1
10 7 1 8
Sample Output

26

1个回答

caozhy      2017.01.09 23:53

UVA 672 - Gangsters（dp)
Gangsters  N gangsters are going to a restaurant. The i-th gangster comes at the time Ti and has the prosperity Pi. The door of the restaurant has K+1 states of openness expressed by th
Economic Gangsters
Chapter One Fighting For Economic Development 1 Chapter Two Suharto, Inc. 22 Chapter Three The Smuggling Gap 53 Chapter Four Nature or Nurture? Understanding the Culture of Corruption 76 Chapter Five No Water, No Peace 111 Chapter Six Death by a Thousand Small Cuts 136 Chapter Seven The Road Back From War 159 Chapter Eight Learning to Fight Economic Gangsters 186 Epilogue Doing Better This Time 207
POJ1036 Gangsters

poj1036 Gangsters

POJ 1036 Gangsters
http://poj.org/problem?id=1036 Description N gangsters are going to a restaurant. The i-th gangster comes at the time Ti and has the prosperity Pi. The door of the restaurant has K+1 states of o
UVA 672 Gangsters

URAL 1409. Two Gangsters
1409. Two Gangsters Time limit: 1.0 second Memory limit: 64 MB Two gangsters Harry and Larry had a rest at countryside. They decided to spend some time shooting, so they put several beer ca
soj 1679 Gangsters(dp)
@(K ACMer)题意: 有一个店铺,他的门的宽度在[0,k][0, k]可调剂,每个单位时间可以调节一位或者不变.有n个枪手会走来,每个枪手有直接的身体宽度,荣耀度和来的时间.只有当门的宽度恰好等于枪手的宽度的时候他们才会进来.问在[0,T][0, T]的时间内店铺可以进来的最大荣耀度是多少?(门的宽度由你调节) 分析: 这个其实类似一个背包,每来一个人我们要满足或者不满足他,这些人来的顺
poj 1036 Gangsters

poj 1036 Gangsters（DP）