摘要: Description Description Description Description Artsem is on vacation and wants to buy souvenirs for his two teammates. There are n souvenir shops alo 阅读全文
posted @ 2018-04-21 08:54 Zsnuo 阅读(331) 评论(0) 推荐(0) 编辑
摘要: Description Miceren likes playing with brackets. There are N brackets on his desk forming a sequence. In his spare time, he will do Q operations on th 阅读全文
posted @ 2018-04-21 08:02 Zsnuo 阅读(177) 评论(0) 推荐(0) 编辑
摘要: Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of t 阅读全文
posted @ 2018-04-21 07:11 Zsnuo 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 原题链接 Description Description Ember和Storm正在玩游戏。首先,Ember构造一棵n个节点且每个节点度数不超过d的带节点编号的树T。然后,Storm选择两个不同的节点u和v,并写下从u到v路径上的节点编号,记为序列 a1, a2... ak 。最后,Ember在序列 阅读全文
posted @ 2018-04-21 06:32 Zsnuo 阅读(433) 评论(0) 推荐(0) 编辑
摘要: 【splay】 〖模板代码〗 1 void rotate(int x,int& k) 2 { 3 int y=fa[x],z=fa[y],l,r; 4 l=(tr[y][1]==x);r=l^1; 5 if(y==k)k=x; 6 else tr[z][tr[z][1]==y]=x; 7 fa[x] 阅读全文
posted @ 2018-04-20 19:45 Zsnuo 阅读(305) 评论(0) 推荐(0) 编辑
摘要: 【点分治】 〖模板代码〗 1 void getroot(int x,int fa) 2 { 3 sz[x]=1;mx[x]=0; 4 for(int i=first[x];i;i=e[i].next) 5 { 6 int to=e[i].to; 7 if(to==fa||vis[to])contin 阅读全文
posted @ 2018-04-20 19:15 Zsnuo 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 【最近公共祖先】 〖模板代码〗 [倍增算法] 1 void dfs(int k) 2 { 3 for(int i=1;(1<<i)<=deep[k];i++) 4 x[k][i]=x[x[k][i-1]][i-1]; 5 for(int i=head[k];i;i=e[i].next) 6 { 7 阅读全文
posted @ 2018-04-20 06:58 Zsnuo 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 【插头dp】 〖相关资料〗 《基于连通性状态压缩的动态规划问题》 《插头DP——从不会到崩溃》 〖相关题目〗 1.【Ural1519】Formula 1 题意:给一个n×m的棋盘,其中'.'是空白,'*'是障碍,求经过所有点的哈密顿回路的数目。 分析:见资料 1 #include<cstdio> 2 阅读全文
posted @ 2018-04-20 06:51 Zsnuo 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 1.【bzoj 4552】[Tjoi2016&Heoi2016]排序 题意:给出一个1到n的全排列,现在对这个全排列序列进行m次局部排序。排序分为两种:(0,l,r)表示将区间[l,r]的数字升序排序;(1,l,r)表示将区间[l,r]的数字降序排序。最后询问第q位置上的数字。 分析:二分答案,将所 阅读全文
posted @ 2018-04-19 21:33 Zsnuo 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 【堆排序】 〖模板代码〗 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #define LL long long 5 using namespace std; 6 const int N=1e5+10; 7 int n, 阅读全文
posted @ 2018-04-19 21:30 Zsnuo 阅读(242) 评论(0) 推荐(0) 编辑