Codeforces Round #418 (Div. 2) C】的更多相关文章

Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque 题意: 给\(n(n <= 1000)\)个圆,圆与圆之间不存在相交关系,只存在包含与不包含关系,现在问你把这一堆圆分成两组,求每组圆的异或并和的最大值. 思路:最简单的做法是贪心的做法,算出每个圆被包含的次数,为偶数则贡献为正,奇数为贡献为负. 现在主要学习一下树形dp的做法 由于圆不存在相交的情况,所以可以把所有的圆建成树,即把每棵树上的点分成两组,分别建成…
C. An impassioned circulation of affection time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dian…
A: 不细心WA了好多次 题意:给你一个a序列,再给你个b序列,你需要用b序列中的数字去替换a序列中的0,如果能够替换,则需要判断a是否能构成一个非递增的序列,a,b中所有的数字不会重复 思路:就是一步一步来,我想的可能复杂了点==. 如果a中0的个数小于b的长度就No. 如果a中0的个数大于等于b的长度 如果a中存在非递增就Yes,去掉0. 记录每个0前面x与后面y第一个非0的数,如果有y<x就Yes,否则如果x与y之间的0的个数>=2,不管怎么样都是Yes,否则在b中能找到一个数满足b[i…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of…
给n个圆要么包含,要么相分离,没有两个公共点,当成一棵树,把包含的面积大的放在上面 如图最上面的par记为-1,level记为0,当par==-1||level==1时就加否则减, 就是第一,二层先加,第三层减,然后后面的一直交替就行了 #include<map> #include<set> #include<cmath> #include<queue> #include<stack> #include<vector> #includ…
终判才知道自己失了智.本场据说是chinese专场,可是请允许我吐槽一下题意! A. An abandoned sentiment from past shabi贪心手残for循环边界写错了竟然还过了初判.回宿舍想想发现只要k大于1,可以直接输出Yes的. const int N=1e6+5; int a[N],b[N]; //char s[N]; int cmp(int a,int b) { return a>b; } int main() { int n,k; while(~scanf(&quo…
Description Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it! Still unsatisfied with the garland, Nadeko…
Description Sengoku still remembers the mysterious "colourful meteoroids" she discovered with Lala-chan when they were little. In particular, one of the nights impressed her deeply, giving her the illusion that all her fancies would be realized.…
Description A few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight. Ever since, she tried to avoid contact with others, for fear that this secret might be noticed. To get rid of the oddity and recover her weight, a s…
C. An impassioned circulation of affection time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dian…