随笔分类 - CF
摘要:Xenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia
阅读全文
摘要:Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. N
阅读全文
摘要:Hilbert's Hotel is a very unusual hotel since the number of rooms is infinite! In fact, there is exactly one room for every integer, including zero an
阅读全文
摘要:You are given two integers aa and bb, and qq queries. The ii-th query consists of two numbers lili and riri, and the answer to it is the number of int
阅读全文
摘要:Phoenix has a string ss consisting of lowercase Latin letters. He wants to distribute all the letters of his string into kk non-empty strings a1,a2,…,
阅读全文
摘要:Santa Claus has received letters from nn different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular
阅读全文
摘要:We start with a string ss consisting only of the digits 11, 22, or 33. The length of ss is denoted by |s||s|. For each ii from 11 to |s||s|, the ii-th
阅读全文
摘要:Your friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website whi
阅读全文
摘要:This is the hard version of this problem. The only difference is the constraint on kk — the number of gifts in the offer. In this version: 2≤k≤n2≤k≤n.
阅读全文
摘要:Recall that the permutation is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a
阅读全文
摘要:You are given two integers nn and mm. Calculate the number of pairs of arrays (a,b)(a,b) such that: the length of both arrays is equal to mm; each ele
阅读全文
摘要:Recall that MEX of an array is a minimum non-negative integer that does not belong to the array. Examples: for the array [0,0,1,0,2][0,0,1,0,2] MEX eq
阅读全文
摘要:考虑全为0的串数。我们有m个1,相当于有m+1的空隙可以用来放0。那么显然我们把这n-m个0匀着放到这m+1个空隙,可以使得每个0的部分尽可能短,进而使得全为0的子串尽可能少。 所以每个空隙放b=(n-m)/(m+1)。因为不能整除,所有有(n-m) % (m+1)个空隙实际上还要再多一个0。 如果
阅读全文
摘要:To become the king of Codeforces, Kuroni has to solve the following problem. He is given nn numbers a1,a2,…,ana1,a2,…,an. Help Kuroni to calculate ∏1≤
阅读全文
摘要:Nikolay has only recently started in competitive programming, but already qualified to the finals of one prestigious olympiad. There going to be nn pa
阅读全文
摘要:It is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You
阅读全文
摘要:You are given a string ss consisting of lowercase Latin letters. Let the length of ss be |s||s|. You may perform several operations on this string. In
阅读全文
摘要:Eugene likes working with arrays. And today he needs your help in solving one challenging task. An array cc is a subarray of an array bb if cc can be
阅读全文
摘要:You have array of nn numbers a1,a2,…,ana1,a2,…,an. Rearrange these numbers to satisfy |a1−a2|≤|a2−a3|≤…≤|an−1−an||a1−a2|≤|a2−a3|≤…≤|an−1−an|, where |x
阅读全文
摘要:E. Sleeping Schedule time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vova had a pretty w
阅读全文

浙公网安备 33010602011771号