https://codeforces.com/contest/1330/problem/C 给n个格子染色,有m种颜色,要求最后的所以格子被染色,并且有m种颜色. 染色要求:每种颜色有一个值li,选择 [1,n-li+1] 范围的一个数pi,把 [pi,pi+li-1] 范围内的格子染色,不能超过n,否则无法染色,重复染色的格子的颜色以最后染色的颜色为准. 求:pi,如果不能满足条件,则打印 -1 . 人话:对于每个li,从任意起点开始把li个格子染色,不能染出n个格子的范围,找到每个起始位置,…
https://codeforces.com/contest/1330/problem/D 给出d,m, 找到一个a数组,满足以下要求: a数组的长度为n,n≥1; 1≤a1<a2<⋯<an≤d: 定义一个数组b:b1=a1, ∀i>1,bi=bi−1⊕ai ,并且b1<b2<⋯<bn−1<bn: 求满足条件的a数组的个数并模m: 人话:求一个a数组满足递增,并且异或前缀和也递增 ,求出a数组个数mod m. 太菜了,不会,看了很多题解才会的,这里总结一下:…
题目连接:Dreamoon Likes Sequences  题意:给你d和m,让你构造一个递增数组a,使数组b(i==1,b[i]=a[i] ; i>1, b[i]=b[i-1]^a[i])递增,求a有几种,答案模m. 题解:根据异或的性质可以得出:2后边不能有3, 4后边不能有5~7, 8后边不能有9~15...... 然后就很好写了.用数组b记录第i个数可以取得数有多少个,数组dp记录长度为 i 的 a 数组有几种.看下边的代码应该就清楚了. 1 #include<bits/stdc++…
https://codeforces.com/contest/1330/problem/D 题目大意:给出一个限制 d 与模数 m ,求出可以构造出的满足条件的数组 a 的个数,需要满足以下条件:    1.数组 a 的长度大于等于 1     2.数组 a 严格递增    3.任意的ai <=d且>=1    4.对于数组 a ,需要构造出一个数组 b :满足当 i == 1 时:b[ 1 ] = a[ 1 ], i > 1 时:b[ i ] = b[ i - 1 ] XOR a[ i…
题目链接 题目大意 让你构造一个严格单调上升的数组a满足\(1<=a_1<a_2<....a_n<=d\) 而且要使得这个数组的异或前缀和也满足严格单调上升,求有多少个满足条件的数组(mod m) 题目思路 首先这个数组的性质很容易观察就是后一个数化为二进制的最高位1要比第上一个高 然后我就不会了 我还以为是枚举数组长度啥的,果然是我太菜了 这种类型的题目需要求贡献.枚举位数为 i 的数是否在序列中出现并计算对答案的贡献,根据乘法原理相乘即答案. 当位数小于log(d)的位数,贡献…
https://codeforces.com/contest/1330/problem/E 有一个高度为h的大顶堆:有2h -1个不同的正整数,下标从1到2h−1,1<i<2h, a[i]<a[⌊i/2⌋]. 现在我们要降低堆的高度,为h,有2g-1个整数,那么我们要删掉2h-2g个数: 选择索引 i 删除,删除方法如下: 被删除的节点值为0,代表该节点不存在. 所以操作后,2g-1个元素的下标在[1,2g-1]范围内:使得剩余元素的总和最小,并且输出调用删除函数时删除的节点下标. 人话…
传送门 思路:"Dreamoon will choose a number pipi from range [1,n−li+1](inclusive) and will paint all cells from pipi to pi+li−1(inclusive) in ii-th color."可以知道从[1, n - li - 1]任意位置往后染pi个格子为第ith种颜色. 容易想到,如果∑li < n,说明"-1". 如果∑li>=n,因为我们不知…
\(这题刚好撞到我的思路了,但是因为模拟......我看了几十遍测试数据....\) $首先当\sum_^m$小于n时一定无解 大于呢?那我们就要浪费一些区间(覆盖一些点,也就是多出来的点) 但是又不能全部覆盖,最早应该可以从上一个区间的左端点+1位置开始覆盖 然后模拟,刚开始能覆盖多少就覆盖多少. 但是注意,当i+a[i]-1>n时输出-1,这时候不论怎么放都不行.(比较难考虑周全) 然后代码写的很丑,就这样吧.... #include <bits/stdc++.h> using na…
在 \(\text{Div. 2/3}\) 混了一个多月后,四个号终于都上紫了,也没用理由不打 \(\text{Div. 1}\) 了.这是我人生中的第一场 \(\text{Div .1}\) ,之前也没用刻意的刷过题.在赛场上 \(\text{A}\) 在 WA 了 \(3\) 次后终于过了,然后 \(35 \text{min}\) 的时候过了 \(\text{B}\),想了一个小时 \(\text{C}\) 未果,耻辱下线.事后上了 \(60\) 分,大概是安慰吧...... A. Drea…
Contest Info Practice Link Solved A B C D E F 4/6 O O Ø       O 在比赛中通过 Ø 赛后通过 ! 尝试了但是失败了 - 没有尝试 Solutions C.Dreamoon Likes Coloring 题意: 按先后顺序用$m$种颜色涂一个长度为$n$的方块,规定每种颜色必须涂连续的$l_i$块.要求涂色完成后所有格子都有颜色并且存在$m$种颜色,若存在涂色方案则按顺序输出每种颜色涂色的起点,否则输出$-1$ 思路: 我们拿到题目首先…
D. Dreamoon and Sets 题目连接: http://www.codeforces.com/contest/476/problem/D Description Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both a and b. Let S be a set of exactly four distinct inte…
D. Dreamoon and Sets   Dreamoon likes to play with sets, integers and .  is defined as the largest positive integer that divides both a and b. Let S be a set of exactly four distinct integers greater than 0. Define S to be of rank k if and only if fo…
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目描述:有一个棋盘,对其进行染色,每次染一行或一列,后来的颜色会覆盖原来的颜色,输出最后的棋盘. solution 题解用二维线段树,其实可以不用. 对染色进行离线操作,那么染过的格子.行.列就不用再染了.所以每个格子可以记录四个指针,分别是行前驱,行后继,列前驱列后继,染色时按照这个跳着来染就好了.…
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同一列. 时间复杂度:\(O(nlogn)\) Image Preview 题目描述:给定看一张照片的时间,翻页的时间,把图片翻转的时间.一开始屏幕显示第一张照片,可以向左或向右翻,不能跳过还没有看过的图片,方向不对的图片要先翻转再看,看过的不消耗翻转时间与看照片时间,问在一定时间内,最多能看多少张照…
Codeforces Beta Round #27 (Codeforces format, Div. 2) http://codeforces.com/contest/27 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define maxn 1000005 typ…
Codeforces#441 Div.2 四小题 链接 A. Trip For Meal 小熊维尼喜欢吃蜂蜜.他每天要在朋友家享用N次蜂蜜 , 朋友A到B家的距离是 a ,A到C家的距离是b ,B到C家的距离是c  (A- >Rabbit   B- >Owl    C ->Eeyore),他不能连续两顿饭都在同一位朋友家里蹭 他现在位于A的家里, 请问他一天最少要跑多少路. 当然是要找一条最短的路折返跑了啊,是不是很简单. #include<bits/stdc++.h> us…
codeforces #592(Div.2) A Pens and Pencils Tomorrow is a difficult day for Polycarp: he has to attend a lectures and b practical classes at the university! Since Polycarp is a diligent student, he is going to attend all of them. While preparing for th…
codeforces #578(Div.2) A. Hotelier Amugae has a hotel consisting of 1010 rooms. The rooms are numbered from 00 to 99 from left to right. The hotel has two entrances - one from the left end, and another from the right end. When a customer arrives to t…
codeforces #577(Div.2) A  Important Exam A class of students wrote a multiple-choice test. There are nn students in the class. The test had mm questions, each of them had 55 possible answers (A, B, C, D or E). There is exactly one correct answer for…
http://codeforces.com/contest/599/problem/D 题意:给出总的方格数x,问有多少种不同尺寸的矩形满足题意,输出方案数和长宽(3,5和5,3算两种) 思路:比赛的时候gg了..其实稍微在纸上推一下.就会得到对于n,m的矩形,一共会有-n*n*n+3*n*n*m+n+3*n*m的方格.数量级是n3. 我们可以实际跑一遍.发现对于x1E18的数量级,n不会超过1442550,1E6,可以搞. 需要注意的是,一个是会爆int,所以记得用long long 另一个是…
传送门 题目: Dreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: You are given two integers d,m find the number of arrays a, satisfying the following constraints: The length of a is n, n≥1 1≤a1<a2<⋯…
E. Dreamoon and Strings 题目连接: http://www.codeforces.com/contest/476/problem/E Description Dreamoon has a string s and a pattern string p. He first removes exactly x characters from s obtaining string s' as a result. Then he calculates that is defined…
B. Dreamoon and WiFi 题目连接: http://www.codeforces.com/contest/476/problem/B Description Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them. Eac…
A. Dreamoon and Stairs 题目连接: http://www.codeforces.com/contest/476/problem/A Description Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps at each move. Dreamoon wants the number of moves to be a multiple of an integer m. What…
题目链接: http://www.codeforces.com/contest/476/problem/E E. Dreamoon and Strings time limit per test 1 secondmemory limit per test 256 megabytes 问题描述 Dreamoon has a string s and a pattern string p. He first removes exactly x characters from s obtaining…
题目链接 Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if  and , where k is some integer number in range[1, a…
http://codeforces.com/contest/476/problem/C C. Dreamoon and Sums time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Dreamoon loves summing up something for no reason. One day he obtains two…
http://codeforces.com/contest/476/problem/B B. Dreamoon and WiFi time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon is standing at the position 0 on a number line. Drazil is sending a…
http://codeforces.com/contest/476/problem/A A. Dreamoon and Stairs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon wants to climb up a stair of n steps. He can climb 1 or 2 steps a…
C. Dreamoon and Sums   Dreamoon loves summing up something for no reason. One day he obtains two integers a and b occasionally. He wants to calculate the sum of all nice integers. Positive integer x is called nice if  and , where k is some integer nu…