F.Bandejao It is lunch time on Mars! Everyone has got that big smile on their faces, all eager to see what the GEMA restaurant is serving for dessert. Everything is pretty much like Earth, but nobody knows why, GEMA decided to invent new types of ute…
\(>Codeforces\space959 F. Mahmoud\ and\ Ehab\ and\ yet\ another\ xor\ task<\) 题目大意 : 给出一个长度为 \(n\) 序列 \(A\),和 \(q\) 次询问,对于每一次询问给出两个数 \(l, x\) ,你需要计算在前缀和 \(A[1, l]\) 中选取若干个数,使得它们 \(xor\) 起来的结果等于 \(x\) 的方案数 $n , q \leq 10^5   0 \leq A_i \leq 2^{20} $…
\(>Codeforces\space835 F. Roads in the Kingdom<\) 题目大意 : 给你一棵 \(n\) 个点构成的树基环树,你需要删掉一条环边,使其变成一颗树,并最小化删掉环边后的树的直径. \(n \leq 2 \times 10^5\) 树的边权 $ \leq 10^9 $ 解题思路 : 考虑最终树的直径可能由两部分组成,答案是其中的最大值 第一种就是外向树内的直径的最大值,这个只需要随便\(dp\)一下即可,这里不过多讨论 第二种情况树的直径经过原来的环,…
Codeforces 731 F. Video Cards 题目大意:给一组数,从中选一个数作lead,要求其他所有数减少为其倍数,再求和.问所求和的最大值. 思路:统计每个数字出现的个数,再做前缀和,用于之后快速求和.将原数组排序后去重,枚举每一个数做lead的情况下,其余数减少后再求和的结果.不断维护最大值即可. PS:这里用到了一个方便的函数unique()来去重,使用前需要先将数组排序,参数为数组的首地址和尾后地址,返回新的尾后地址.(该函数没有将重复的元素删除,只是放到了尾地址后面)可…
F. Group Projects   There are n students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes the i-th stu…
J.The Keys Out of all science labs constructed by the GEMA mission on Mars, the DSL - Dangerous Species Lab is the most dangerous of them all. The laboratory is so dangerous that you have to go through N doors in succession to get to it. Each one of…
C.Sleep Buddies It is nighttime in the Earth Colony on Mars and everyone is getting ready to sleep. It is common to sleep in pairs, so that if anything were to happen during the night people could aid each other. To decide who is a suitable candidate…
http://codeforces.com/problemset/problem/797/F F. Mice and Holes time limit per test             1.5 seconds memory limit per test       256 megabytes input standard input output standard output One day Masha came home and noticed n mice in the corri…
\(>Codeforces \space 622\ F. The\ Sum\ of\ the\ k-th\ Powers<\) 题目大意 : 给出 \(n, k\),求 \(\sum_{i=1}^{n} i^k\) 对 \(10^9 +7\) 取模的值 \(1 \leq n \leq 10^9, 0 \leq k \leq 10^6\) 解题思路 : 考虑 \(k\) 比较大,且模数不太好 \(NTT\),于是考虑插值做法, 学习了一波插值之后,发现就是个板子题 (雾) 拉格朗日插值: 对于…
\(>Codeforces \space 379 F. New Year Tree<\) 题目大意 : 有一棵有 \(4\) 个节点个树,有连边 \((1,2) (1,3) (1,4)\) ,一共有 \(q\) 次操作,每次选择一个节点,新建两个节点 \(n + 1, n + 2\) 向其连边,每次操作完之后求树的直径的长度 $1 \leq q \leq 5 \times 10^5 $ 解题思路 : 观察发现,每次加点后,树的直径的端点至多只会变化一个 证明:首先显然新的直径的端点不可能是两个…