Problem ID stringlengths 2 6 | Problem Description stringlengths 0 7.52k | Rating float64 800 3.5k | math bool 2
classes | greedy bool 2
classes | implementation bool 2
classes | dp bool 2
classes | data structures bool 2
classes | constructive algorithms bool 2
classes | brute force bool 2
classes | binary search bool 2
classes | sortings bool 2
classes | graphs bool 2
classes | __index_level_0__ int64 3 9.98k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47A | Problem - 47A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so... | 800 | true | false | false | false | false | false | true | false | false | false | 9,742 |
1979F | This is an interactive problem. Kostyanych has chosen a complete undirected graph$$$^{dagger}$$$ with $$$n$$$ vertices, and then removed exactly $$$(n - 2)$$$ edges from it. You can ask queries of the following type: "? $$$d$$$" — Kostyanych tells you the number of vertex $$$v$$$ with a degree at least $$$d$$$. Among ... | 2,900 | false | false | false | false | false | true | true | false | false | true | 411 |
500D | New Year is coming in Tree World! In this world, as the name implies, there are _n_ cities connected by _n_u2009-u20091 roads, and for any two distinct cities there always exists a path between them. The cities are numbered by integers from 1 to _n_, and the roads are numbered by integers from 1 to _n_u2009-u20091. Let... | 1,900 | false | false | false | false | false | false | false | false | false | true | 7,834 |
38B | Problem - 38B - Codeforces =============== xa0 - Codeforces Beta Round 38 (ACM-ICPC Rules)]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these pro... | 1,200 | true | false | true | false | false | false | true | false | false | false | 9,807 |
1176B | You are given an array $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, dots , a_n$$$. In one operation you can choose two elements of the array and replace them with the element equal to their sum (it does not matter where you insert the new element). For example, from the array $$$[2, 1, 4]$$$ you can obtain the f... | 1,100 | true | false | false | false | false | false | false | false | false | false | 4,837 |
1804C | While James is gone on business, Vesper takes her time and explores what the legendary Casino Royale has to offer to people who are fond of competitive programming. Her attention was grabbed by the very new "Pull Your Luck" roulette which functions in a pretty peculiar way. The roulette's wheel consists of $$$n$$$ sect... | 1,500 | true | true | false | false | false | false | true | false | false | false | 1,455 |
95B | Problem - 95B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so... | 1,800 | false | true | false | true | false | false | false | false | false | false | 9,507 |
832C | _n_ people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-negative integer coordinate, and blow it up. At this moment all peopl... | 2,500 | true | false | true | false | false | false | false | true | false | false | 6,437 |
1067A | Ivan unexpectedly saw a present from one of his previous birthdays. It is array of $$$n$$$ numbers from $$$1$$$ to $$$200$$$. Array is old and some numbers are hard to read. Ivan remembers that for all elements at least one of its neighbours ls not less than it, more formally: $$$a_{1} le a_{2}$$$, $$$a_{n} le a_{n-1}$... | 1,900 | false | false | false | true | false | false | false | false | false | false | 5,375 |
1512D | You are given a number $$$n$$$ and an array $$$b_1, b_2, ldots, b_{n+2}$$$, obtained according to the following algorithm: some array $$$a_1, a_2, ldots, a_n$$$ was guessed; array $$$a$$$ was written to array $$$b$$$, i.e. $$$b_i = a_i$$$ ($$$1 le i le n$$$); The $$$(n+1)$$$-th element of the array $$$b$$$ is the su... | 1,200 | false | true | false | false | true | true | false | false | false | false | 3,106 |
899D | There are _n_ shovels in Polycarp's shop. The _i_-th shovel costs _i_ burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell shovels in pairs. Visitors are more likely to buy a pair of shovels if their total cost ends with s... | 1,800 | true | false | false | false | false | true | false | false | false | false | 6,149 |
1336E1 | This is the easy version of the problem. The only difference between easy and hard versions is the constraint of $$$m$$$. You can make hacks only if both versions are solved. Chiori loves dolls and now she is going to decorate her bedroom! xa0As a doll collector, Chiori has got $$$n$$$ dolls. The $$$i$$$-th doll has a ... | 2,700 | true | false | false | false | false | false | true | false | false | false | 4,019 |
1402A | Everybody knows that Balázs has the fanciest fence in the whole town. It's built up from $$$N$$$ fancy sections. The sections are rectangles standing closely next to each other on the ground. The $$$i$$$th section has integer height $$$h_i$$$ and integer width $$$w_i$$$. We are looking for fancy rectangles on this fanc... | 1,800 | true | false | true | false | true | false | false | false | true | false | 3,659 |
454A | Problem - 454A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 800 | false | false | true | false | false | false | false | false | false | false | 8,021 |
609D | Nura wants to buy _k_ gadgets. She has only _s_ burles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for some type of currency. The type of currency and the cost in that currency are not changing. Nura can buy gadgets for _n_ days. For each day you know the exchange rates o... | 2,000 | false | true | false | false | false | false | false | true | false | false | 7,409 |
1671B | You are given $$$n$$$ points with integer coordinates on a coordinate axis $$$OX$$$. The coordinate of the $$$i$$$-th point is $$$x_i$$$. All points' coordinates are distinct and given in strictly increasing order. For each point $$$i$$$, you can do the following operation no more than once: take this point and move it... | 1,000 | true | false | false | false | false | false | true | false | true | false | 2,250 |
1034D | Little D is a friend of Little C who loves intervals very much instead of number "$$$3$$$". Now he has $$$n$$$ intervals on the number axis, the $$$i$$$-th of which is $$$[a_i,b_i]$$$. Only the $$$n$$$ intervals can not satisfy him. He defines the value of an interval of intervals $$$[l,r]$$$ ($$$1 leq l leq r leq n$$$... | 3,500 | false | false | false | false | true | false | false | true | false | false | 5,525 |
1041D | A plane is flying at a constant height of $$$h$$$ meters above the ground surface. Let's consider that it is flying from the point $$$(-10^9, h)$$$ to the point $$$(10^9, h)$$$ parallel with $$$Ox$$$ axis. A glider is inside the plane, ready to start his flight at any moment (for the sake of simplicity let's consider t... | 1,700 | false | false | false | false | true | false | false | true | false | false | 5,492 |
1770H | Wow, what a big face! Kagura Mahiru Koxia and Mahiru are enjoying the Winter Festival. The streets of the Winter Festival can be represented as a $$$n imes n$$$ undirected grid graph. Formally, the set of vertices is $$${(i,j) ; ; 1 leq i,jleq n }$$$ and two vertices $$$(i_1,j_1)$$$ and $$$(i_2,j_2)$$$ are connected ... | 3,500 | false | false | false | false | false | true | false | false | false | false | 1,670 |
1264F | The well-known Fibonacci sequence $$$F_0, F_1, F_2,ldots $$$ is defined as follows: $$$F_0 = 0, F_1 = 1$$$. For each $$$i geq 2$$$: $$$F_i = F_{i - 1} + F_{i - 2}$$$. Given an increasing arithmetic sequence of positive integers with $$$n$$$ elements: $$$(a, a + d, a + 2cdot d,ldots, a + (n - 1)cdot d)$$$. You need to... | 3,500 | false | false | false | false | false | true | false | false | false | false | 4,375 |
1847C | . Then he summons a new Stand user, with index $$$m+1$$$ and strength given by: $$$$$$a_{m+1} = a_i oplus a_{i+1} oplus ldots oplus a_m,$$$$$$where the operator $$$oplus$$$ denotes the . The description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 le n le 10^5$$$)... | 1,400 | false | true | false | true | false | false | true | false | false | false | 1,198 |
1538C | You are given an array $$$a$$$ of $$$n$$$ integers. Find the number of pairs $$$(i, j)$$$ ($$$1 le i < j le n$$$) where the sum of $$$a_i + a_j$$$ is greater than or equal to $$$l$$$ and less than or equal to $$$r$$$ (that is, $$$l le a_i + a_j le r$$$). For example, if $$$n = 3$$$, $$$a = [5, 1, 2]$$$, $$$l = 4$$$ and... | 1,300 | true | false | false | false | true | false | false | true | false | false | 2,953 |
1500C | You are given two tables $$$A$$$ and $$$B$$$ of size $$$n imes m$$$. We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with the smallest value to the rows with the largest. In case there are two or more rows with equal value ... | 2,600 | false | true | false | false | false | true | true | false | false | false | 3,166 |
1599G | Problem - 1599G - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ... | 2,700 | true | false | false | false | false | false | true | false | false | false | 2,658 |
813B | Problem - 813B - Codeforces =============== xa0 and year 18 isn't unlucky as there is no such representation for it. Such interval of years that there are no unlucky years in it is called The Golden Age. You should write a program which will find maximum length of The Golden Age which starts no earlier th... | 1,800 | true | false | false | false | false | false | true | false | false | false | 6,510 |
508C | Anya loves to watch horror movies. In the best traditions of horror, she will be visited by _m_ ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactly _t_ seconds. It takes the girl one second to light one candle. More formally, Anya can spend one second to light one... | 1,600 | false | true | false | false | false | true | false | false | false | false | 7,809 |
1917E | You are given an even integer $$$n$$$ and an integer $$$k$$$. Your task is to construct a matrix of size $$$n imes n$$$ consisting of numbers $$$0$$$ and $$$1$$$ in such a way that the following conditions are true, or report that it is impossible: the sum of all the numbers in the matrix is exactly $$$k$$$; the bit... | 2,500 | true | false | false | false | false | true | false | false | false | false | 790 |
378B | Two semifinals have just been in the running tournament. Each semifinal had _n_ participants. There are _n_ participants advancing to the finals, they are chosen as follows: from each semifinal, we choose _k_ people (0u2009≤u20092_k_u2009≤u2009_n_) who showed the best result in their semifinals and all other places in ... | 1,300 | false | false | true | false | false | false | false | false | true | false | 8,318 |
389A | Problem - 389A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 1,000 | true | true | false | false | false | false | false | false | false | false | 8,272 |
1976F | You are given a rooted tree, consisting of $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$. Vertex $$$1$$$ is the root. Additionally, the root only has one child. You are asked to add exactly $$$k$$$ edges to the tree (possibly, multiple edges and/or edges already existing in the tree). Recall that a bridge is such ... | 2,800 | false | true | false | true | true | false | false | false | true | false | 428 |
870E | Problem - 870E - Codeforces =============== xa0 ") ") xa0— the number of points. _n_ lines follow. The (_i_u2009+u20091)-th of these lines contains two integers _x__i_, _y__i_ (u2009-u2009109u2009≤u2009_x__i_,u2009_y__i_u2009≤u2009109)xa0— coordinates of the _i_-th point. It is guaranteed that all points a... | 2,300 | false | false | false | false | false | false | false | false | false | true | 6,257 |
357B | In Berland, there is the national holiday coming — the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: overall, there must be _m_ dances; exactly three people must take part in each dance; each dance ... | 1,400 | false | false | true | false | false | true | false | false | false | false | 8,405 |
1903B | In Cyprus, the weather is pretty hot. Thus, Theofanis saw this as an opportunity to create an ice cream company. He keeps the ice cream safe from other ice cream producers by locking it inside big storage rooms. However, he forgot the password. Luckily, the lock has a special feature for forgetful people! It gives you ... | 1,200 | false | true | false | false | false | true | true | false | false | false | 896 |
1439A2 | This is the hard version of the problem. The difference between the versions is in the number of possible operations that can be made. You can make hacks if and only if you solved both versions of the problem. You are given a binary table of size $$$n imes m$$$. This table consists of symbols $$$0$$$ and $$$1$$$. You ... | 1,900 | false | true | true | false | false | true | false | false | false | true | 3,471 |
1286C2 | This problem is different with easy version only by constraints on total answers length It is an interactive problem Venya joined a tour to the madhouse, in which orderlies play with patients the following game. Orderlies pick a string $$$s$$$ of length $$$n$$$, consisting only of lowercase English letters. The player ... | 2,800 | true | false | false | false | false | true | true | false | false | false | 4,258 |
186B | Each year in the castle of Dwarven King there is a competition in growing mushrooms among the dwarves. The competition is one of the most prestigious ones, and the winner gets a wooden salad bowl. This year's event brought together the best mushroom growers from around the world, so we had to slightly change the rules ... | 1,200 | false | true | false | false | false | false | false | false | true | false | 9,098 |
1976A | Monocarp is working on his new site, and the current challenge is to make the users pick strong passwords. Monocarp decided that strong passwords should satisfy the following conditions: password should consist only of lowercase Latin letters and digits; there should be no digit that comes after a letter (so, after e... | 800 | false | false | true | false | false | false | false | false | true | false | 433 |
621D | Wet Shark asked Rat Kwesh to generate three positive real numbers _x_, _y_ and _z_, from 0.1 to 200.0, inclusive. Wet Krash wants to impress Wet Shark, so all generated numbers will have exactly one digit after the decimal point. Wet Shark knows Rat Kwesh will want a lot of cheese. So he will give the Rat an opportunit... | 2,400 | true | false | false | false | false | true | true | false | false | false | 7,348 |
1680C | You are given a string $$$s$$$ consisting of characters 0 and/or 1. You have to remove several (possibly zero) characters from the beginning of the string, and then several (possibly zero) characters from the end of the string. The string may become empty after the removals. The cost of the removal is the maximum of th... | 1,600 | false | true | false | false | false | false | false | true | false | false | 2,189 |
1418D | Vova decided to clean his room. The room can be represented as the coordinate axis $$$OX$$$. There are $$$n$$$ piles of trash in the room, coordinate of the $$$i$$$-th pile is the integer $$$p_i$$$. All piles have different coordinates. Let's define a total cleanup as the following process. The goal of this process is ... | 2,100 | false | false | true | false | true | false | false | false | false | false | 3,591 |
877D | Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of _n_u2009×u2009_m_ cells, each cell of which is empty or littered with cans. Olya drank a lot of energy drink, so now she can run _k_ meters per second. Each second... | 2,100 | false | false | false | false | true | false | false | false | false | true | 6,237 |
1256D | You are given a binary string of length $$$n$$$ (i.u2009e. a string consisting of $$$n$$$ characters '0' and '1'). In one move you can swap two adjacent characters of the string. What is the lexicographically minimum possible string you can obtain from the given one if you can perform no more than $$$k$$$ moves? It is ... | 1,500 | false | true | false | false | false | false | false | false | false | false | 4,404 |
1197E | There are famous Russian nesting dolls named matryoshkas sold in one of the souvenir stores nearby, and you'd like to buy several of them. The store has $$$n$$$ different matryoshkas. Any matryoshka is a figure of volume $$$out_i$$$ with an empty space inside of volume $$$in_i$$$ (of course, $$$out_i > in_i$$$). You do... | 2,300 | false | false | false | true | true | false | false | true | true | false | 4,711 |
342A | Problem - 342A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 1,200 | false | true | true | false | false | false | false | false | false | false | 8,468 |
1857D | Given two arrays $$$a$$$ and $$$b$$$, both of length $$$n$$$. Elements of both arrays indexed from $$$1$$$ to $$$n$$$. You are constructing a directed graph, where edge from $$$u$$$ to $$$v$$$ ($$$u eq v$$$) exists if $$$a_u-a_v ge b_u-b_v$$$. A vertex $$$V$$$ is called strong if there exists a path from $$$V$$$ to all... | 1,300 | true | false | false | false | false | false | false | false | true | false | 1,141 |
1303B | Your company was appointed to lay new asphalt on the highway of length $$$n$$$. You know that every day you can either repair one unit of the highway (lay new asphalt over one unit of the highway) or skip repairing. Skipping the repair is necessary because of the climate. The climate in your region is periodical: there... | 1,400 | true | false | false | false | false | false | false | false | false | false | 4,177 |
922D | Pushok the dog has been chasing Imp for a few hours already. Fortunately, Imp knows that Pushok is afraid of a robot vacuum cleaner. While moving, the robot generates a string _t_ consisting of letters 's' and 'h', that produces a lot of noise. We define noise of string _t_ as the number of occurrences of string "sh" a... | 1,800 | false | true | false | false | false | false | false | false | true | false | 6,026 |
267A | Problem - 267A - Codeforces =============== xa0 to pair (4,13), it transforms (5,5) to (0,5). You've got some number of pairs (_a__i_,u2009_b__i_). How many operations will be performed for each of them? Input The first line contains the number of pairs _n_ (1u2009u2009≤u2009u2009_n_u2009u2009≤u2009u20091000)... | 900 | true | false | false | false | false | false | false | false | false | false | 8,766 |
962C | You are given a positive integer $$$n$$$, written without leading zeroes (for example, the number 04 is incorrect). In one operation you can delete any digit of the given integer so that the result remains a positive integer without leading zeros. Determine the minimum number of operations that you need to consistently... | 1,400 | true | false | true | false | false | false | true | false | false | false | 5,854 |
875F | In a medieval kingdom, the economic crisis is raging. Milk drops fall, Economic indicators are deteriorating every day, money from the treasury disappear. To remedy the situation, King Charles Sunnyface decided make his _n_ sons-princes marry the brides with as big dowry as possible. In search of candidates, the king a... | 2,500 | false | true | false | false | false | false | false | false | false | true | 6,243 |
1548B | British mathematician John Littlewood once said about Indian mathematician Srinivasa Ramanujan that "every positive integer was one of his personal friends." It turns out that positive integers can also be friends with each other! You are given an array $$$a$$$ of distinct positive integers. Define a subarray $$$a_i, a... | 1,800 | true | false | false | false | true | false | false | true | false | false | 2,905 |
1045A | It is the year 2969. 1000 years have passed from the moon landing. Meanwhile, the humanity colonized the Hyperspace™ and lived in harmony. Until we realized that we were not alone. Not too far away from the Earth, the massive fleet of aliens' spaceships is preparing to attack the Earth. For the first time in a while, t... | 2,500 | false | false | false | false | true | false | false | false | false | true | 5,470 |
1282B2 | This is the hard version of this problem. The only difference is the constraint on $$$k$$$ — the number of gifts in the offer. In this version: $$$2 le k le n$$$. Vasya came to the store to buy goods for his friends for the New Year. It turned out that he was very luckyxa0— today the offer "$$$k$$$ of goods for the pri... | 1,600 | false | true | false | true | false | false | false | false | true | false | 4,284 |
1613A | Problem - 1613A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ... | 900 | true | false | true | false | false | false | false | false | false | false | 2,576 |
601A | In Absurdistan, there are _n_ towns (numbered 1 through _n_) and _m_ bidirectional railways. There is also an absurdly simple road networkxa0— for each pair of different towns _x_ and _y_, there is a bidirectional road between towns _x_ and _y_ if and only if there is no railway between them. Travelling to a different ... | 1,600 | false | false | false | false | false | false | false | false | false | true | 7,440 |
1749C | Alice and Bob are playing a game. They have an array of positive integers $$$a$$$ of size $$$n$$$. Before starting the game, Alice chooses an integer $$$k ge 0$$$. The game lasts for $$$k$$$ stages, the stages are numbered from $$$1$$$ to $$$k$$$. During the $$$i$$$-th stage, Alice must remove an element from the array... | 1,400 | false | true | true | false | true | false | false | true | false | false | 1,789 |
1899A | Problem - 1899A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ... | 800 | true | false | false | false | false | false | false | false | false | false | 922 |
739B | Alyona has a tree with _n_ vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex _i_ she wrote _a__i_. Moreover, the girl wrote a positive integer to every edge of the tree (possibly, different integers on different edges). Let's define _dist_(_v_,u2009_u_) as th... | 1,900 | false | false | false | false | true | false | false | true | false | true | 6,842 |
842C | Problem - 842C - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 2,000 | true | false | false | false | false | false | false | false | false | true | 6,394 |
125D | An arithmetic progression is such a non-empty sequence of numbers where the difference between any two successive numbers is constant. This constant number is called common difference. For example, the sequence 3, 7, 11, 15 is an arithmetic progression. The definition implies that any sequences whose length equals 1 or... | 2,200 | false | true | false | false | false | true | false | false | false | false | 9,379 |
1526E | Once upon a time, Oolimry saw a suffix array. He wondered how many strings can produce this suffix array. More formally, given a suffix array of length $$$n$$$ and having an alphabet size $$$k$$$, count the number of strings that produce such a suffix array. Let $$$s$$$ be a string of length $$$n$$$. Then the $$$i$$$-t... | 2,400 | true | false | false | false | false | true | false | false | false | false | 3,031 |
1149C | Owl Pacino has always been into trees — unweighted rooted trees in particular. He loves determining the diameter of every tree he sees — that is, the maximum length of any simple path in the tree. Owl Pacino's owl friends decided to present him the Tree Generator™ — a powerful machine creating rooted trees from their d... | 2,700 | false | false | true | false | true | false | false | false | false | false | 4,967 |
1603B | Problem - 1603B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ... | 1,600 | true | false | false | false | false | true | false | false | false | false | 2,642 |
581C | Petya loves computer games. Finally a game that he's been waiting for so long came out! The main character of this game has _n_ different skills, each of which is characterized by an integer _a__i_ from 0 to 100. The higher the number _a__i_ is, the higher is the _i_-th skill of the character. The total rating of the c... | 1,400 | true | false | true | false | false | false | false | false | true | false | 7,521 |
445B | DZY loves chemistry, and he enjoys mixing chemicals. DZY has _n_ chemicals, and _m_ pairs of them will react. He wants to pour these chemicals into a test tube, and he needs to pour them in one by one, in any order. Let's consider the danger of a test tube. Danger of an empty test tube is 1. And every time when DZY pou... | 1,400 | false | true | false | false | false | false | false | false | false | false | 8,057 |
1525B | You are given a permutation $$$a$$$ consisting of $$$n$$$ numbers $$$1$$$, $$$2$$$, ..., $$$n$$$ (a permutation is an array in which each element from $$$1$$$ to $$$n$$$ occurs exactly once). You can perform the following operation: choose some subarray (contiguous subsegment) of $$$a$$$ and rearrange the elements in i... | 900 | false | true | false | false | false | true | false | false | false | false | 3,041 |
638C | In Berland there are _n_ cities and _n_u2009-u20091 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given roads. In each city there is exactly one repair brigade. To repair some road, you need two teams based in the cities connected by the road to w... | 1,800 | false | true | false | false | false | false | false | false | false | true | 7,259 |
841A | Problem - 841A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 900 | false | false | true | false | false | false | true | false | false | false | 6,398 |
1183G | This problem is a version of problem D from the same contest with some additional constraints and tasks. There are $$$n$$$ candies in a candy box. The type of the $$$i$$$-th candy is $$$a_i$$$ ($$$1 le a_i le n$$$). You have to prepare a gift using some of these candies with the following restriction: the numbers of ca... | 2,000 | false | true | true | false | false | false | false | false | true | false | 4,796 |
437A | Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should find out the only one that is correct. Fortunately the child knows how to solve such complicated test. The chil... | 1,300 | false | false | true | false | false | false | false | false | false | false | 8,091 |
697A | Ted has a pineapple. This pineapple is able to bark like a bulldog! At time _t_ (in seconds) it barks for the first time. Then every _s_ seconds after it, it barks twice with 1 second interval. Thus it barks at times _t_, _t_u2009+u2009_s_, _t_u2009+u2009_s_u2009+u20091, _t_u2009+u20092_s_, _t_u2009+u20092_s_u2009+u200... | 900 | true | false | true | false | false | false | false | false | false | false | 7,035 |
1605E | Jeevan has two arrays $$$a$$$ and $$$b$$$ of size $$$n$$$. He is fond of performing weird operations on arrays. This time, he comes up with two types of operations: Choose any $$$i$$$ ($$$1 le i le n$$$) and increment $$$a_j$$$ by $$$1$$$ for every $$$j$$$ which is a multiple of $$$i$$$ and $$$1 le j le n$$$. Choose ... | 2,400 | true | true | true | false | false | false | false | true | true | false | 2,631 |
652C | You are given a permutation _p_ of length _n_. Also you are given _m_ foe pairs (_a__i_,u2009_b__i_) (1u2009≤u2009_a__i_,u2009_b__i_u2009≤u2009_n_,u2009_a__i_u2009≠u2009_b__i_). Your task is to count the number of different intervals (_x_,u2009_y_) (1u2009≤u2009_x_u2009≤u2009_y_u2009≤u2009_n_) that do not contain any f... | 1,800 | false | false | false | false | false | false | false | false | true | false | 7,208 |
1671D | You are given a sequence of $$$n$$$ integers $$$a_1, a_2, dots, a_n$$$. You are also given $$$x$$$ integers $$$1, 2, dots, x$$$. You are asked to insert each of the extra integers into the sequence $$$a$$$. Each integer can be inserted at the beginning of the sequence, at the end of the sequence, or between any element... | 1,600 | false | true | false | false | false | true | true | false | false | false | 2,248 |
1013B | There is an array with _n_ elements _a_1,u2009_a_2,u2009...,u2009_a__n_ and the number _x_. In one operation you can select some _i_ (1u2009≤u2009_i_u2009≤u2009_n_) and replace element _a__i_ with _a__i_u2009&u2009_x_, where & denotes the . In other words, there should be at least two distinct indices _i_u2009≠u2009_j_... | 1,200 | false | true | false | false | false | false | false | false | false | false | 5,620 |
1547C | Monocarp and Polycarp are learning new programming techniques. Now they decided to try pair programming. It's known that they have worked together on the same file for $$$n + m$$$ minutes. Every minute exactly one of them made one change to the file. Before they started, there were already $$$k$$$ lines written in the ... | 1,100 | false | true | false | false | false | false | false | false | false | false | 2,911 |
483A | Your friend has recently learned about coprime numbers. A pair of numbers {_a_,u2009_b_} is called coprime if the maximum number that divides both _a_ and _b_ is equal to one. Your friend often comes up with different statements. He has recently supposed that if the pair (_a_,u2009_b_) is coprime and the pair (_b_,u200... | 1,100 | true | false | true | false | false | false | true | false | false | false | 7,904 |
1389C | Let's call left cyclic shift of some string $$$t_1 t_2 t_3 dots t_{n - 1} t_n$$$ as string $$$t_2 t_3 dots t_{n - 1} t_n t_1$$$. Analogically, let's call right cyclic shift of string $$$t$$$ as string $$$t_n t_1 t_2 t_3 dots t_{n - 1}$$$. Let's say string $$$t$$$ is good if its left cyclic shift is equal to its right c... | 1,500 | false | true | false | true | false | false | true | false | false | false | 3,726 |
1750E | Daemon Targaryen decided to stop looking like a Metin2 character. He turned himself into the most beautiful thing, a bracket sequence. For a bracket sequence, we can do two kind of operations: Select one of its substrings$$$^dagger$$$ and cyclic shift it to the right. For example, after a cyclic shift to the right, "(... | 2,400 | false | true | false | true | true | false | false | true | false | false | 1,781 |
1219G | It is Bubble Cup finals season and farmer Johnny Bubbles must harvest his bubbles. The bubbles are in a rectangular bubblefield formed of $$$N$$$ x $$$M$$$ square parcels divided into $$$N$$$ rows and $$$M$$$ columns. The parcel in $$$i^{th}$$$ row and $$$j^{th}$$$ column yields $$$A_{i,j}$$$ bubbles. Johnny Bubbles ha... | 2,000 | false | false | true | false | false | false | false | false | false | false | 4,574 |
1468C | Monocarp and Polycarp are working as waiters in Berpizza, a pizzeria located near the center of Bertown. Since they are waiters, their job is to serve the customers, but they choose whom they serve first differently. At the start of the working day, there are no customers at the Berpizza. They come there one by one. Wh... | 1,400 | false | false | true | false | true | false | false | false | false | false | 3,350 |
234G | Little time is left before Berland annual football championship. Therefore the coach of team "Losewille Rangers" decided to resume the practice, that were indefinitely interrupted for uncertain reasons. Overall there are _n_ players in "Losewille Rangers". Each player on the team has a number — a unique integer from 1 ... | 1,600 | false | false | true | false | false | true | false | false | false | false | 8,898 |
551D | Problem - 551D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 2,100 | true | false | true | false | false | false | false | false | false | false | 7,629 |
1943F | You are given a binary string$$$^dagger$$$ $$$s$$$ of length $$$n$$$. A binary string $$$p$$$ of the same length $$$n$$$ is called good if for every $$$i$$$ ($$$1 leq i leq n$$$), there exist indices $$$l$$$ and $$$r$$$ such that: $$$1 leq l leq i leq r leq n$$$ $$$s_i$$$ is a mode$$$^ddagger$$$ of the string $$$p_lp... | 3,500 | false | false | false | true | false | false | false | false | false | false | 616 |
1266F | Let $$$G$$$ be a simple graph. Let $$$W$$$ be a non-empty subset of vertices. Then $$$W$$$ is almost-$$$k$$$-uniform if for each pair of distinct vertices $$$u,v in W$$$ the distance between $$$u$$$ and $$$v$$$ is either $$$k$$$ or $$$k+1$$$. You are given a tree on $$$n$$$ vertices. For each $$$i$$$ between $$$1$$$ an... | 2,900 | false | false | false | false | false | false | false | false | false | true | 4,366 |
1423F | A famous gang of pirates, Sea Dogs, has come back to their hideout from one of their extravagant plunders. They want to split their treasure fairly amongst themselves, that is why You, their trusted financial advisor, devised a game to help them: All of them take a sit at their round table, some of them with the golden... | 2,700 | true | false | false | false | false | false | false | false | false | false | 3,558 |
441C | Valera has got a rectangle table consisting of _n_ rows and _m_ columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent cell that is on the intersection of row _x_ and column _y_ by a pair of integers (_x_,u2009_y_). Valera... | 1,500 | false | false | true | false | false | true | false | false | false | false | 8,073 |
1358B | Maria is the most active old lady in her house. She was tired of sitting at home. She decided to organize a ceremony against the coronavirus. She has $$$n$$$ friends who are also grannies (Maria is not included in this number). The $$$i$$$-th granny is ready to attend the ceremony, provided that at the time of her appe... | 1,000 | false | true | false | false | false | false | false | false | true | false | 3,896 |
1948E | You are given two integers, $$$n$$$ and $$$k$$$. There is a graph on $$$n$$$ vertices, numbered from $$$1$$$ to $$$n$$$, which initially has no edges. You have to assign each vertex an integer; let $$$a_i$$$ be the integer on the vertex $$$i$$$. All $$$a_i$$$ should be distinct integers from $$$1$$$ to $$$n$$$. After a... | 2,100 | false | true | true | false | false | true | true | false | false | true | 595 |
1003E | You are given three integers $$$n$$$, $$$d$$$ and $$$k$$$. Your task is to construct an undirected tree on $$$n$$$ vertices with diameter $$$d$$$ and degree of each vertex at most $$$k$$$, or say that it is impossible. An undirected tree is a connected undirected graph with $$$n - 1$$$ edges. Diameter of a tree is the ... | 2,100 | false | false | false | false | false | true | false | false | false | true | 5,670 |
320A | Problem - 320A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s... | 900 | false | true | false | false | false | false | true | false | false | false | 8,553 |
1956D | Nene gave you an array of integers $$$a_1, a_2, ldots, a_n$$$ of length $$$n$$$. You can perform the following operation no more than $$$5cdot 10^5$$$ times (possibly zero): Choose two integers $$$l$$$ and $$$r$$$ such that $$$1 le l le r le n$$$, compute $$$x$$$ as $$$operatorname{MEX}({a_l, a_{l+1}, ldots, a_r})$$$,... | 2,000 | true | true | true | true | false | true | true | false | false | false | 537 |
1854B | Andrea is playing the game Tanto Cuore. He has a deck of $$$n$$$ cards with values $$$a_1, ldots, a_n$$$ from top to bottom. Each card can be either locked or unlocked. Initially, only the topmost card is unlocked. The game proceeds in turns. In each turn, Andrea chooses an unlocked card in the deck — the value written... | 2,200 | false | false | false | true | false | false | true | false | false | false | 1,157 |
1758C | Given two integers $$$n$$$ and $$$x$$$, a permutation$$$^{dagger}$$$ $$$p$$$ of length $$$n$$$ is called funny if $$$p_i$$$ is a multiple of $$$i$$$ for all $$$1 leq i leq n - 1$$$, $$$p_n = 1$$$, and $$$p_1 = x$$$. Find the lexicographically minimal$$$^{ddagger}$$$ funny permutation, or report that no such permutation... | 1,400 | false | true | false | false | false | false | false | false | false | false | 1,766 |
1706D2 | This is the hard version of the problem. The only difference between the versions is the constraints on $$$n$$$, $$$k$$$, $$$a_i$$$, and the sum of $$$n$$$ over all test cases. You can make hacks only if both versions of the problem are solved. Note the unusual memory limit. You are given an array of integers $$$a_1, a... | 2,400 | true | true | false | true | true | true | true | false | false | false | 2,036 |
65D | As you know, Hogwarts has four houses: Gryffindor, Hufflepuff, Ravenclaw and Slytherin. The sorting of the first-years into houses is done by the Sorting Hat. The pupils are called one by one in the alphabetical order, each of them should put a hat on his head and, after some thought, the hat solemnly announces the nam... | 2,200 | false | false | false | false | false | false | true | false | false | false | 9,643 |
1843E | You are given an array $$$a$$$ consisting of $$$n$$$ zeros. You are also given a set of $$$m$$$ not necessarily different segments. Each segment is defined by two numbers $$$l_i$$$ and $$$r_i$$$ ($$$1 le l_i le r_i le n$$$) and represents a subarray $$$a_{l_i}, a_{l_i+1}, dots, a_{r_i}$$$ of the array $$$a$$$. Let's ca... | 1,600 | false | false | false | false | true | false | true | true | false | false | 1,226 |
1526F | This is an interactive problem. There is a secret permutation $$$p$$$ ($$$1$$$-indexed) of numbers from $$$1$$$ to $$$n$$$. More formally, for $$$1 leq i leq n$$$, $$$1 leq p[i] leq n$$$ and for $$$1 leq i < j leq n$$$, $$$p[i] eq p[j]$$$. It is known that $$$p[1]<p[2]$$$. In $$$1$$$ query, you give $$$3$$$ distinct i... | 3,000 | false | false | false | false | false | true | false | false | false | false | 3,030 |
821E | Okabe likes to take walks but knows that spies from the Organization could be anywhere; that's why he wants to know how many different walks he can take in his city safely. Okabe's city can be represented as all points (_x_,u2009_y_) such that _x_ and _y_ are non-negative. Okabe starts at the origin (point (0,u20090)),... | 2,100 | false | false | false | true | false | false | false | false | false | false | 6,469 |
185E | Imagine the Cartesian coordinate system. There are _k_ different points containing subway stations. One can get from any subway station to any one instantly. That is, the duration of the transfer between any two subway stations can be considered equal to zero. You are allowed to travel only between subway stations, tha... | 3,000 | false | false | false | false | true | false | false | true | false | false | 9,100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.