状态转移:dp[state][i]=sigma(dp[state'][i-1]);state和state'都是合法状态更多的注释在代码中View Code #include<cstdio>#include<cstring>int dp[13][1<<13];int cur[15];int state[1<<13];int m,n,tot;const int mod = 100000000;bool ok(int state){ if(state&(state<<1)) return false; return Read More
posted @ 2012-02-18 21:08 Because Of You Views(282) Comments(0) Diggs(0) Edit
hdu 2768,两个投票者矛盾的话就连一条边,总数减去最大匹配数就是要求的答案#include<cstdio>#include<cstring>#include<string>#include<vector>#include<iostream>using namespace std;bool vis[501];int match[501];vector<int> g[501];string a[505],b[505];bool dfs(int u){ for(int i=0;i<g[u].size();i++) { Read More
posted @ 2012-02-18 19:22 Because Of You Views(753) Comments(1) Diggs(0) Edit