http://poj.org/problem?id=1275 题目大意: 一商店二十四小时营业,但每个时间段需求的雇员数不同(已知,设为R[i]),现有n个人申请这份工作,其可以从固定时间t连续工作八个小时,问在满足需求的情况下最小需要多少个雇员. 思路: 挺难的..看了别人的思路搞半天.. 设num[ i ]为i时刻能够开始工作的人数,x[ i ]为实际雇佣的人数,那么x[ I ]<=num[ I ]. 设r[ i ]为i时刻至少需要工作的人数,于是有如下关系: x[ I-7 ]+x[ I-6…
Cashier Employment Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7651 Accepted: 2886 Description A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hir…
A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hired you to help him, solve his problem. The problem is that the supermarket needs different number of cashiers at d…
http://poj.org/problem?id=3169 http://acm.hdu.edu.cn/showproblem.php?pid=3592 题目大意: 一些母牛按序号排成一条直线.有两种要求,A和B距离不得超过X,还有一种是C和D距离不得少于Y,问可能的最大距离.如果没有输出-1,如果可以随便排输出-2,否则输出最大的距离. 思路: 对于第一种 B - A <=X 第二种有 D - C >=Y也就是 C-D<=-Y 还有就是题目要求的是按照序号升序排. 然后又不等式3…
http://poj.org/problem?id=2983 题目大意: 星际大战开始了.你购买了情报,需要判断它的准确性.已知地方的根据地在由南向北排成一条直线.P A B X,表示A在B北面距离X光年的地方,另一种是V A B,表示只知道A在B的北面至少1光年的地方. 思路: 可转化为差分约束. 对于P A B X来说因为A-B=X (因为他们相距X光年,我们取北边为正方向) 可以记做: A-B >=X && A-B<=X,即A-B>=X && B…
题目: Description A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hired you to help him, solve his problem. The problem is that the supermarket needs different number…
原题:ZOJ 3668 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3668 典型差分约束题. 将sum[0] ~ sum[n] 作为节点,A<=sum[R]-sum[L-1]<=B可以分别建边: x(L-1)-->xR w = B xR --> x(L-1) w = -A 注意还有 -10000<=sum[i]-sum[i-1]<=10000 (for i in (2,n)),所以相邻点…
http://acm.hdu.edu.cn/showproblem.php?pid=1531 King Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1992 Accepted Submission(s): 928 Problem Description Once, in one kingdom, there was a quee…
Intervals Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4181 Accepted Submission(s): 1577 Problem Description You are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.…
[POJ 1275] Cashier Employment(差分约束系统的建立和求解) Cashier Employment Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7569 Accepted: 2856 Description A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to f…
Cashier Employment Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1214 Accepted Submission(s): 537 Problem Description A supermarket in Tehran is open 24 hours a day every day and needs a nu…
Cashier Employment Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7997 Accepted: 3054 Description A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hir…