摘要:
E - Complete Binary Tree 首先我们只考虑x子树中的答案,非常明显,一定是一个连续的区间,那么我们只需要找到两个端点即可,左端点一直往左走即可,但是右端点要注意,如果走不了,如果左端点存在,说明n就是我们的右端点。 处理完子树之后往上跳即可,因为树高只有60 #include< 阅读全文
posted @ 2023-09-25 23:20
gan_coder
阅读(31)
评论(0)
推荐(0)
摘要:
F - typewriter 直接容斥即可,每次选出它们的并集。 #include<cstdio> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #define fo(i,a,b) for (int (i) 阅读全文
posted @ 2023-09-25 23:14
gan_coder
阅读(21)
评论(0)
推荐(0)
摘要:
P4782 【模板】2-SAT 问题 就是给关系进行连边,然后判断是否存在矛盾 输出方案的时候,就是在拓扑图上沿着反边走,但实际上tarjan求强连通分量已经排好序了 编号小的scc就是在拓扑序中排在后面的强连通分量 #include<cstdio> #include<algorithm> #inc 阅读全文
posted @ 2023-09-25 11:03
gan_coder
阅读(16)
评论(0)
推荐(0)