摘要: 题目链接:http://poj.org/problem?id=3207#include #include #include #include #include #include #include #define maxn 1050#define maxe 550 #define INF 0x3f3f3fusing namespace std;struct TwoSat{ int n; vector G[maxe*2]; bool mark[maxe*2]; int s[maxe*2],cnt; void init(int n){ this-... 阅读全文
posted @ 2013-08-04 02:07 等待最好的两个人 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3062#include #include #include #include #include #include #include #define maxn 1250#define INF 0x3f3f3fusing namespace std;struct TwoSat{ int n; vector G[maxn*2]; bool mark[maxn*2]; int s[maxn*2],cnt; void init(int n){ this-... 阅读全文
posted @ 2013-08-04 02:05 等待最好的两个人 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4632用点容斥原理转移状态,dp[i][j]=dp[i+1][j]+dp[i][j-1]-dp[i+1][j-1]当 s[i] == s[j], 要加上dp[i+1][j-1] + 1;我就是想的太复杂,而这个题有卡时间,无限TLE,悲剧啊!#include #include #include #include #include #include #include #define maxn 1050#define INF 0x3f3f3fusing namespace std;const int.. 阅读全文
posted @ 2013-08-02 17:22 等待最好的两个人 阅读(210) 评论(1) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3469#include #include #include #include #include #include #include #define maxn 23000#define maxe 242000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t; int head[maxn]; int cur[maxn]; E... 阅读全文
posted @ 2013-08-02 11:53 等待最好的两个人 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1236#include #include #include #include #include #include #include #define maxn 105#define INF 0x3f3f3fusing namespace std;bool G1[maxn][maxn],G2[maxn][maxn];vector s;int vis[maxn],sccnum[maxn],scc_cnt;int N;int in[maxn],out[maxn];/* void dfs(int u){ vis[u] = true;... 阅读全文
posted @ 2013-08-02 01:00 等待最好的两个人 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1161#include #include #include #include #include #include #include #define maxn 400#define INF 0x3f3f3f#define min(a,b) (a>b?b:a)using namespace std;int first[maxn][maxn]; int d[maxn][maxn];vector G[maxn];int N,M,L;int mem[35];void floyd(){ for(int k=1;k<=M;k++) 阅读全文
posted @ 2013-08-01 22:24 等待最好的两个人 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1611#include #include #include #include #include #include #include #define maxn 30050#define INF 0x3f3f3fusing namespace std;int pa[maxn]; int find(int x){ return x == pa[x] ? x : pa[x] = find(pa[x]);}int main(){ int n,m; while(scanf("%d%d",&n,&m)){ . 阅读全文
posted @ 2013-07-31 21:14 等待最好的两个人 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3084本题主要在构图上,我采用的是把要保护的房间与源点相连,有intruder的与汇点相连,相对麻烦。#include #include #include #include #include #include #include #define maxn 30#define maxe 5000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t... 阅读全文
posted @ 2013-07-31 16:53 等待最好的两个人 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2609#include #include #include #include #include #include #include #define maxn 450#define maxe 100000 using namespace std;const int INF = 0x3f3f3f;struct Edge{ int from,to,cap,flow; int next;};struct Dinic{ int s,t; int h... 阅读全文
posted @ 2013-07-31 13:52 等待最好的两个人 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hrbeu.edu.cn/index.php?act=problem&id=1223 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 9 #define maxn 11510 using namespace std;11 12 const int INF = 0x3f3f3f;13 14 struct Point{15 double x,y;16 bool operator G[s][i]){46 ... 阅读全文
posted @ 2013-07-29 20:26 等待最好的两个人 阅读(204) 评论(0) 推荐(0) 编辑