摘要: 题目链接 "luogu P1533 可怜的狗狗" 题解 主席树. 代码 c++ include include include using namespace std; const int N = 300001; int ls[N 20],rs[N 20],sum[N 20]; int n,m,a[ 阅读全文
posted @ 2018-04-28 21:51 zzzzx 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 做水题好爽... 展开式子 就是最大化$2 a_i b_i$ 显然令大的乘大的能最大化上式 相当于用最小步数把1序列转化为2序列 映射后求逆序对. c++ include include include inline int read() { int x = 0,f = 1; char c = ge 阅读全文
posted @ 2018-04-28 20:38 zzzzx 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj1007: [HNOI2008]水平可见直线" 题解 显然,维护一个下凸壳~~(是这么叫吧)~~ 按斜率小及大排序 引入直线a 令直线a斜率小与等于直线b时 令a挡住b 那么a与b之前相交的直线c的交点必然在b与c交点的左边 这样a与b的交点才会在直线c的左边 用单调栈维护 斜率 阅读全文
posted @ 2018-04-28 19:35 zzzzx 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj1294: [SCOI2009]围豆豆Bean" 题解 对豆豆进行装压 令dp[i][j][k]表示从i,j出发,把状态为k豆豆的围起来的最小话费 spfa转移 在进行状态的转移的时候,我们需要得到下一个位置的豆豆状态 利用 "射线法" 判断是否在多边形内部,从该豆豆点向右引出一 阅读全文
posted @ 2018-04-28 19:26 zzzzx 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 题目链接 "bzoj3886:[Usaco2015 Jan]Moovie Mooving" 题解 看数据范围 每场电影只能看一次 我们可以对电影进行装压 令dp[i]表示看过状态为i的电影,最多能不间断看多少 然后在电影开始时间中二分转移就好了 ps:以下代码有一个点(样例)在linux下过不去,w 阅读全文
posted @ 2018-04-28 19:17 zzzzx 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 搜索+dp c++ // luogu judger enable o2 include include include const int maxn = 607; int n,m; int map[maxn][maxn]; int fs[5] = {1,0, 1,0,1}; bool vis[max 阅读全文
posted @ 2018-04-28 10:44 zzzzx 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 二项式定理 ~~组合数取膜~~ 费马小定理 c++ include using namespace std; define mod 10007 define int long long int pow(int a,int b) { int ret = 1; for(;b;b = 1 , a = a 阅读全文
posted @ 2018-04-28 10:43 zzzzx 阅读(140) 评论(0) 推荐(0) 编辑