摘要:// 题目描述:一个项目被分成几个部分,每部分必须在连续的天数完成。也就是说,如果某部分需要3天才能完成,则必须花费连续的3天来完成它。对项目的这些部分工作中,有4种类型的约束:FAS, FAF, SAF和SAS。两部分工作之间存在一个FAS约束的含义是:第一部分工作必须在第二部分工作开始之后完成; Xa+Ta>=XbFAF约束的含义是:第一部分工作必须在第二部分工作完成之后完成; Xa+Ta>=Xb+TbSAF的含义是:第一部分工作必须在第二部分工作完成之后开始; Xa>=Xb+TbSAS的含义是:第一部分工作必须在第二部分工作开始之后开始。 Xa>=Xb假定参与项目
阅读全文
摘要:// n头牛 按1到n顺序站 当然 i可以和i+1站一起 不过不能站i+1后面// 现在给你些约束 前ml个约束 a,b,d a=0这个约束( 其中 a,b相邻 b编号比a大) 具体见代码#include #include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxn 21010#define maxm 1010struct node{ int to; int next; int val;}E[maxn];int ...
阅读全文
摘要:// 题意 问是否存在一个长度为n的序列// 这个序列满足m个限制// 每个限制有 si ni oi kisi 为序列位置 ni为从si开始连续长度为ni+1 的子序列 这些子序列和 大于或小于 ki 大于或小于要看oi了// 令 s[i]表示 前 i个数字和 那么// s[si+ni]-s[si-1]>k 或 #include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxn 5010#define maxm 510st
阅读全文
摘要:// 思路 :// 图建好后 剩下的就和上一篇的 火烧连营那题一样了 求得解都是一样的 // 所以稍微改了就过了 // 最下面还有更快的算法 速度是这个算法的2倍#include #include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxn 150010#define maxm 50010struct node{ int to; int next; int val;}E[maxn];int num;int V[max...
阅读全文
摘要:// 差分约束系统// 火烧连营 // n个点 m条边 每天边约束i到j这些军营的人数 n个兵营都有容量// Si表示前i个军营的总数 那么 1.Si-S(i-1)=k => S(i-1)-Sj=m 中符合条件的m最大值就是答案// 等价 S0-Sn#include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxn 20010 // 开始我天真了 maxn=10010 和 m 差不错大 WA的好难过 图中边数应该为 m+.
阅读全文
摘要:题意就是 给你 n个点 m条边 每条边有些公司支持 问 a点到b点的路径有哪些公司可以支持 这里是一条路径中要每段路上都要有该公司支持 才算合格的一个公司// floyd 加 位运算// 将每个字符当成二进制中的一位就好#include #include #include #include #include #include #include #include using namespace std;#define MOD 1000000007#define maxn 210int dp[maxn][maxn];int main(){ int n; int A,B; c...
阅读全文
摘要:Silver Cow PartyTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 9222Accepted: 4156DescriptionOne 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
阅读全文
摘要:Invitation CardsTime Limit: 8000MSMemory Limit: 262144KTotal Submissions: 15101Accepted: 4897DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. T
阅读全文
摘要:ZOJ Problem Set - 1232Adventure of Super MarioTime Limit: 2 Seconds Memory Limit: 65536 KBAfter rescuing the beautiful princess, Super Mario needs to find a way home -- with the princess of course :-) He's very familiar with the 'Super Mario World', so he doesn't need a map, he only
阅读全文
摘要:Cave RaiderTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 551Accepted: 171DescriptionAfkiyia is a big mountain. Inside the mountain, there are many caves. These caves are connected by tunnels. Hidden in one of the caves is a terrorist leader. Each tunnel connects two caves. There could be
阅读全文
摘要:ArbitrageTime Limit: 2 Seconds Memory Limit: 65536 KBArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 British pound, 1 British pound buys 10.0 French fr...
阅读全文
摘要:Transport GoodsTime Limit: 2 Seconds Memory Limit: 65536 KBThe HERO country is attacked by other country. The intruder is attacking the capital so other cities must send supports to the capital. There are some roads between the cities and the goods must be transported along the roads.According ...
阅读全文
摘要:FDNY to the Rescue!Time Limit: 2 Seconds Memory Limit: 65536 KBThe Fire Department of New York (FDNY) has always been proud of their response time to fires in New York City, but they want to make their response time even better. To help them with their response time, they want to make sure that...
阅读全文
摘要:Idiomatic Phrases GameTime Limit: 2 Seconds Memory Limit: 65536 KBTom is playing a game called Idiomatic Phrases Game. An idiom consists of several Chinese characters and has a certain meaning. This game will give Tom two idioms. He should build a list of idioms and the list starts and ends wit...
阅读全文
摘要:Domino EffectTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 6086Accepted: 1546DescriptionDid you know that you can use domino bones for other things besides playing Dominoes? Take a number of dominoes and build a row by standing them on end with only a small distance in between. If you do
阅读全文
摘要:昂贵的聘礼Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 26818Accepted: 7477Description年 轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿 不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要 5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换,或者替他弄来其
阅读全文
摘要:Minimum Transport CostTime Limit: 2 Seconds Memory Limit: 65536 KBThese are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should be delivered from one city to another. The transportation fee consists of two part...
阅读全文
摘要:Bus SystemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3746Accepted Submission(s): 943Problem DescriptionBecause of the huge population of China, public transportation is very important. Bus is an important transportation method in traditional p
阅读全文
摘要:六度分离Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1360Accepted Submission(s): 528Problem Description1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degree
阅读全文
摘要:最短路径问题Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4184Accepted Submission(s): 1249Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是
阅读全文