紫书专题

紫书训练 7.16

https://vjudge.net/contest/311524#overview  差分约束+CDQ分治+虚树 密码:996996 差分约束的博客 https://blog.csdn.net/whereisherofrom/article/details/78922648 虚树博客 https://www.cnblogs.com/zwfymqz/p/9175152.html  虚树还没有

紫书训练 7.15

https://vjudge.net/contest/311225#overview 点分治+FFT 密码:996996 A - 聪聪可可  用q[0],q[1],q[2],分别表示距离%3的个数,那么就可以通过calc算出来了。 #include<bits/stdc++.h>#define il inline#define pb push_back#define fi first

紫书训练 7.14

https://vjudge.net/contest/310985#overview  概率dp 密码:996996 A - Another Crisis  从大bose往下,按提交申请书人数从小到大排序,优先选择前面的即可,满足它选的那个比例即可。 #include<bits/stdc++.h>#define il inline#define pb push_back#defin

紫书训练 7.13

https://vjudge.net/contest/310704  dp+点分治 密码:996996 A - Lighting System Design 这个题目毒的太累了,dp[i]代表选前i个灯最少的消费,先按电压从小到大排,方便后面的转移。 #include<bits/stdc++.h>#define il inline#define pb push_back#define

紫书训练 7.12

https://vjudge.net/contest/310440#overview   单调队列+贪心+dp 密码:996996 A - Feel Good 找到每个点以他为最小值向左向右的最大区间,用单调队列即可。 #include<cstdio>#include<iostream>#include<algorithm>#include<string>#include<cst

UVA 12627 递归找规律,紫书p245页例题

UVA - 12627 Erratic Expansion 奇怪的气球膨胀  Piotr found a magical box in heaven. Its magic power is that if you place any red balloon inside it then, after one hour, it will multiply to form 3 red

紫书第6章 数据结构基础 例题(E-H)

数据结构基础 例题E-H H-TreeG-Trees on the levelF- Dropping BallsE-Self-Assembly H-Tree Description You are to determine the value of the leaf node in a given binary tree that is the terminal node of

紫书P269-uva1347题解,结合紫书解析加入了一些个人理解

该题在vjudge上的链接 在紫书的动态规划那一节看到了这道题。结合刘汝佳的解析,在代码里加了一些个人的理解,已经提交UVA通过。 //将问题看做两个人从起点出发,不能走重复的点,计算两个人到达终点时走过的距离和#include <bits/stdc++.h>#define mem(a, b) memset(a, b, sizeof(a))#define scf(a) scanf("%d"