摘要: 题目链接: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) 编辑