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
105A
In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill level is represented as an integer that increases when you use this skill. Different character classes...
1,700
false
false
true
false
false
false
false
false
false
false
9,466
976F
You are given a bipartite graph _G_u2009=u2009(_U_,u2009_V_,u2009_E_), _U_ is the set of vertices of the first part, _V_ is the set of vertices of the second part and _E_ is the set of edges. There might be multiple edges. Let's call some subset of its edges _k_-covering iff the graph has each of its vertices incident ...
2,500
false
false
false
false
false
false
false
false
false
true
5,825
1479C
Some time ago Homer lived in a beautiful city. There were $$$n$$$ blocks numbered from $$$1$$$ to $$$n$$$ and $$$m$$$ directed roads between them. Each road had a positive length, and each road went from the block with the smaller index to the block with the larger index. For every two (different) blocks, there was at ...
2,500
false
false
false
false
false
true
false
false
false
false
3,278
1305C
To become the king of Codeforces, Kuroni has to solve the following problem. He is given $$$n$$$ numbers $$$a_1, a_2, dots, a_n$$$. Help Kuroni to calculate $$$prod_{1le i<jle n} a_i - a_j$$$. As result can be very big, output it modulo $$$m$$$. If you are not familiar with short notation, $$$prod_{1le i<jle n} a_i - a...
1,600
true
false
false
false
false
false
true
false
false
false
4,162
167E
In some country live wizards. They like to make weird bets. Two wizards draw an acyclic directed graph with _n_ vertices and _m_ edges (the graph's vertices are numbered from 1 to _n_). A source is a vertex with no incoming edges, and a sink is the vertex with no outgoing edges. Note that a vertex could be the sink and...
2,900
true
false
false
false
false
false
false
false
false
true
9,191
467A
Problem - 467A - 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
7,972
909A
The preferred way to generate user login in Polygon is to concatenate a prefix of the user's first name and a prefix of their last name, in that order. Each prefix must be non-empty, and any of the prefixes can be the full name. Typically there are multiple possible logins for each person. You are given the first and t...
1,000
false
true
false
false
false
false
true
false
true
false
6,112
1068A
Ivan is collecting coins. There are only $$$N$$$ different collectible coins, Ivan has $$$K$$$ of them. He will be celebrating his birthday soon, so all his $$$M$$$ freinds decided to gift him coins. They all agreed to three terms: Everyone must gift as many coins as others. All coins given to Ivan must be different....
1,400
true
false
false
false
false
false
false
false
false
false
5,370
120B
A team quiz game called "What? Where? When?" is very popular in Berland. The game is centered on two teams competing. They are the team of six Experts versus the team of the Audience. A person from the audience asks a question and the experts are allowed a minute on brainstorming and finding the right answer to the que...
1,100
false
false
true
false
false
false
false
false
false
false
9,405
1674B
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language. The Berland di...
800
true
false
false
false
false
false
false
false
false
false
2,228
716B
ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In particular, if the string has length strictly less than 26, no such substring exists and thus it is not n...
1,300
false
true
false
false
false
false
false
false
false
false
6,953
580B
Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company. Kefa has _n_ friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the amount of money he has and the friendship factor in respect to Kefa. The parrot doesn't want any friend t...
1,500
false
false
false
false
false
false
false
true
true
false
7,527
463E
Caisa is now at home and his son has a simple task for him. Given a rooted tree with _n_ vertices, numbered from 1 to _n_ (vertex 1 is the root). Each vertex of the tree has a value. You should answer _q_ queries. Each query is one of the following: Format of the query is "1 _v_". Let's write out the sequence of verti...
2,100
true
false
false
false
false
false
true
false
false
false
7,985
1327C
Petya has a rectangular Board of size $$$n imes m$$$. Initially, $$$k$$$ chips are placed on the board, $$$i$$$-th chip is located in the cell at the intersection of $$$sx_i$$$-th row and $$$sy_i$$$-th column. In one action, Petya can move all the chips to the left, right, down or up by $$$1$$$ cell. If the chip was i...
1,600
false
false
true
false
false
true
false
false
false
false
4,076
1535F
Suppose you are given two strings $$$a$$$ and $$$b$$$. You can apply the following operation any number of times: choose any contiguous substring of $$$a$$$ or $$$b$$$, and sort the characters in it in non-descending order. Let $$$f(a, b)$$$ the minimum number of operations you have to apply in order to make them equal...
3,000
false
false
true
false
true
false
true
true
false
false
2,969
734E
Anton is growing a tree in his garden. In case you forgot, the tree is a connected acyclic undirected graph. There are _n_ vertices in the tree, each of them is painted black or white. Anton doesn't like multicolored trees, so he wants to change the tree such that all vertices have the same color (black or white). To c...
2,100
false
false
false
true
false
false
false
false
false
false
6,854
1834D
Zinaida Viktorovna has $$$n$$$ students in her history class. The homework for today included $$$m$$$ topics, but the students had little time to prepare, so $$$i$$$-th student learned only topics from $$$l_i$$$ to $$$r_i$$$ inclusive. At the beginning of the lesson, each student holds their hand at $$$0$$$. The teache...
1,900
false
true
true
false
true
false
true
false
true
false
1,281
1553C
Consider a simplified penalty phase at the end of a football match. A penalty phase consists of at most $$$10$$$ kicks, the first team takes the first kick, the second team takes the second kick, then the first team takes the third kick, and so on. The team that scores more goals wins; if both teams score the same numb...
1,200
false
true
false
true
false
false
true
false
false
false
2,873
1707D
Kawashiro Nitori is a girl who loves competitive programming. One day she found a rooted tree consisting of $$$n$$$ vertices. The root is vertex $$$1$$$. As an advanced problem setter, she quickly thought of a problem. Kawashiro Nitori has a vertex set $$$U={1,2,ldots,n}$$$. She's going to play a game with the tree and...
3,000
true
false
false
true
false
false
false
false
false
false
2,031
809B
This is an interactive problem. In the output section below you will see the information about flushing the output. On Sunday Leha the hacker took Nura from the house where she lives and went with her to one of the most luxurious restaurants in Vičkopolis. Upon arrival, they left the car in a huge parking lot near the ...
2,200
false
false
false
false
false
false
false
true
false
false
6,527
723E
There are _n_ cities and _m_ two-way roads in Berland, each road connects two cities. It is known that there is no more than one road connecting each pair of cities, and there is no road which connects the city with itself. It is possible that there is no way to get from one city to some other city using only these roa...
2,200
false
true
false
false
false
true
false
false
false
true
6,916
1593G
A sequence of round and square brackets is given. You can change the sequence by performing the following operations: 1. change the direction of a bracket from opening to closing and vice versa without changing the form of the bracket: i.e. you can change '(' to ')' and ')' to '('; you can change '" and "(())()" are co...
2,200
false
true
false
true
true
true
false
false
false
false
2,679
1354G
This is an interactive problem. Don't forget to flush output after printing queries using cout.flush() or fflush(stdout) in C++ or similar functions in other programming languages. There are $$$n$$$ gift boxes in a row, numbered from $$$1$$$ to $$$n$$$ from left to right. It's known that exactly $$$k$$$ of them contain...
2,600
false
false
false
false
false
false
false
true
false
false
3,932
1556F
William is not only interested in trading but also in betting on sports matches. $$$n$$$ teams participate in each match. Each team is characterized by strength $$$a_i$$$. Each two teams $$$i < j$$$ play with each other exactly once. Team $$$i$$$ wins with probability $$$frac{a_i}{a_i + a_j}$$$ and team $$$j$$$ wins wi...
2,500
true
false
false
true
false
false
false
false
false
true
2,850
1051A
Vasya came up with a password to register for EatForces — a string $$$s$$$. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits. But since EatForces takes care of the security of its users, user passwords must contain at least one digit, at least one uppercase La...
1,200
false
true
true
false
false
false
false
false
false
false
5,455
15A
Problem - 15A - Codeforces =============== xa0 ") . Then there follow _n_ lines, each of them contains two space-separated integer numbers: _x__i_ _a__i_, where _x__i_ — _x_-coordinate of the centre of the _i_-th house, and _a__i_ — length of its side (u2009-u20091000u2009≤u2009_x__i_u2009≤u20091000, ...
1,200
false
false
true
false
false
false
false
false
true
false
9,920
1906B
You are given $$$N$$$ buttons (numbered from $$$1$$$ to $$$N$$$) and $$$N$$$ lamps (numbered from $$$1$$$ to $$$N$$$). Each lamp can either be on or off. Initially, lamp $$$i$$$ is on if $$$A_i = 1$$$, and off if $$$A_i = 0$$$. Button $$$i$$$ is connected to lamp $$$i - 1$$$ (if $$$i > 1$$$) and lamp $$$i + 1$$$ (if $$...
2,600
false
false
false
false
false
true
false
false
false
false
876
231D
One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coordinate axes, one of its vertices is at point (0,u20090,u20090), and the opposite one is at point...
1,600
false
false
false
false
false
false
true
false
false
false
8,913
1129D
Problem - 1129D - 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,900
false
false
false
true
true
false
false
false
false
false
5,073
1380G
You are creating a level for a video game. The level consists of $$$n$$$ rooms placed in a circle. The rooms are numbered $$$1$$$ through $$$n$$$. Each room contains exactly one exit: completing the $$$j$$$-th room allows you to go the $$$(j+1)$$$-th room (and completing the $$$n$$$-th room allows you to go the $$$1$$$...
2,600
true
true
false
false
false
false
false
false
false
false
3,765
1195B
Each evening after the dinner the SIS's students gather together to play the game of Sport Mafia. For the tournament, Alya puts candies into the box, which will serve as a prize for a winner. To do that, she performs $$$n$$$ actions. The first action performed is to put a single candy into the box. For each of the rema...
1,000
true
false
false
false
false
false
true
true
false
false
4,728
934B
Problem - 934B - 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
false
true
false
false
true
false
false
false
false
5,965
1827B2
The only difference between this problem and the easy version is the constraints on $$$t$$$ and $$$n$$$. You are given an array $$$a$$$, consisting of $$$n$$$ distinct integers $$$a_1, a_2, ldots, a_n$$$. Define the beauty of an array $$$p_1, p_2, ldots p_k$$$ as the minimum amount of time needed to sort this array usi...
2,400
false
true
false
true
true
false
false
true
false
false
1,321
792C
A positive integer number _n_ is written on a blackboard. It consists of not more than 105 digits. You have to transform it into a beautiful number by erasing some of the digits, and you want to erase as few digits as possible. The number is called beautiful if it consists of at least one digit, doesn't have leading ze...
2,000
true
true
false
true
false
false
false
false
false
false
6,611
875C
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library. Some long and uninteresting story was removed... The alphabet of Bookland is so large that its letters are denoted by positive integers. Each letter can be small or large, the large vers...
2,100
false
false
true
false
false
false
false
false
false
true
6,246
1949J
This problem has an attachment. You can use it to simulate and visualize the movements of the amoeba. Amoeba Amanda lives inside a rectangular grid of square pixels. Her body occupies some of these pixels. Other pixels may be either free or blocked. Amanda moves across the grid using the so-called amoeboid movement. In...
2,600
false
false
true
false
false
false
false
false
false
true
583
2038J
Monocarp is waiting for a bus at the bus stop. Unfortunately, there are many people who want to ride a bus too. You are given a list of events of two types: B $$$b_i$$$xa0— a bus with $$$b_i$$$ free seats arrives at the stop; P $$$p_i$$$xa0— $$$p_i$$$ people arrive at the stop. These events are listed in a chronologi...
800
false
true
true
false
false
false
false
false
false
false
29
1284G
It is only a few days until Seollal (Korean Lunar New Year), and Jaehyun has invited his family to his garden. There are kids among the guests. To make the gathering more fun for the kids, Jaehyun is going to run a game of hide-and-seek. The garden can be represented by a $$$n imes m$$$ grid of unit cells. Some (possi...
3,300
false
false
false
false
false
false
false
false
false
true
4,268
1380A
Problem - 1380A - 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
false
false
false
false
true
false
true
false
false
false
3,771
1321C
You are given a string $$$s$$$ consisting of lowercase Latin letters. Let the length of $$$s$$$ be $$$s$$$. You may perform several operations on this string. In one operation, you can choose some index $$$i$$$ and remove the $$$i$$$-th character of $$$s$$$ ($$$s_i$$$) if at least one of its adjacent characters is the ...
1,600
false
true
false
false
false
true
true
false
false
false
4,108
1814F
There are $$$n$$$ communication towers, numbered from $$$1$$$ to $$$n$$$, and $$$m$$$ bidirectional wires between them. Each tower has a certain set of frequencies that it accepts, the $$$i$$$-th of them accepts frequencies from $$$l_i$$$ to $$$r_i$$$. Let's say that a tower $$$b$$$ is accessible from a tower $$$a$$$, ...
2,700
false
false
false
false
false
false
true
false
false
false
1,382
983D
Arkady has got an infinite plane painted in color $$$0$$$. Then he draws $$$n$$$ rectangles filled with paint with sides parallel to the Cartesian coordinate axes, one after another. The color of the $$$i$$$-th rectangle is $$$i$$$ (rectangles are enumerated from $$$1$$$ to $$$n$$$ in the order he draws them). It is po...
3,300
false
false
false
false
true
false
false
false
false
false
5,783
1566A
You are given two positive integers $$$n$$$ and $$$s$$$. Find the maximum possible median of an array of $$$n$$$ non-negative integers (not necessarily distinct), such that the sum of its elements is equal to $$$s$$$. A median of an array of integers of length $$$m$$$ is the number standing on the $$$lceil {frac{m}{2}}...
800
true
true
false
false
false
false
false
true
false
false
2,813
834A
Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadaysxa0– caramel spinner! Wanting to join the craze, she has immediately bought the strange contraption. Spinners in Sweetland have the form of V-shaped pieces of caramel. Each ...
900
false
false
true
false
false
false
false
false
false
false
6,429
1831A
You are given a permutation$$$^dagger$$$ $$$a$$$ of length $$$n$$$. Find any permutation $$$b$$$ of length $$$n$$$ such that $$$a_1+b_1 le a_2+b_2 le a_3+b_3 le ldots le a_n+b_n$$$. It can be proven that a permutation $$$b$$$ that satisfies the condition above always exists. $$$^dagger$$$ A permutation of length $$$n$$...
800
false
false
false
false
false
true
false
false
false
false
1,300
313A
Ilya is a very clever lion, he lives in an unusual city ZooVille. In this city all the animals have their rights and obligations. Moreover, they even have their own bank accounts. The state of a bank account is an integer. The state of a bank account can be a negative number. This means that the owner of the account ow...
900
false
false
true
false
false
false
false
false
false
false
8,595
1973C
Fox loves permutations! She came up with the following problem and asked Cat to solve it: You are given an even positive integer $$$n$$$ and a permutation$$$^dagger$$$ $$$p$$$ of length $$$n$$$. The score of another permutation $$$q$$$ of length $$$n$$$ is the number of local maximums in the array $$$a$$$ of length $$$...
1,700
true
true
true
false
false
true
false
false
true
false
453
163C
Anton came to a chocolate factory. There he found a working conveyor and decided to run on it from the beginning to the end. The conveyor is a looped belt with a total length of 2_l_ meters, of which _l_ meters are located on the surface and are arranged in a straight line. The part of the belt which turns at any momen...
2,100
false
false
false
false
false
false
false
false
true
false
9,213
1303A
Problem - 1303A - 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
false
false
true
false
false
false
false
false
false
false
4,178
780F
A couple of friends, Axel and Marston are travelling across the country of Bitland. There are _n_ towns in Bitland, with some pairs of towns connected by one-directional roads. Each road in Bitland is either a pedestrian road or a bike road. There can be multiple roads between any pair of towns, and may even be a road ...
2,400
false
false
false
true
false
false
false
false
false
true
6,643
1097D
Makoto has a big blackboard with a positive integer $$$n$$$ written on it. He will perform the following action exactly $$$k$$$ times: Suppose the number currently written on the blackboard is $$$v$$$. He will randomly pick one of the divisors of $$$v$$$ (possibly $$$1$$$ and $$$v$$$) and replace $$$v$$$ with this divi...
2,200
true
false
false
true
false
false
false
false
false
false
5,221
472G
There is a simple way to create hard tasks: take one simple problem as the query, and try to find an algorithm that can solve it faster than bruteforce. This kind of tasks usually appears in OI contest, and usually involves data structures. Let's try to create a task, for example, we take the "Hamming distance problem"...
2,800
false
false
false
false
true
false
false
false
false
false
7,941
180B
Vasya studies divisibility rules at school. Here are some of them: Divisibility by 2. A number is divisible by 2 if and only if its last digit is divisible by 2 or in other words, is even. Divisibility by 3. A number is divisible by 3 if and only if the sum of its digits is divisible by 3. Divisibility by 4. A numbe...
2,300
true
false
false
false
false
false
false
false
false
false
9,121
125E
The MST (Meaningless State Team) company won another tender for an important state reform in Berland. There are _n_ cities in Berland, some pairs of the cities are connected by roads. Each road has its price. One can move along any road in any direction. The MST team should carry out the repair works on some set of roa...
2,400
false
false
false
false
false
false
false
true
false
true
9,378
1290A
You and your $$$n - 1$$$ friends have found an array of integers $$$a_1, a_2, dots, a_n$$$. You have decided to share it in the following way: All $$$n$$$ of you stand in a line in a particular order. Each minute, the person at the front of the line chooses either the first or the last element of the array, removes it,...
1,600
false
false
true
false
true
false
true
false
false
false
4,246
1989A
Monocarp visited a retro arcade club with arcade cabinets. There got curious about the "Catch the Coin" cabinet. The game is pretty simple. The screen represents a coordinate grid such that: the X-axis is directed from left to right; the Y-axis is directed from bottom to top; the center of the screen has coordinates...
800
false
false
true
false
false
false
false
false
false
false
341
1861F
The game of Berland poker is played as follows. There are $$$n+1$$$ people: $$$n$$$ players, numbered from $$$1$$$ to $$$n$$$, and the dealer. The dealer has a deck which contains cards of four different suits (the number of cards of each suit is not necessarily the same); the number of cards in the deck is divisible b...
3,200
false
true
false
false
false
false
false
true
false
false
1,114
708B
Problem - 708B - 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,900
true
true
true
false
false
true
false
false
false
false
6,988
593B
The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of _n_ lines defined by the equations _y_u2009=u2009_k__i_·_x_u2009+u2009_b__i_. It was necessary to determine whether there is at least one point of inter...
1,600
false
false
false
false
false
false
false
false
true
false
7,476
1718A1
This is the easy version of this problem. The difference between easy and hard versions is only the constraints on $$$a_i$$$ and on $$$n$$$. You can make hacks only if both versions of the problem are solved. Burenka is the crown princess of Buryatia, and soon she will become the $$$n$$$-th queen of the country. There ...
1,800
false
true
false
true
false
false
false
false
false
false
1,975
501D
Let's define the sum of two permutations _p_ and _q_ of numbers 0,u20091,u2009...,u2009(_n_u2009-u20091) as permutation , where _Perm_(_x_) is the _x_-th lexicographically permutation of numbers 0,u20091,u2009...,u2009(_n_u2009-u20091) (counting from zero), and _Ord_(_p_) is the number of permutation _p_ in the lexicog...
2,000
false
false
false
false
true
false
false
false
false
false
7,827
1951E
You are given a string $$$s$$$ consisting of lowercase Latin characters. You need to partition$$$^dagger$$$ this string into some substrings, such that each substring is not a palindrome$$$^ddagger$$$. $$$^dagger$$$ A partition of a string $$$s$$$ is an ordered sequence of some $$$k$$$ strings $$$t_1, t_2, ldots, t_k$$...
2,000
true
true
true
false
false
true
true
false
false
false
570
176D
Paul Erdős's prediction came true. Finally an alien force landed on the Earth. In contrary to our expectation they didn't asked the humans to compute the value of a Ramsey number (maybe they had solved it themselves). They asked another question which seemed as hard as calculating Ramsey numbers. Aliens threatened that...
2,500
false
false
false
true
false
false
false
false
false
false
9,156
808D
Problem - 808D - Codeforces =============== xa0 ]( "52010") so that the sum of all elements in the first part equals to the sum of elements in the second part. It is not always possible, so Vasya will move some element before dividing the array (Vasya will erase some element and insert it into an arbit...
1,900
false
false
true
false
true
false
false
true
false
false
6,532
1943C
You are given a tree with $$$n$$$ vertices numbered $$$1, 2, ldots, n$$$. Initially, all vertices are colored white. You can perform the following two-step operation: 1. Choose a vertex $$$v$$$ ($$$1 leq v leq n$$$) and a distance $$$d$$$ ($$$0 leq d leq n-1$$$). 2. For all vertices $$$u$$$ ($$$1 leq u leq n$$$) such t...
2,300
false
true
false
false
false
true
false
false
false
false
621
19C
Problem - 19C - Codeforces =============== xa0 — length of the string. The following line contains _n_ space-separated integer numbers from 0 to 109 inclusive — numbers that stand for the letters of the string. It's guaranteed that each letter can be met in the string at most 10 times. Output In the first...
2,200
false
true
false
false
false
false
false
false
false
false
9,898
1746E1
The only difference between this problem and the hard version is the maximum number of questions. This is an interactive problem. There is a hidden integer $$$1 le x le n$$$ which you have to find. In order to find it you can ask at most $$$mathbf{82}$$$ questions. In each question you can choose a non-empty integer se...
2,500
false
false
false
false
false
true
false
true
false
false
1,806
1495B
On a weekend, Qingshan suggests that she and her friend Daniel go hiking. Unfortunately, they are busy high school students, so they can only go hiking on scratch paper. A permutation $$$p$$$ is written from left to right on the paper. First Qingshan chooses an integer index $$$x$$$ ($$$1le xle n$$$) and tells it to Da...
1,900
false
true
false
false
false
false
false
false
false
false
3,195
899A
There were _n_ groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team. The coach decided to form teams of exactly three people for this training. Determine the maximum number of team...
800
true
true
false
false
false
true
false
false
false
false
6,152
1965F
You have been asked to organize a very important art conference. The first step is to choose the dates. The conference must last for a certain number of consecutive days. Each day, one lecturer must perform, and the same lecturer cannot perform more than once. You asked $$$n$$$ potential lecturers if they could partici...
3,300
false
false
false
false
true
false
false
false
false
false
511
1187B
The letters shop showcase is a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters. As the name tells, letters are sold in the shop. Letters are sold one by one from the leftmost to the rightmost. Any customer can only buy some prefix of letters from the string $$$s$$$. There are $$$m$$$ friends, the $$$i$$$-...
1,300
false
false
true
false
false
false
false
true
false
false
4,765
1284F
Donghyun's new social network service (SNS) contains $$$n$$$ users numbered $$$1, 2, ldots, n$$$. Internally, their network is a tree graph, so there are $$$n-1$$$ direct connections between each user. Each user can reach every other users by using some sequence of direct connections. From now on, we will denote this p...
3,200
true
false
false
false
true
false
false
false
false
true
4,269
1644A
The knight is standing in front of a long and narrow hallway. A princess is waiting at the end of it. In a hallway there are three doors: a red door, a green door and a blue door. The doors are placed one after another, however, possibly in a different order. To proceed to the next door, the knight must first open the ...
800
false
false
true
false
false
false
false
false
false
false
2,401
1348D
Phoenix has decided to become a scientist! He is currently investigating the growth of bacteria. Initially, on day $$$1$$$, there is one bacterium with mass $$$1$$$. Every day, some number of bacteria will split (possibly zero or all). When a bacterium of mass $$$m$$$ splits, it becomes two bacteria of mass $$$frac{m}{...
1,900
true
true
true
false
false
true
false
true
false
false
3,967
1183E
The only difference between the easy and the hard versions is constraints. A subsequence is a string that can be derived from another string by deleting some or no symbols without changing the order of the remaining symbols. Characters to be deleted are not required to go successively, there can be any gaps between the...
2,000
false
false
true
true
false
false
false
false
false
true
4,798
1368F
# Lamps on a Circle Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes This is an interactive problem. John and his imaginary friend play a game. There are n lamps arranged in a circle. Lamps are numbered 1 through n in clockwise order, that is, lamps i and i...
2,600
true
false
true
false
false
false
false
false
false
false
3,831
961A
You are given a following process. There is a platform with $$$n$$$ columns. $$$1 imes 1$$$ squares are appearing one after another in some columns on this platform. If there are no squares in the column, a square will occupy the bottom row. Otherwise a square will appear at the top of the highest square of this colum...
900
false
false
true
false
false
false
false
false
false
false
5,863
1709F
You are given three integers $$$n$$$, $$$k$$$ and $$$f$$$. Consider all binary strings (i.u2009e. all strings consisting of characters $$$0$$$ and/or $$$1$$$) of length from $$$1$$$ to $$$n$$$. For every such string $$$s$$$, you need to choose an integer $$$c_s$$$ from $$$0$$$ to $$$k$$$. A multiset of binary strings o...
2,500
true
false
false
true
false
false
true
false
false
true
2,021
965A
Problem - 965A - Codeforces =============== xa0 xa0— the number of people, the number of airplanes each should make, the number of airplanes that can be made using one sheet and the number of sheets in one pack, respectively. Output Print a single integerxa0— the minimum number of packs they should buy. Examples...
800
true
false
false
false
false
false
false
false
false
false
5,842
839C
There are _n_ cities and _n_u2009-u20091 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads. Theon and Yara Greyjoy are on a horse in the first city, they are starting traveling through the roads. But the weather is foggy, so they can’t see where the horse b...
1,500
false
false
false
true
false
false
false
false
false
true
6,406
1511C
You have a card deck of $$$n$$$ cards, numbered from top to bottom, i.xa0e. the top card has index $$$1$$$ and bottom cardxa0— index $$$n$$$. Each card has its color: the $$$i$$$-th card has color $$$a_i$$$. You should process $$$q$$$ queries. The $$$j$$$-th query is described by integer $$$t_j$$$. For each query you s...
1,100
false
false
true
false
true
false
true
false
false
false
3,114
1469E
Let's call two strings $$$a$$$ and $$$b$$$ (both of length $$$k$$$) a bit similar if they have the same character in some position, i.xa0e. there exists at least one $$$i in [1, k]$$$ such that $$$a_i = b_i$$$. You are given a binary string $$$s$$$ of length $$$n$$$ (a string of $$$n$$$ characters 0 and/or 1) and an in...
2,400
false
false
false
false
false
false
true
false
false
false
3,334
923B
Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a giftxa0— a large snow maker. He plans to make some amount of snow every day. On day _i_ he will make a pile of snow of volume _V__i_ and put it in her garden. Each day, every...
1,600
false
false
false
false
true
false
false
true
false
false
6,022
180E
Problem - 180E - 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,800
false
false
false
true
false
false
false
true
false
false
9,118
1979D
You are given a binary string $$$s$$$ of length $$$n$$$, consisting of zeros and ones. You can perform the following operation exactly once: 1. Choose an integer $$$p$$$ ($$$1 le p le n$$$). 2. Reverse the substring $$$s_1 s_2 ldots s_p$$$. After this step, the string $$$s_1 s_2 ldots s_n$$$ will become $$$s_p s_{p-1} ...
1,800
false
true
false
true
false
true
true
false
false
false
413
1810G
You're going to generate an array $$$a$$$ with a length of at most $$$n$$$, where each $$$a_{i}$$$ equals either $$$1$$$ or $$$-1$$$. You generate this array in the following way. First, you choose some integer $$$k$$$ ($$$1le k le n$$$), which decides the length of $$$a$$$. Then, for each $$$i$$$ ($$$1le i le k$$$),...
3,200
false
false
false
true
false
false
false
false
false
false
1,407
638A
The main street of Berland is a straight line with _n_ houses built along it (_n_ is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are numbered from 1 to _n_u2009-u20091 in the order from the beginning of the street to the end (in the ...
1,100
true
false
false
false
false
true
false
false
false
false
7,261
2024A
Alice has $$$a$$$ coins. She can open a bank deposit called "Profitable", but the minimum amount required to open this deposit is $$$b$$$ coins. There is also a deposit called "Unprofitable", which can be opened with any amount of coins. Alice noticed that if she opens the "Unprofitable" deposit with $$$x$$$ coins, the...
800
true
true
false
false
false
false
false
false
false
false
125
1019E
By the year 3018, Summer Informatics School has greatly grown. Hotel «Berendeetronik» has been chosen as a location of the school. The camp consists of $$$n$$$ houses with $$$n-1$$$ pathways between them. It is possible to reach every house from each other using the pathways. Everything had been perfect until the rains...
3,200
false
false
false
false
true
false
false
false
false
false
5,593
1771E
Hossam bought a new piece of ground with length $$$n$$$ and width $$$m$$$, he divided it into an $$$n cdot m$$$ grid, each cell being of size $$$1 imes1$$$. Since Hossam's name starts with the letter 'H', he decided to draw the capital letter 'H' by building walls of size $$$1 imes1$$$ on some squares of the ground. Ea...
2,500
false
false
true
true
false
false
true
false
false
false
1,665
1698E
You are given a permutation $$$a$$$ of length $$$n$$$. Recall that permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. You have a strength of $$$s$$$ and perform $$$n$$$ moves on the permutation $$$a$$$. The $$$i$$$-th move consists of the following: Pick two int...
2,300
false
true
false
false
false
false
true
false
true
false
2,090
1117C
You a captain of a ship. Initially you are standing in a point $$$(x_1, y_1)$$$ (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point $$$(x_2, y_2)$$$. You know the weather forecast — the string $$$s$$$ of length $$$n$$$, consisting only of letters U, D, L and R. Th...
1,900
false
false
false
false
false
false
false
true
false
false
5,107
1666D
Problem - 1666D - 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
false
true
false
false
false
false
false
false
false
false
2,282
262A
Problem - 262A - 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,785
448D
Problem - 448D - 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,800
false
false
false
false
false
false
true
true
false
false
8,046
1945E
Anton got bored during the hike and wanted to solve something. He asked Kirill if he had any new problems, and of course, Kirill had one. You are given a permutation $$$p$$$ of size $$$n$$$, and a number $$$x$$$ that needs to be found. A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers ...
1,700
false
true
false
false
false
true
false
true
false
false
609
520E
Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out _n_ numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between certain digits in the line so that the result was a correct arithmetic expression; formally, n...
2,200
true
false
false
true
false
false
false
false
false
false
7,753
209C
Vasya went for a walk in the park. The park has _n_ glades, numbered from 1 to _n_. There are _m_ trails between the glades. The trails are numbered from 1 to _m_, where the _i_-th trail connects glades _x__i_ and _y__i_. The numbers of the connected glades may be the same (_x__i_u2009=u2009_y__i_), which means that a ...
2,400
false
true
false
false
false
true
false
false
false
true
8,994
250E
Joe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path. Joe's house has _n_ floors, each floor is a segment of _m_ cells. Each cell either contains nothing (it is an empty cell), or has a brick or a concrete wall (always something one of three). It is believed that eac...
2,000
false
false
false
false
false
false
true
false
false
false
8,832
1469D
You have an array $$$a_1, a_2, dots, a_n$$$ where $$$a_i = i$$$. In one step, you can choose two indices $$$x$$$ and $$$y$$$ ($$$x eq y$$$) and set $$$a_x = leftlceil frac{a_x}{a_y} ight ceil$$$ (ceiling function). Your goal is to make array $$$a$$$ consist of $$$n - 1$$$ ones and $$$1$$$ two in no more than $$$n + 5...
1,700
true
false
false
false
false
true
true
false
false
false
3,335