Chef and Apple Trees Chef loves to prepare delicious dishes. This time, Chef has decided to prepare a special dish for you, and needs to gather several apples to do so. Chef has N apple trees in his home garden. Each tree has a certain (non-zero) num…
题目链接: A. Lala Land and Apple Trees time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Amr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala L…
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所在块单个改,后面的块整体打标…
https://www.codechef.com/DEC17/problems/CHEFHAM #include<cstdio> #include<cstring> #include<iostream> using namespace std; #define N 100001 int a[N],b[N]; ]; int num1[N],num2[N]; void read(int &x) { x=; char c=getchar(); while(!isdig…
https://www.codechef.com/DEC17/problems/GIT01 #include<cstdio> #include<algorithm> using namespace std; #define N 101 char s[N]; int main() { int T; scanf("%d",&T); int n,m; int OddG,OddR,EvenG,EvenR; int ans; while(T--) { OddG=O…
https://www.codechef.com/problems/FNCS [题意] [思路] 把n个函数分成√n块,预处理出每块中各个点(n个)被块中函数(√n个)覆盖的次数 查询时求前缀和,对于整块的分块求和,剩下右边不构成完整的一个块的树状数组求和 预处理:计算每个块中,序列中的第i个点被块中函数覆盖的次数,求出每个块内前缀的和(O(n√n)):对于每个点,更新树状数组(nlogn) 单点修改:对于块状数组,因为已经知道了每个点被覆盖的次数,所以维护很简单(O(√n));对于树状数组,直…
@(XSY)[分塊] Hint: 題目原文是英文的, 寫得很難看, 因此翻譯為中文. Input Format First Line is the size of the array i.e. \(N\) Next Line contains N space separated numbers \(A_i\) denoting the array Next N line follows denoting \(Li\) and \(Ri\) for each functions. Next Lin…
重点回忆下我觉得比较有意义的题目吧.水题就只贴代码了. Distinct Characters Subsequence 水. 代码: #include <cstdio> #include <iostream> #include <map> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <vect…
The Street Problem Code: STREETTA https://www.codechef.com/problems/STREETTA Submit Tweet All submissions for this problem are available. Read problems statements in Mandarin Chineseand Russian. The String street is known as the busiest street in Cod…
https://www.codechef.com/DEC17/problems/VK18 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; #define N 1000001 ],dp[N]; ]; void read(int &x) { x=; char c=getchar(); while(!isdigit(c)) c=getchar(); +c-'; c…