上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 120 下一页
摘要: 犯傻了,想到了如果是 0->1 的话就找最深的非 1 编号,是 1 -> 0 的话就找最深的非 0 编号. 但是没有想到这个东西可以直接维护. 假设不考虑叶子节点,那么如果当前点的值是 1 的话要求儿子节点权和 > 1 假设当前从 0->1,那么该叶子造成的影响一定是一条向上的链. 如果向上走到某一 阅读全文
posted @ 2019-11-28 20:15 EM-LGH 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 裸题,敲完后没调就过了 ~ code: #include <bits/stdc++.h> using namespace std; #define ll long long #define lson t[x].ls #define rson t[x].rs #define setIO(s) freo 阅读全文
posted @ 2019-11-28 14:24 EM-LGH 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 你发现只会改变一个位置,所以可以直接进行dp 具体转移的话用 CDQ 分治转移就好了~ #include <bits/stdc++.h> #define N 100006 #define setIO(s) freopen(s".in","r",stdin) using namespace std; 阅读全文
posted @ 2019-11-28 12:02 EM-LGH 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 不是很难想,但是细节巨多 开始一个地方想错了,然后...... code: #include <bits/stdc++.h> #define N 2000006 #define ll long long #define setIO(s) freopen(s".in","r",stdin) using 阅读全文
posted @ 2019-11-28 11:11 EM-LGH 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 最近学了一下线段树分治,感觉还蛮好用... 如果正常动态维护最大生成树的话用 LCT 就行,但是这里还有时间这一维的限制. 所以,我们就把每条边放到以时间为轴的线段树的节点上,然后写一个可撤销 LCT 就好了 ~ code: #include <bits/stdc++.h> #define RM 3 阅读全文
posted @ 2019-11-27 12:21 EM-LGH 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 感觉这个线段树分治和整体二分几乎相同啊~ code: #include <bits/stdc++.h> #define MAX 100300 #define ll long long #define lson now<<1 #define rson now<<1|1 #define setIO(s) 阅读全文
posted @ 2019-11-27 08:48 EM-LGH 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 和超级钢琴,异或之三倍经验 $?$ 堆+贪心素质三连 $?$ 好无聊...... code: #include <bits/stdc++.h> #define N 500006 #define ll long long #define setIO(s) freopen(s".in","r",stdi 阅读全文
posted @ 2019-11-26 20:46 EM-LGH 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 和超级钢琴几乎是同一道题吧... code: #include <bits/stdc++.h> #define N 200006 #define ll long long #define setIO(s) freopen(s".in","r",stdin) , freopen(s".out","w" 阅读全文
posted @ 2019-11-26 20:15 EM-LGH 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 思路倒是不难,但是这题卡常啊 ~ code: #include <bits/stdc++.h> #define N 2000004 #define M 1000005 #define SIZE 2000005 #define setIO(s) freopen(s".in","r",stdin) us 阅读全文
posted @ 2019-11-26 19:09 EM-LGH 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 开始想到了一个二分+主席树的 $O(n\log^2 n)$ 的做法. 能过,但是太无脑了. 看了一下题解,有一个 ST 表+堆的优美解法. 你发现肯定是选取前 k 大最优. 然后第一次选的话直接选固定左端点,最优的右端点就行. 但是呢,这个右端点选完后就不能再选了,于是你把这个区间分成两个,再扔到堆 阅读全文
posted @ 2019-11-26 16:29 EM-LGH 阅读(167) 评论(0) 推荐(0) 编辑
上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 120 下一页