B. New Skateboard time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Max wants to buy a new skateboard. He has calculated the amount of money that is needed to buy a new skateboard. He left a…
F. Bear and Fair Set time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak is a grizzly bear. He is big and dreadful. You were chilling in the forest when you suddenly met him. It's very u…
E. Zbazi in Zeydabad time limit per test 5 seconds memory limit per test 512 megabytes input standard input output standard output A tourist wants to visit country Zeydabad for Zbazi (a local game in Zeydabad). The country Zeydabad is a rectangular t…
D. Magic Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in decimal presentation of…
C. Bear and String Distance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Limak is a little polar bear. He likes nice strings - strings of length n, consisting of lowercase English letter…
A. Tennis Tournament time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A tennis tournament with n participants is running. The participants are playing by an olympic system, so the winners mo…
原题传送门 我承认,比赛的时候在C题上卡了好久(最后也不会),15min水掉D后(最后还FST了..),看到E时已经只剩15min了.尽管一眼看出是离散化+线段树的裸题,但是没有时间写,实在尴尬. 赛后先照习惯码出线段树,提交上去WA4???看了好久没看出问题,怎么调都不对.这时TJW忽悠我:"我写的可持久化线段树啊,不用离散化了啊."我信了,码出主席树(实话说确实不用想那么多了,无脑动态开点就行了),提交上去TLE18???回头一问TJW:"我FST了啊."我:(…
https://codeforces.com/contest/893/problem/F 题意: 给一个有根树, 多次查询,每次查询对于$x$i点的子树中,距离$x$小于等于$k$的所有点中权值最小的一个 查询强制在线 题解: 显然,暴力就是,对于每次搜索深搜距离x小于$k$的所有点搜索 那么我们考虑优化 首先,查询对$x$距离小于$k$的所有点,等价于在整颗树上,查询$\forall dep(x)≤dep(i)≤dep(x)+k$中,在$x$子树中的点的最小值 那么,一个大胆的想法就是,对于每…
E Education 这个题有点意思,就是找满足条件的最小价格里的最大值的人数,有点贪心的思想吧,一开始写错了,人群的那个不能排序,而且是最小价格里找能住下人最多的部门,让这个部门去住这个房间.在循环的时候处理一下,找出来符合条件的人群的最大数就可以了.代码写的巨丑... 代码: 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<cmath> 5 #include&…
E. Physical Education Lessons 题目:一段长度为n的区间初始全为1,每次成段赋值0或1,求每次操作后的区间总和.(n<=1e9,q<=3e5) 题意:用线段树做的话,没什么思维量,主要是空间复杂度的问题.因此采用动态开点的办法,即需要用到的节点,在使用前分配内存,没有用到的就虚置.这样每次操作新增的节点约logn个.则q次修改需要的空间大约是qlogn.但是,在这个数量级上尽可能开的再大一些,防止RE. #include<bits/stdc++.h> #…