1.用退化的线段树(也就是没有区间查询)做... 2.注意longlong. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int n,q; int a[200010],s[200010]; int main(){     scanf("%d%d",&n,&q); for(int…
A. Lunch Rush 模拟. B. Little Girl and Game 因为可以打乱顺序,所以只关心每种数字打奇偶性. 若一开始就是回文,即奇数字母为0或1种,则先手获胜. 若奇数字母大于1,则只需要考虑奇数字母个数的奇偶性.因为后手可以保证奇数字母个数的奇偶性. C. Little Girl and Maximum Sum 考虑每个位置覆盖次数,显然覆盖次数多分配大权值. D. Little Girl and Maximum XOR 找到 \(l,r\) 不相同的最高位,那么为了异…
E. Little Girl and Problem on Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A little girl loves problems on trees very much. Here's one of them. A tree is an undirected connected g…
A. Lunch Rush time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time u…
B. "Or" Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/578/problem/B Description You are given n numbers a1, a2, ..., an. You can perform at most k operations. For each operation you can multiply one of the number…
A. Anton and Polyhedrons time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons:…
C. Sonya and Problem Wihtout a Legend 题目连接: http://codeforces.com/contest/713/problem/C Description Sonya was unable to think of a story for this problem, so here comes the formal description. You are given the array containing n positive integers. A…
题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j-1],求f[n][n].C++代码: #include <iostream> using namespace std; ][]; int main() { cin >> n; ;i<=n;i++) f[i][] = f[][i] = ; ; i <= n; i ++) ;…
任意门:http://codeforces.com/contest/1118/problem/D1 D1. Coffee and Coursework (Easy version) time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The only difference between easy and hard versions…
http://codeforces.com/contest/723/problem/C 题目是给出一个序列 a[i]表示第i个歌曲是第a[i]个人演唱,现在选出前m个人,记b[j]表示第j个人演唱歌曲的数量, 现在你可以改变a[]这个数组,使得前m个人的演唱歌曲的数量的最小值最大. 很明显对于前m个人,每个人唱了多少首是很容易统计出来的,只需要对<=m的人进行统计即可,不用统计>m的,这样的话数组只需开到2000即可. 对于后面的人,可以改变,优先改变前m个人中演唱歌曲最小的那个,这个可以用优…