上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 29 下一页
摘要: 大白书P330#include #include #include #include #include #include using namespace std;const int maxn = 1000+10;const int INF = 1000000000;struct Edge{ int... 阅读全文
posted @ 2015-03-07 12:20 来自大山深处的菜鸟 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 机场快线是市民从市内去机场的首选交通工具。机场快线分为经济线和商业线两种,线路、速度和价格都不同,你有一张商业线车票,可以坐一站商业线,而其他时候,只能乘坐经济线。假设换乘时间忽略不计,你的任务是找一条去机场最快的路线。这样我们先从起点开始做一次dijkstra 然后在从终点开始做一次dijkstr... 阅读全文
posted @ 2015-03-06 21:43 来自大山深处的菜鸟 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题意在大白书上。有3 种工作 abc 大于等于平均年龄的可以去做a c 工作, 小于平均年龄的可以去做 bc , 同样转化为2 -sat 去做, 因为对于每个人也只有2 种情况可以作为选择#include #include #include #include #include using names... 阅读全文
posted @ 2015-03-06 21:03 来自大山深处的菜鸟 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题意大白书二分答案,然后对于每个可能的答案,跑一遍2-SAT就好了。#include #include #include #include #include using namespace std;const int maxn=2000+10;struct TwoSAT{ int n; ve... 阅读全文
posted @ 2015-03-06 20:41 来自大山深处的菜鸟 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 大白书P322 , 一个有向图在添加至少的边使得整个图变成强连通图, 是计算整个图有a个点没有 入度, b 个点没有出度, 答案为 max(a,b) ; 至今不知所云。(求教)#include #include #include #include #include using namespace s... 阅读全文
posted @ 2015-03-06 16:45 来自大山深处的菜鸟 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 给一张有向图G, 求一个结点数最大的结点集,使得该结点集中任意两个结点u和v满足,要么u可以到达v, 要么v可以到达u(u和v相互可达也可以)。因为整张图可能存在环路,所以不好使用dp直接做,先采用有向图的强连通分量,进行缩点,然后得到一个有向无环图(DAG) 在采用记忆话dp 去做即可#inclu... 阅读全文
posted @ 2015-03-06 16:43 来自大山深处的菜鸟 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 大白书 P314#include #include #include #include #include #include #include using namespace std;typedef long long LL;struct Edge{int u,v; };const int maxn ... 阅读全文
posted @ 2015-03-02 16:28 来自大山深处的菜鸟 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 具体题解看大白书P316#include #include #include #include #include #include using namespace std;struct Edge{int u,v;};const int maxn = 1000+10;int pre[maxn],isc... 阅读全文
posted @ 2015-03-01 22:48 来自大山深处的菜鸟 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 对于一个序列 a1 a2 ... an 我们可以计算出一个符号矩阵A, 其中Si,j 为 a1+...+aj 的正负号,(连加和大于0则Sij=+ 小于0 Sij=- 等于0 则Sij=0), 根据序列A不难算出上述符号矩阵。你的任务是求解它的“逆问题” , 及给出一个符号矩阵,找出一个对应的序列。... 阅读全文
posted @ 2015-02-10 16:15 来自大山深处的菜鸟 阅读(211) 评论(0) 推荐(0) 编辑
摘要: D. Restoring NumbersVasya had two arrays consisting of non-negative integers:aof sizenandbof size... 阅读全文
posted @ 2015-02-03 17:11 来自大山深处的菜鸟 阅读(254) 评论(0) 推荐(0) 编辑
上一页 1 ··· 11 12 13 14 15 16 17 18 19 ··· 29 下一页