codechef AUG17 T1 Chef and Rainbow Array】的更多相关文章

Chef and Rainbow Array Problem Code: RAINBOWA Chef likes all arrays equally. But he likes some arrays more equally than others. In particular, he loves Rainbow Arrays. An array is Rainbow if it has the following structure: First a1 elements equal 1.…
Chef has an array A = (A1, A2, ..., AN), which has N integers in it initially. Chef found that for i ≥ 1, if Ai > 0, Ai+1 > 0, and Ai+2 exists, then he can decrease both Ai, andAi+1 by one and increase Ai+2 by one. If Ai+2 doesn't exist, but Ai >…
Chef and Mover Problem Code: CHEFMOVR Chef's dog Snuffles has so many things to play with! This time around, Snuffles has an array A containing N integers: A1, A2, ..., AN. Bad news: Snuffles only loves to play with an array in which all the elements…
Greedy Candidates Problem Code: GCAC The placements/recruitment season is going on in various colleges. The interviews are over, and each company has selected some students. But since each student can end up finally in at most one company, a student…
一开始我用分块大法,分成$\sqrt{n}$块,每个块上维护一个Splay,然后balabala维护一下,时间复杂度是$O(n\sqrt{n}logn)$.后来对拍的时候发现比$O(n^2)$的暴力跑得还慢,xxy学长说是Splay常数太大2333333 考试的时候没想到可以在每个块上建一个$10^5$的数组来存储每个数字出现的次数,而是用了常数巨大且复杂度多了一个log的SplayQwQ,发现自己完全没有对空间复杂度的认识啊(┙>∧<)┙へ┻┻ 标算是块状链表,什么balabala比较基础地…
vjudge 首先显然要建立圆方树 对于每一种点建立虚树,考虑这一种点贡献,对于虚树上已经有的点就直接算 否则对虚树上的一条边 \((u, v)\),\(u\) 为父亲,假设上面连通块大小为 \(x\),下面为 \(y\) 切断 \((u, v)\) 之间的点(不包括 \(u\))都会有 \(x\times y\) 的贡献,差分一下贡献即可 # include <bits/stdc++.h> using namespace std; typedef long long ll; namespac…
Palindromic Game Problem Code: PALINGAM There are two players A, B playing a game. Player A has a string s with him, and player B has string t with him. Both s and t consist only of lower case English letters and are of equal length. A makes the firs…
https://www.codechef.com/DEC17/problems/CHEFEXQ 题意: 位置i的数改为k 询问区间[1,i]内有多少个前缀的异或和为k 分块 sum[i][j] 表示第i块内,有多少个前缀,他们的异或和为j a[i] 表示 位置i的数 位置i改为k: 若 g=x1^x2^x3…… 把 x1 改为 k 后,那新的g=x1^x1^k^x2^x3…… 所以修改可以看做整体异或 修改后的值^原来的值 即 区间[i,n] 异或上a[i]^k i所在块单个改,后面的块整体打标…
Chef and Big Soccer   Problem code: CHEFSOC2 Tweet     ALL SUBMISSIONS All submissions for this problem are available. Read problems statements in Mandarin Chinese, Russian and Vietnamese as well. Chef is a big fan of soccer! He loves soccer so much,…
Disciption Chef has recently learnt Function and Addition. He is too exited to teach this to his friend Churu. Chef and Churu are very fast friends, they share their knowledge whenever they meet. Chef use to give a lot of exercises after he teaches s…