Loading

摘要: Description \(n\le 10^5,m\le 2\times 10^5,0\le q\le n\)。 Solution 将一场比赛看成一条边,胜者是败者的父亲,那么这题就是一个经典的异或最小生成树。 异或最小生成树版题:CF 888 G,https://codeforces.com/pr 阅读全文
posted @ 2021-10-20 11:45 Thunder_S 阅读(43) 评论(0) 推荐(0) 编辑
摘要: Description \(n\le 10^5,m\le 2\times 10^5\)。 Solution 由于颜色只有 3 个,考虑将图分层。 统计出不走某个颜色的情况下,每个节点所处的联通块。 那么改变颜色可以认为是在某个节点同时走两个联通块。 预处理答案,枚举节点,统计所处的三个联通块两两联通 阅读全文
posted @ 2021-10-20 11:03 Thunder_S 阅读(67) 评论(0) 推荐(0) 编辑
摘要: Description \(n\le 2\times 10^5,a_i,b_i\le 2^{30}\)。 Solution 看到异或会很自然的想起 \(\text{trie}\),考虑对 \(a\) 和 \(b\) 分别建一棵 \(\text{trie}\),然后同时 \(\text{dfs}\) 阅读全文
posted @ 2021-10-20 10:54 Thunder_S 阅读(39) 评论(0) 推荐(0) 编辑