上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页
摘要: 代码 //maxn是点的最大个数,首先init,然后用G加边,接下来调用dfs(根,1),ST(节点个数), //GetLca(u,v)用于查询两点的lca typedef pair<int,int> par; struct LCA { int id,ver[maxn*2],deep[maxn*2] 阅读全文
posted @ 2016-08-09 20:35 wust_ouyangli 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 题意中文我就不说了 解析: 分块+可持久化Trie,先得到前缀异或值,插入到Trie中,然后分块,对每一块,处理出dp[i][j](i代表第几块,j代表第几个位置),dp[i][j]代表以第i块开始的到j这个位置 的连续字串最大异或值。查询时,如果l,r不在同一块内,可以先查询l所在的块的后一个块到 阅读全文
posted @ 2016-08-09 10:28 wust_ouyangli 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 中文题题意我就不说了 解析: 可持久化Trie的模板题,详见注释 代码 #include<cstdio> #include<cstring> #include<string> #include<algorithm> using namespace std; const int maxbit=19; 阅读全文
posted @ 2016-08-08 21:10 wust_ouyangli 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 题意: 给出一个9*9的矩阵,有一些格子已经填了数,有一些是.代表未填。求任意一组解使得每行包含1~9,每列包含1~9,每个小矩形(3*3)包含1~9。 解析: 精确覆盖DLX的经典题目,每一行代表要填数的情况,列共有81*4行,第一个81行代表第i行j列放了数,第二个81列代表第i行放的数k,第三 阅读全文
posted @ 2016-08-08 18:41 wust_ouyangli 阅读(529) 评论(0) 推荐(0) 编辑
摘要: 代码 struct DLX { int n,id; int L[maxn],R[maxn],U[maxn],D[maxn]; int C[maxn],S[maxn],loc[maxn][2]; int H[ms]; void init(int nn=0) //传列长 { n=nn; for(int 阅读全文
posted @ 2016-08-08 16:04 wust_ouyangli 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Description After solving Solution to the n Queens Puzzle by constructing, LoadingTime wants to solve a harder version of the N-Queen Problem. Some qu 阅读全文
posted @ 2016-08-08 16:01 wust_ouyangli 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 代码 const int ChSize=5; struct PerTrie { int next[maxn*20][ChSize]; int id,inf[maxn*20]; void init() { memset(next[0],0,sizeof(next[0])); inf[0]=0; id= 阅读全文
posted @ 2016-08-08 11:05 wust_ouyangli 阅读(90) 评论(0) 推荐(0) 编辑
摘要: 代码 struct DLX { int n,id; int L[maxn],R[maxn],U[maxn],D[maxn]; int C[maxn],S[maxn],loc[maxn][2]; int H[ms]; void init(int nn=0) //传列长 { n=nn; for(int 阅读全文
posted @ 2016-08-07 20:47 wust_ouyangli 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Problem Description sevenzero liked Warcraft very much, but he haven't practiced it for several years after being addicted to algorithms. Now, though 阅读全文
posted @ 2016-08-07 20:10 wust_ouyangli 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 代码 struct DLX { int n,id; int L[maxn],R[maxn],U[maxn],D[maxn]; int C[maxn],S[maxn],loc[maxn][2]; void init(int nn=0) //传列长 { n=nn; for(int i=0;i<=n;i+ 阅读全文
posted @ 2016-08-07 20:08 wust_ouyangli 阅读(280) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页