上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 40 下一页

2013年5月23日

白书上的dijkstra+堆优化/dijkstra的一些性质

摘要: 模板#include #include #include #include #include #include using namespace std; const int maxn=11111; const int maxm=11111; const int INF=1e9; struct Edge{ int from,to,dist; }; struct HeapNode{ int d,u; bool operatorrhs.d; } }; struct Dijkstra{ int n,m; vector edges; ... 阅读全文

posted @ 2013-05-23 06:23 电子幼体 阅读(176) 评论(0) 推荐(0) 编辑

LA 3713 - Astronauts 2-SAT

摘要: The Bandulu Space Agency (BSA) has plans for the following three space missions:Mission A: Landing on Ganymede, the largest moon of Jupiter.Mission B: Landing on Callisto, the second largest moon of Jupiter.Mission C: Landing on Titan, the largest moon of Saturn.Your task is to assign a crew for eac 阅读全文

posted @ 2013-05-23 05:45 电子幼体 阅读(143) 评论(0) 推荐(0) 编辑

白书上的2-SAT模板

摘要: struct TWO_SAT{ int n; vectorG[maxn*2]; bool mark[maxn*2]; int S[maxn*2],c; bool dfs(int x){ if (mark[x^1]) return false; if (mark[x]) return true; mark[x]=true; S[c++]=x; for (int i=0;in=n; for (int i=0;i0) mark[S[--c]]=false; ... 阅读全文

posted @ 2013-05-23 03:18 电子幼体 阅读(161) 评论(0) 推荐(0) 编辑

2013年5月22日

MUTC 1 B - Holedox Eating STL

摘要: Holedox EatingTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2314Accepted Submission(s): 780Problem DescriptionHoledox is a small animal which can be considered as one point. It lives in a straight pipe whose length is L. Holedox can only move alo 阅读全文

posted @ 2013-05-22 09:20 电子幼体 阅读(119) 评论(0) 推荐(0) 编辑

扩展KMP模板

摘要: #include #include #include using namespace std; const int MM=100005; int next[MM],extand[MM]; char S[MM],T[MM]; void GetNext(const char *T){ int len=strlen(T),a=0; next[0]=len; while(a= p){ int j = (p-k+1)>0 ? (p-k+1) : 0; while(k+j= p){ int j= (... 阅读全文

posted @ 2013-05-22 08:30 电子幼体 阅读(122) 评论(0) 推荐(0) 编辑

MUTC 1 A - Clairewd’s message 扩展KMP

摘要: Clairewd’s messageTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2296Accepted Submission(s): 901Problem DescriptionClairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing f 阅读全文

posted @ 2013-05-22 08:29 电子幼体 阅读(122) 评论(0) 推荐(0) 编辑

Uva 11324 - The Largest Clique 缩点 求最大团

摘要: Problem B: The Largest CliqueGiven a directed graphG, consider the following transformation. First, create a new graphT(G)to have the same vertex set asG. Create a directed edge between two verticesuandvinT(G)if and only if there is a path betweenuandvinGthat follows the directed edges only in the f 阅读全文

posted @ 2013-05-22 08:23 电子幼体 阅读(137) 评论(0) 推荐(0) 编辑

MUTC 1 E - Saving Princess claire_ 迷宫搜索

摘要: Saving Princess claire_Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1495Accepted Submission(s): 558Problem DescriptionPrincess claire_ was jailed in a maze by Grand Demon Monster(GDM) teoy.Out of anger, little Prince ykwd decides to break into t 阅读全文

posted @ 2013-05-22 03:21 电子幼体 阅读(188) 评论(0) 推荐(0) 编辑

2013年5月20日

图论模板 求割顶/判断二分图

摘要: 二分图(AC)/*=================================*\ | 节点u所在的强连通分量是否为二分图 | Call: bipartite(u); \*=================================*/ int color[maxn]; bool bipartite(int u) { for (int i=head[u];i!=-1;i=edges[i].next) { int v=edges[i].to; if (color[v]&&color[v]==color[u]) return fals... 阅读全文

posted @ 2013-05-20 16:12 电子幼体 阅读(147) 评论(0) 推荐(0) 编辑

Hdu 4547 CD操作 LCA问题

摘要: CD操作Time Limit: 10000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 320Accepted Submission(s): 88Problem Description 在Windows下我们可以通过cmd运行DOS的部分功能,其中CD是一条很有意思的命令,通过CD操作,我们可以改变当前目录。 这里我们简化一下问题,假设只有一个根目录,CD操作也只有两种方式: 1. CD 当前目录名\...\目标目录名 (中间可以包含若干目录,保证目标目录通过绝对... 阅读全文

posted @ 2013-05-20 11:14 电子幼体 阅读(156) 评论(0) 推荐(0) 编辑

上一页 1 ··· 19 20 21 22 23 24 25 26 27 ··· 40 下一页

导航