ACM: 图论题 poj 1275 差分约束题
来源:互联网 发布:java酒店管理系统程序 编辑:程序博客网 时间:2024/05/18 17:55
The manager has provided you with the least number of cashiersneeded for every one-hour slot of the day. This data is given asR(0), R(1), ..., R(23): R(0) represents the least number ofcashiers needed from midnight to 1:00 A.M., R(1) shows this numberfor duration of 1:00 A.M. to 2:00 A.M., and so on. Note that thesenumbers are the same every day. There are N qualified applicantsfor this job. Each applicant i works non-stop once each 24 hours ina shift of exactly 8 hours starting from a specified hour, say ti(0 <= ti <= 23), exactly from thestart of the hour mentioned. That is, if the ith applicant ishired, he/she will work starting from ti o'clock sharp for 8 hours.Cashiers do not replace one another and work exactly as scheduled,and there are enough cash registers and counters for those who arehired.
You are to write a program to read the R(i) 's for i=0..23 and ti's for i=1..N that are all, non-negative integer numbers andcompute the least number of cashiers needed to be employed to meetthe mentioned constraints. Note that there can be more cashiersthan the least number needed for a specific slot.
Input
Output
If there is no solution for the test case, you should write NoSolution for that case.
Sample Input
1
1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
5
0
23
22
1
10
Sample Output
1
题意: 现在一家24小时的超市要雇佣出纳员, 每个小时段的出纳员需求都不一样, 已知24小时内的需求,
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <queue>
using namespace std;
#define MAX 26
const int INF = (1<<28);
struct node
{
}edges[MAX*MAX];
int n, num;
int t[MAX], r[MAX], first[MAX];
int dist[MAX], size[MAX];
int up, low;
bool vis[MAX];
inline void add(int u, int v, int w)
{
}
void readGraph()
{
}
bool spfa(int sum)
{
}
bool solve(int sum)
{
}
int binarySearch()
{
}
int main()
{
//
}
- ACM: 图论题 poj 1275 差分约束题
- ACM: 差分约束 图论题 poj 2983 sp…
- ACM: 图论题 poj 1201 差分约束
- ACM: spfa求解 图论题 (对差分约束…
- poj 1364 King 差分约束
- poj 1201 Intervals (差分约束)
- poj 1364 King (差分约束)
- ACM: 图论题 poj 2240 (floyd + ST…
- ACM: 图论题 poj 1135
- ACM: 图论题 poj 3…
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 3352 双连通题
- ACM: 二分法 数论题 poj 1905
- ACM: 匈牙利算法 图论题 poj 3041 …
- ACM: 有向欧拉图 图论题 poj 1386 …
- ACM: 图论题 poj 3177 同 3352
- ACM: poj 第50题 一题递推数论题 …
- ACM: 图论题 poj 3308 最大流问题
- ACM: 搜索题 poj 1020
- ACM: 图论题 poj 1201 差分约束
- ACM: 图论题 poj 1149 网络流问题
- ACM: 图论题 poj 1236 强连通
- ACM: 图论题 poj 1275 差分约束题
- 图论: 差分约束系统
- ACM: 图论题 poj 1…
- ACM: 图论题 poj 1466 最大独立团
- ACM: 图论题 poj 1…
- ACM: 动态规划题 sicily…
- ACM: 动态规划题 《黑书…
- CSDN博客关注点
- ACM: 动态规划题 poj&nb…