摘要: 题目链接 阅读全文
posted @ 2018-09-12 11:47 whymhe 阅读(470) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include using namespace std; const int N=2e4+5; const int INF=0x7fffffff; inline int read() { char c=getchar();int num=0; for(;!isdigit(c);c=getchar()); for(... 阅读全文
posted @ 2018-09-12 11:43 whymhe 阅读(103) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; const int N=5e3+5; int n,m,k; long long p[N]; long long sum[N]; long long dp[N][N]; int main() { scanf("%d%d%d",&n,&m... 阅读全文
posted @ 2018-09-12 11:42 whymhe 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题目背景 这是一道模板题 可以使用bitset,CDQ分治,K-DTree等方式解决。 题目描述 有 nn 个元素,第 ii 个元素有 a_iai​、b_ibi​、c_ici​ 三个属性,设 f(i)f(i) 表示满足 a_j \leq a_iaj​≤ai​ 且 b_j \leq b_ibj​≤bi 阅读全文
posted @ 2018-09-12 11:40 whymhe 阅读(260) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int N=3e6+5; const int M=1e7+5; inline int read() { char c=getchar();int num=0; for(;!isdigit(c);c=getchar()); fo... 阅读全文
posted @ 2018-09-12 11:40 whymhe 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目描述 输入输出格式 输入格式: 输入文件名:TRO.IN 输入文件仅有一行,不超过500000个字符,表示一个二叉树序列。 输出格式: 输出文件名:TRO.OUT 输出文件也只有一行,包含两个数,依次表示最多和最少有多少个点能够被染成绿色。 输入输出样例 输入样例#1: 复制 112200201 阅读全文
posted @ 2018-09-12 11:39 whymhe 阅读(170) 评论(0) 推荐(0) 编辑
摘要: //P1032 字串变换 #include #include #include #include #include #include #include #include using namespace std; int n; string S,F; string ori[50],to[50]; int LS,LF; struct STA { string s; int a... 阅读全文
posted @ 2018-09-12 11:38 whymhe 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 题目描述 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏。游戏一开始,Lostmonkey在地上沿着一条直线摆上n个装置,每个装置设定初始弹力系数ki,当绵羊达到第i个装置时,它会往后弹ki步,达到第i+ki个装置,若不存在第i+ki个装置,则 阅读全文
posted @ 2018-09-12 11:37 whymhe 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 题目背景 动态树 题目描述 给定n个点以及每个点的权值,要你处理接下来的m个操作。操作有4种。操作从0到3编号。点从1到n编号。 0:后接两个整数(x,y),代表询问从x到y的路径上的点的权值的xor和。保证x到y是联通的。 1:后接两个整数(x,y),代表连接x到y,若x到y已经联通则无需连接。 阅读全文
posted @ 2018-09-12 11:36 whymhe 阅读(218) 评论(0) 推荐(0) 编辑
摘要: //Pro:P2147 洞穴勘测 #include #include #include #include #include using namespace std; const int N=1e4+5; int c[N][2],f[N]; bool rev[N]; int st[N],t; inline bool get(int x) { return c[f[x]][1]==... 阅读全文
posted @ 2018-09-12 11:36 whymhe 阅读(135) 评论(0) 推荐(0) 编辑
摘要: // luogu-judger-enable-o2 #include #include #include #include using namespace std; const int N=3e5+5; int f[N],c[N][2]; bool rev[N]; int st[N],t; inline bool get(int x) { return c[f[x]][1]==x;... 阅读全文
posted @ 2018-09-12 11:35 whymhe 阅读(158) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; const int N=1e4+5; int n,m1,m2; int s[N],prime[N],maxn,t=2,c,ans=0x7fffffff,l; int main() { scanf("%d%d%d",&n,&m1,&m2); f... 阅读全文
posted @ 2018-09-12 11:33 whymhe 阅读(259) 评论(0) 推荐(0) 编辑
摘要: //Pro: P3375 【模板】KMP字符串匹配 #include #include #include #include #include using namespace std; const int N=1e6+5; char a[N],b[N]; int nxt[N]; int main() { scanf("%s",a+1); scanf("%s",b+1); ... 阅读全文
posted @ 2018-09-12 11:32 whymhe 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目描述 根据一些书上的记载,上帝的一次失败的创世经历是这样的: 第一天, 上帝创造了一个世界的基本元素,称做“元”。 第二天, 上帝创造了一个新的元素,称作“α”。“α”被定义为“元”构成的集合。容易发现,一共有两种不同的“α”。 第三天, 上帝又创造了一个新的元素,称作“β”。“β”被定义为“α 阅读全文
posted @ 2018-09-12 11:31 whymhe 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 题目背景 感谢hzwer的点分治互测。 题目描述 给定一棵有n个点的树 询问树上距离为k的点对是否存在。 输入输出格式 输入格式: n,m 接下来n-1条边a,b,c描述a到b有一条长度为c的路径 接下来m行每行询问一个K 输出格式: 对于每个K每行输出一个答案,存在输出“AYE”,否则输出”NAY 阅读全文
posted @ 2018-09-12 11:30 whymhe 阅读(270) 评论(0) 推荐(0) 编辑
摘要: 题目描述 小Y来到了一个新的城市旅行。她发现了这个城市的布局是网格状的,也就是有n条从东到西的道路和m条从南到北的道路,这些道路两两相交形成n*m个路口 (i,j)(1<=i<=n,1<=j<=m)。 她发现不同的道路路况不同,所以通过不同的路口需要不同的时间。通过调查发现,从路口(i,j)到路口( 阅读全文
posted @ 2018-09-12 11:29 whymhe 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题目描述 给你一棵TREE,以及这棵树上边的距离.问有多少对点它们两者间的距离小于等于K 输入输出格式 输入格式: N(n<=40000) 接下来n-1行边描述管道,按照题目中写的输入 接下来是k 输出格式: 一行,有多少对点之间的距离小于等于k 输入输出样例 输入样例#1: 复制 7 1 6 13 阅读全文
posted @ 2018-09-12 11:28 whymhe 阅读(187) 评论(0) 推荐(0) 编辑
摘要: //Pro: P2375 [NOI2014]动物园 //题意:求1 #include #include #include #include using namespace std; const int N=1e6+5; const int mod=1e9+7; int n,len; int nxt[N],num[N]; char s[N]; long long ans; int main... 阅读全文
posted @ 2018-09-12 11:27 whymhe 阅读(211) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std; inline int read() { char c=getchar();int num=0; for(;!isdigit(c);c=getchar()); for(;isdigit(c);c=getchar()) num=... 阅读全文
posted @ 2018-09-12 11:26 whymhe 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Description 轮状病毒有很多变种,所有轮状病毒的变种都是从一个轮状基产生的。一个N轮状基由圆环上N个不同的基原子和圆心处一个核原子构成的,2个原子之间的边表示这2个原子之间的信息通道。如下图所示 N轮状病毒的产生规律是在一个N轮状基中删去若干条边,使得各原子之间有唯一的信息通道,例如共有1 阅读全文
posted @ 2018-09-12 11:25 whymhe 阅读(123) 评论(0) 推荐(0) 编辑