C. Dreamoon and Strings time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon has a string s and a pattern string p. He first removes exactly x characters from s obtaining string s' as a…
A. 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 integers a and b occasionally. He wants to…
B. Dreamoon and Sets time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both a and b.…
[Codeforces]Round #491 (Div. 2) 总结 这次尴尬了,D题fst,E没有做出来.... 不过还好,rating只掉了30,总体来说比较不稳,下次加油 A:If at first you don't succeed- SB题,就是注意一下特判就好了,然后我一开始wa了三次... #include<bits/stdc++.h> using namespace std; int read(){ int ans=0,w=1;char c=getchar(); while(!…
[题目]E. NN country [题意]给定n个点的树和m条链,q次询问一条链(a,b)最少被多少条给定的链覆盖.\(n,m,q \leq 2*10^5\). [算法]树上倍增+二维数点(树状数组) 先从半链角度考虑.将每条给定链和每个询问拆成向上的一段和向下的一段.那么假设询问的半链最低端节点为x,贪心地选择x子树内向上延伸最远的给定半链(假设最高点为y),再从y继续贪心直至超过半链最顶端节点.再只考虑半链的前提下贪心显然正确. 但是我们注意到,这样贪心的复杂度是不正确的,因为如果每次只跳…