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
766D
Mahmoud wants to write a new dictionary that contains _n_ words and relations between them. There are two types of relations: synonymy (i.xa0e. the two words mean the same) and antonymy (i.xa0e. the two words mean the opposite). From time to time he discovers a new relation between two words. He know that if two words ...
2,000
false
false
false
true
true
false
false
false
false
true
6,720
1762A
An array $$$b$$$ is good if the sum of elements of $$$b$$$ is even. You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. In one operation, you can select an index $$$i$$$ and change $$$a_i := lfloor frac{a_i}{2} floor$$$. $$$^dagger$$$ Find the minimum number of operations (possibly $$$0$$$) needed ...
800
true
true
false
false
false
false
false
false
false
false
1,740
1878G
After (finally) qualifying for the IOI 2023, wxhtzdy was very happy, so he decided to do what most competitive programmers do: trying to guess the problems that will be on IOI. During this process, he accidentally made a problem, which he thought was really cool. You are given a tree (a connected acyclic graph) with $$...
2,300
false
false
true
false
true
false
true
true
false
false
1,011
2033E
Sakurako's exams are over, and she did excellently. As a reward, she received a permutation $$$p$$$. Kosuke was not entirely satisfied because he failed one exam and did not receive a gift. He decided to sneak into her room (thanks to the code for her lock) and spoil the permutation so that it becomes simple. A permuta...
1,400
true
true
false
false
true
false
true
false
false
true
64
1827D
You are given a tree (an undirected connected acyclic graph) which initially only contains vertex $$$1$$$. There will be several queries to the given tree. In the $$$i$$$-th query, vertex $$$i + 1$$$ will appear and be connected to vertex $$$p_i$$$ ($$$1 le p_i le i$$$). After each query, please find out the least numb...
2,800
false
true
false
false
true
false
false
false
false
false
1,319
868B
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each other. The entire universe turned into an enormous clock face with t...
1,400
false
false
true
false
false
false
false
false
false
false
6,272
1028D
Let's consider a simplified version of order book of some stock. The order book is a list of orders (offers) from people that want to buy or sell one unit of the stock, each order is described by direction (BUY or SELL) and price. At every moment of time, every SELL offer has higher price than every BUY offer. In this ...
2,100
false
true
false
false
true
false
false
false
false
false
5,566
1625C
The Government of Mars is not only interested in optimizing space flights, but also wants to improve the road system of the planet. One of the most important highways of Mars connects Olymp City and Kstolop, the capital of Cydonia. In this problem, we only consider the way from Kstolop to Olymp City, but not the revers...
1,700
false
false
false
true
false
false
false
false
false
false
2,491
596A
After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parallel to them. Of course, the area of the rectangle must be positive. Wilbur had all four vertices of the planned...
1,100
false
false
true
false
false
false
false
false
false
false
7,465
1674C
You are given a string $$$s$$$, consisting only of Latin letters 'a', and a string $$$t$$$, consisting of lowercase Latin letters. In one move, you can replace any letter 'a' in the string $$$s$$$ with a string $$$t$$$. Note that after the replacement string $$$s$$$ might contain letters other than 'a'. You can perform...
1,000
false
false
true
false
false
false
false
false
false
false
2,227
1776J
An Italian data center consists of a set of servers, each colored green, white, or red, and a set of wires connecting them. Each wire connects two distinct servers and two servers are connected by at most one wire. Additionally, the data center is connected, i.e. there is a way to transmit information between any two s...
2,500
false
false
false
false
false
false
false
false
false
true
1,619
370C
A Christmas party in city S. had _n_ children. All children came in mittens. The mittens can be of different colors, but each child had the left and the right mitten of the same color. Let's say that the colors of the mittens are numbered with integers from 1 to _m_, and the children are numbered from 1 to _n_. Then th...
1,800
false
true
false
false
false
true
false
false
true
false
8,351
2018F1
This is the easy version of the problem. In the three versions, the constraints on $$$n$$$ and the time limit are different. You can make hacks only if all the versions of the problem are solved. This is the statement of Problem D1B: There are $$$n$$$ cities in a row, numbered $$$1, 2, ldots, n$$$ left to right. At...
2,900
true
true
false
true
false
false
false
false
false
false
157
730E
All-Berland programming contest comes to an end. In total, _n_ teams participated in it. Like in ACM-ICPC, current results stopped refreshing one hour before the contest ends. So at the Award Ceremony, results are partially known. For each team the value _a__i_ is given β€” the number of points the _i_-th team has earned...
2,200
false
true
true
false
false
false
false
false
false
false
6,884
1967F
Let $$$p_1, ldots, p_n$$$ be a permutation of $$$[1, ldots, n]$$$. Let the $$$q$$$-subsequence of $$$p$$$ be a permutation of $$$[1, q]$$$, whose elements are in the same relative order as in $$$p_1, ldots, p_n$$$. That is, we extract all elements not exceeding $$$q$$$ together from $$$p$$$ in the original order, and t...
3,200
false
false
true
false
true
false
true
false
false
false
501
778E
Boris really likes numbers and even owns a small shop selling interesting numbers. He has _n_ decimal numbers _B__i_. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values _c__d_, where _c__d_ is the cost of the digit _d_. Of course, Boris is interested in that numbers he o...
3,000
false
false
false
true
false
false
false
false
true
false
6,652
1182E
Problem - 1182E - 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,300
true
false
false
true
false
false
false
false
false
false
4,804
356A
Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all knights in the kingdom and they in turn agreed to participate in this grand event. As for you, you're just a simple peasant. There's no surprise that you slept in this morning and were late for the tournamen...
1,500
false
false
false
false
true
false
false
false
false
false
8,411
524D
Polycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user requests for this time period. For each query, we know its time... and nothing else, because Polycarp...
2,100
false
true
false
false
false
false
false
false
false
false
7,739
1301A
You are given three strings $$$a$$$, $$$b$$$ and $$$c$$$ of the same length $$$n$$$. The strings consist of lowercase English letters only. The $$$i$$$-th letter of $$$a$$$ is $$$a_i$$$, the $$$i$$$-th letter of $$$b$$$ is $$$b_i$$$, the $$$i$$$-th letter of $$$c$$$ is $$$c_i$$$. For every $$$i$$$ ($$$1 leq i leq n$$$)...
800
false
false
true
false
false
false
false
false
false
false
4,194
359E
Simon loves neatness. So before he goes to bed, Simon wants to complete all chores in the house. Simon's house looks like a rectangular table consisting of _n_ rows and _n_ columns from above. All rows of the table are numbered from 1 to _n_ from top to bottom. All columns of the table are numbered from 1 to _n_ from l...
2,400
false
false
false
false
false
true
false
false
false
false
8,395
439E
Today is Devu's birthday. For celebrating the occasion, he bought _n_ sweets from the nearby market. He has invited his _f_ friends. He would like to distribute the sweets among them. As he is a nice guy and the occasion is great, he doesn't want any friend to be sad, so he would ensure to give at least one sweet to ea...
2,100
true
false
false
true
false
false
false
false
false
false
8,080
1737D
Ela needs to send a large package from machine $$$1$$$ to machine $$$n$$$ through a network of machines. Currently, with the network condition, she complains that the network is too slow and the package can't arrive in time. Luckily, a Wiring Wizard offered her a helping hand. The network can be represented as an undir...
2,200
false
true
true
true
false
false
true
false
false
true
1,865
366B
You helped Dima to have a great weekend, but it's time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong. Inna and Dima are now in one room. Inna tells Dima off for everything he does in her presence. After Inna tells him off for something, she goes to another room, walks there in c...
1,200
false
false
true
false
false
false
true
false
false
false
8,369
465A
Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of _n_ bits. These bits are numbered from 1 to _n_. An integer is stored in the cell in the following way: the least significant bit is stored in the first bit of the cell, the next significant bit is stored...
900
false
false
true
false
false
false
false
false
false
false
7,979
1914G1
The easy and hard versions of this problem differ only in the constraints on $$$n$$$. In the easy version, the sum of values of $$$n^2$$$ over all test cases does not exceed $$$10^6$$$. Furthermore, $$$n$$$ does not exceed $$$1000$$$ in each test case. There are $$$2n$$$ light bulbs arranged in a row. Each light bulb h...
2,100
true
false
false
true
false
false
true
false
false
true
812
343E
Mad scientist Mike has applied for a job. His task is to manage a system of water pumping stations. The system consists of _n_ pumping stations, which are numbered by integers from 1 to _n_. Some pairs of stations are connected by bidirectional pipes through which water can flow in either direction (but only in one at ...
2,900
false
true
false
false
false
false
true
false
false
true
8,459
1733D2
This is the hard version of this problem. In this version, $$$n le 5000$$$ holds, and this version has no restriction between $$$x$$$ and $$$y$$$. You can make hacks only if both versions of the problem are solved. You are given two binary strings $$$a$$$ and $$$b$$$, both of length $$$n$$$. You can do the following op...
2,000
false
true
false
true
false
false
false
false
false
false
1,888
208C
The Berland road network consists of _n_ cities and of _m_ bidirectional roads. The cities are numbered from 1 to _n_, where the main capital city has number _n_, and the culture capital β€” number 1. The road network is set up so that it is possible to reach any city from any other one by the roads. Moving on each road ...
1,900
false
false
false
true
false
false
false
false
false
true
8,999
417E
Problem - 417E - 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,400
true
false
false
false
false
true
false
false
false
false
8,153
761C
After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length _n_ which satisfies the following requirements: There is at least one digit in the string, There is at least one lowercase (small) letter of the Latin alphabet in the string, The...
1,500
false
false
true
true
false
false
true
false
false
false
6,747
1174F
This is an interactive problem. You're given a tree consisting of $$$n$$$ nodes, rooted at node $$$1$$$. A tree is a connected graph with no cycles. We chose a hidden node $$$x$$$. In order to find this node, you can ask queries of two types: d $$$u$$$ ($$$1 le u le n$$$). We will answer with the distance between node...
2,400
false
false
true
false
false
true
false
false
false
true
4,846
1092F
You are given a tree consisting exactly of $$$n$$$ vertices. Tree is a connected undirected graph with $$$n-1$$$ edges. Each vertex $$$v$$$ of this tree has a value $$$a_v$$$ assigned to it. Let $$$dist(x, y)$$$ be the distance between the vertices $$$x$$$ and $$$y$$$. The distance between the vertices is the number of...
1,900
false
false
false
true
false
false
false
false
false
false
5,245
1552G
Andrea has come up with what he believes to be a novel sorting algorithm for arrays of length $$$n$$$. The algorithm works as follows. Initially there is an array of $$$n$$$ integers $$$a_1,, a_2,, dots,, a_n$$$. Then, $$$k$$$ steps are executed. For each $$$1le ile k$$$, during the $$$i$$$-th step the subsequence of t...
3,000
false
false
false
false
false
false
true
false
true
false
2,878
617D
Problem - 617D - 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,700
false
false
true
false
false
true
false
false
false
false
7,366
255C
Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements can be represented as: _a_1u2009=u2009_p_, where _p_ is some integer; _a__i_u2009=u2009_a__i_u2009-u20091u2009+u200...
1,500
false
false
false
true
false
false
true
false
false
false
8,812
1236E
Alice is playing a game with her good friend, Marisa. There are $$$n$$$ boxes arranged in a line, numbered with integers from $$$1$$$ to $$$n$$$ from left to right. Marisa will hide a doll in one of the boxes. Then Alice will have $$$m$$$ chances to guess where the doll is. If Alice will correctly guess the number of b...
2,500
false
false
false
true
true
false
false
true
false
false
4,514
1808E1
This is the easy version of the problem. The only difference between the three versions is the constraints on $$$n$$$ and $$$k$$$. You can make hacks only if all versions of the problem are solved. Maxim is a minibus driver on Venus. To ride on Maxim's minibus, you need a ticket. Each ticket has a number consisting of ...
2,200
false
false
false
true
false
false
false
false
false
false
1,423
1826A
There is a group of $$$n$$$ people. Some of them might be liars, who always tell lies. Other people always tell the truth. The $$$i$$$-th person says "There are at least $$$l_i$$$ liars amongst us". Determine if what people are saying is contradictory, or if it is possible. If it is possible, output the number of liars...
1,200
false
true
true
false
false
false
true
false
true
false
1,329
586A
Alena has successfully passed the entrance exams to the university and is now looking forward to start studying. One two-hour lesson at the Russian university is traditionally called a pair, it lasts for two academic hours (an academic hour is equal to 45 minutes). The University works in such a way that every day it h...
900
false
false
true
false
false
false
false
false
false
false
7,499
1523E
To monitor cryptocurrency exchange rates trader William invented a wonderful device consisting of $$$n$$$ lights arranged in a row. The device functions in the following way: Initially, all lights on William's device are turned off. At the beginning of a new iteration the device randomly, with a uniform distribution, p...
2,600
true
false
false
true
false
false
false
false
false
false
3,046
2009A
Problem - 2009A - 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
true
false
false
false
200
1845C
Monocarp finally got the courage to register on ForceCoders. He came up with a handle but is still thinking about the password. He wants his password to be as strong as possible, so he came up with the following criteria: the length of the password should be exactly $$$m$$$; the password should only consist of digits...
1,400
false
true
false
true
false
false
false
true
false
false
1,212
127B
Problem - 127B - 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
false
false
true
false
false
false
false
false
false
false
9,371
57C
Problem - 57C - Codeforces =============== xa0 . Output You must print the answer on a single line. As it can be rather long, you should print it modulo 1000000007. Examples Input 2 Output 4 Input 3 Output 17
1,900
true
false
false
false
false
false
false
false
false
false
9,688
1685A
You are given $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$. Is it possible to arrange them on a circle so that each number is strictly greater than both its neighbors or strictly smaller than both its neighbors? In other words, check if there exists a rearrangement $$$b_1, b_2, ldots, b_n$$$ of the integers $$$a_1, a_2,...
1,100
false
true
false
false
false
true
false
false
true
false
2,165
196D
In problems on strings one often has to find a string with some particular properties. The problem authors were reluctant to waste time on thinking of a name for some string so they called it good. A string is good if it doesn't have palindrome substrings longer than or equal to _d_. You are given string _s_, consistin...
2,800
false
true
false
false
true
false
false
false
false
false
9,055
1320D
In this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a string. We denote the substring of string $$$s$$$ starting from the $$$l$$$-th character and ending with the $$$r$$$-th c...
2,500
false
false
false
false
true
false
false
false
false
false
4,112
2020A
You are given two integers $$$n$$$ and $$$k$$$. In one operation, you can subtract any power of $$$k$$$ from $$$n$$$. Formally, in one operation, you can replace $$$n$$$ by $$$(n-k^x)$$$ for any non-negative integer $$$x$$$. Find the minimum number of operations required to make $$$n$$$ equal to $$$0$$$. Input Each tes...
800
true
true
false
false
false
false
true
false
false
false
152
1252K
Adding two numbers several times is a time-consuming task, so you want to build a robot. The robot should have a string $$$S = S_1 S_2 dots S_N$$$ of $$$N$$$ characters on its memory that represents addition instructions. Each character of the string, $$$S_i$$$, is either 'A' or 'B'. You want to be able to give $$$Q$$$...
2,100
true
false
false
false
true
false
false
false
false
false
4,424
1086F
Berland forest was planted several decades ago in a formation of an infinite grid with a single tree in every cell. Now the trees are grown up and they form a pretty dense structure. So dense, actually, that the fire became a real danger for the forest. This season had been abnormally hot in Berland and some trees got ...
3,500
true
false
false
false
false
false
false
false
false
false
5,292
251D
Little Petya likes numbers a lot. Recently his mother has presented him a collection of _n_ non-negative integers. There's only one thing Petya likes more than numbers: playing with little Masha. He immediately decided to give a part of his new collection to her. To make the game even more interesting, Petya decided to...
2,700
true
false
false
false
false
false
false
false
false
false
8,828
1419F
There are $$$n$$$ detachments on the surface, numbered from $$$1$$$ to $$$n$$$, the $$$i$$$-th detachment is placed in a point with coordinates $$$(x_i, y_i)$$$. All detachments are placed in different points. Brimstone should visit each detachment at least once. You can choose the detachment where Brimstone starts. To...
2,800
false
false
true
false
true
false
false
true
false
true
3,581
1105E
Hiasat registered a new account in NeckoForces and when his friends found out about that, each one of them asked to use his name as Hiasat's handle. Luckily for Hiasat, he can change his handle in some points in time. Also he knows the exact moments friends will visit his profile page. Formally, you are given a sequenc...
2,200
false
false
false
true
false
false
true
false
false
false
5,176
1520F1
This is an interactive problem. This is an easy version of the problem. The difference from the hard version is that in the easy version $$$t=1$$$ and the number of queries is limited to $$$20$$$. Polycarp is playing a computer game. In this game, an array consisting of zeros and ones is hidden. Polycarp wins if he gue...
1,600
false
false
false
false
false
false
false
true
false
false
3,058
1335B
You are given three positive integers $$$n$$$, $$$a$$$ and $$$b$$$. You have to construct a string $$$s$$$ of length $$$n$$$ consisting of lowercase Latin letters such that each substring of length $$$a$$$ has exactly $$$b$$$ distinct letters. It is guaranteed that the answer exists. You have to answer $$$t$$$ independ...
900
false
false
false
false
false
true
false
false
false
false
4,029
1799G
There are $$$n$$$ people that will participate in voting. Each person has exactly one vote. $$$i$$$-th person has a team $$$t_i$$$ ($$$1 leq t_i leq n$$$) where $$$t_i = t_j$$$ means $$$i$$$, $$$j$$$ are in the same team. By the rules each person should vote for the person from the different team. Note that it automati...
2,600
true
false
false
true
false
false
false
false
false
false
1,477
825B
Alice and Bob play 5-in-a-row game. They have a playing field of size 10u2009Γ—u200910. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts. In current match they have made some turns and now it's Alice's turn. She wonders if she can put cross in such empty cell that she w...
1,600
false
false
true
false
false
false
true
false
false
false
6,461
1481F
Kilani and Abd are neighbors for 3000 years, but then the day came and Kilani decided to move to another house. As a farewell gift, Kilani is going to challenge Abd with a problem written by their other neighbor with the same name Abd. The problem is: You are given a connected tree rooted at node $$$1$$$. You should as...
3,100
false
true
false
true
false
false
false
false
false
false
3,268
57D
Stewie the Rabbit explores a new parallel universe. This two dimensional universe has the shape of a rectangular grid, containing _n_ lines and _m_ columns. The universe is very small: one cell of the grid can only contain one particle. Each particle in this universe is either static or dynamic. Each static particle al...
2,500
true
false
false
true
false
false
false
false
false
false
9,687
887A
Problem - 887A - 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
false
false
true
false
false
false
false
false
false
false
6,202
1365F
# Swaps Again Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Ayush, Ashish and Vivek are busy preparing a new problem for the next Codeforces round and need help checking if their test cases are valid. Each test case consists of an integer n and two arrays a...
2,100
false
false
true
false
false
true
false
false
true
false
3,852
113D
One day as Petya and his friend Vasya were having one of their numerous trips, they decided to visit a museum castle. The museum has a specific shape: it consists of _n_ rooms connected with _m_ corridors so that one can access any room from any other one. After the two friends had a little walk around the museum, they...
2,700
true
false
false
false
false
false
false
false
false
false
9,432
1103C
Today is tuesday, that means there is a dispute in JOHNNY SOLVING team again: they try to understand who is Johnny and who is Solving. That's why guys asked Umnik to help them. Umnik gave guys a connected graph with $$$n$$$ vertices without loops and multiedges, such that a degree of any vertex is at least $$$3$$$, and...
2,700
true
false
false
false
false
true
false
false
false
true
5,185
258C
Problem - 258C - 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
true
false
false
false
true
false
false
8,800
1490B
You are given a number $$$n$$$ (divisible by $$$3$$$) and an array $$$a[1 dots n]$$$. In one move, you can increase any of the array elements by one. Formally, you choose the index $$$i$$$ ($$$1 le i le n$$$) and replace $$$a_i$$$ with $$$a_i + 1$$$. You can choose the same index $$$i$$$ multiple times for different mo...
1,000
true
false
false
false
false
true
true
false
false
false
3,228
1500A
It was the third month of remote learning, Nastya got sick of staying at dormitory, so she decided to return to her hometown. In order to make her trip more entertaining, one of Nastya's friend presented her an integer array $$$a$$$. Several hours after starting her journey home Nastya remembered about the present. To ...
1,800
true
false
true
false
false
false
true
false
false
false
3,168
155A
Vasya adores sport programming. He can't write programs but he loves to watch the contests' progress. Vasya even has a favorite coder and Vasya pays special attention to him. One day Vasya decided to collect the results of all contests where his favorite coder participated and track the progress of his coolness. For ea...
800
false
false
false
false
false
false
true
false
false
false
9,254
1744F
You are given a permutation $$$p_1, p_2, ldots, p_n$$$ of length $$$n$$$ of numbers $$$0, ldots, n - 1$$$. Count the number of subsegments $$$1 leq l leq r leq n$$$ of this permutation such that $$$mex(p_l, p_{l+1}, ldots, p_r) > med(p_l, p_{l+1}, ldots, p_r)$$$. $$$mex$$$ of $$$S$$$ is the smallest non-negative intege...
2,000
true
false
false
false
false
false
false
false
false
false
1,811
1505A
Problem - 1505A - Codeforces =============== xa0
900
false
false
true
false
false
false
false
false
false
false
3,152
1970E3
Harry Potter is hiking in the Alps surrounding Lake Geneva. In this area there are $$$m$$$ cabins, numbered 1 to $$$m$$$. Each cabin is connected, with one or more trails, to a central meeting point next to the lake. Each trail is either short or long. Cabin $$$i$$$ is connected with $$$s_i$$$ short trails and $$$l_i$$...
2,200
false
false
false
true
false
false
false
false
false
false
472
566F
As you must know, the maximum clique problem in an arbitrary graph is _NP_-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively. Just in case, let us remind you that a clique in a non-directed graph is a subset of the vertices of a graph, such that any two vertices of this subset are conne...
1,500
true
false
false
true
false
false
false
false
false
false
7,586
776C
Molly Hooper has _n_ different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The _i_-th of them has affection value _a__i_. Molly wants Sherlock to fall in love with her. She intends to do this by mixing a contiguous segment of chemicals together to make a love potion with total a...
1,800
true
false
true
false
true
false
true
true
false
false
6,666
845A
Berland annual chess tournament is coming! Organizers have gathered 2Β·_n_ chess players who should be divided into two teams with _n_ people each. The first team is sponsored by BerOil and the second team is sponsored by BerMobile. Obviously, organizers should guarantee the win for the team of BerOil. Thus, organizers ...
1,100
false
false
true
false
false
false
false
false
true
false
6,384
715B
ZS the Coder has drawn an undirected graph of _n_ vertices numbered from 0 to _n_u2009-u20091 and _m_ edges between them. Each edge of the graph is weighted, each weight is a positive integer. The next day, ZS the Coder realized that some of the weights were erased! So he wants to reassign positive integer weight to ea...
2,300
false
false
false
false
false
true
false
true
false
true
6,958
1936B
There is a one-dimensional grid of length $$$n$$$. The $$$i$$$-th cell of the grid contains a character $$$s_i$$$, which is either '<' or '>'. When a pinball is placed on one of the cells, it moves according to the following rules: If the pinball is on the $$$i$$$-th cell and $$$s_i$$$ is '<', the pinball moves one ce...
2,000
true
false
true
false
true
false
false
true
false
false
667
1217A
You play your favourite game yet another time. You chose the character you didn't play before. It has $$$str$$$ points of strength and $$$int$$$ points of intelligence. Also, at start, the character has $$$exp$$$ free experience points you can invest either in strength or in intelligence (by investing one point you can...
1,300
true
false
false
false
false
false
false
true
false
false
4,590
1098A
Mitya has a rooted tree with $$$n$$$ vertices indexed from $$$1$$$ to $$$n$$$, where the root has index $$$1$$$. Each vertex $$$v$$$ initially had an integer number $$$a_v ge 0$$$ written on it. For every vertex $$$v$$$ Mitya has computed $$$s_v$$$: the sum of all values written on the vertices on the path from vertex ...
1,600
false
true
false
false
false
true
false
false
false
false
5,216
1930F
For an array $$$b$$$ of $$$m$$$ non-negative integers, define $$$f(b)$$$ as the maximum value of $$$maxlimits_{i = 1}^{m} (b_i x) - minlimits_{i = 1}^{m} (b_i x)$$$ over all possible non-negative integers $$$x$$$, where $$$$$$ is $$$. It is guaranteed that $$$0 leq v < n$$$. The queries are given in a modified way. I...
2,700
false
false
false
false
false
false
true
false
false
false
705
427E
Imagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the _x_-axis. Currently, there are _n_ criminals along the road. No police station has been built on this road yet, so the mayor wants to build one. As you are going to be in charge of this new ...
2,000
true
true
true
false
false
false
false
false
false
false
8,127
1681E
You found a map of a weirdly shaped labyrinth. The map is a grid, consisting of $$$n$$$ rows and $$$n$$$ columns. The rows of the grid are numbered from $$$1$$$ to $$$n$$$ from bottom to top. The columns of the grid are numbered from $$$1$$$ to $$$n$$$ from left to right. The labyrinth has $$$n$$$ layers. The first lay...
2,600
false
false
false
true
true
false
false
false
false
false
2,181
1269B
You are given a positive integer $$$m$$$ and two integer sequence: $$$a=[a_1, a_2, ldots, a_n]$$$ and $$$b=[b_1, b_2, ldots, b_n]$$$. Both of these sequence have a length $$$n$$$. Permutation is a sequence of $$$n$$$ different positive integers from $$$1$$$ to $$$n$$$. For example, these sequences are permutations: $$$...
1,500
false
false
false
false
false
false
true
false
true
false
4,345
243E
Problem - 243E - 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...
3,000
false
false
false
false
true
false
false
false
false
false
8,859
323A
Problem - 323A - Codeforces =============== xa0 , so that the following conditions must be satisfied: each white cube has exactly 2 neighbouring cubes of white color; each black cube has exactly 2 neighbouring cubes of black color. Input The first line contains integer _k_ (1u2009≀u2009_k_u2009≀u2009100), w...
1,600
false
false
false
false
false
true
false
false
false
false
8,544
1764E
Doremy has two arrays $$$a$$$ and $$$b$$$ of $$$n$$$ integers each, and an integer $$$k$$$. Initially, she has a number line where no integers are colored. She chooses a permutation $$$p$$$ of $$$[1,2,ldots,n]$$$ then performs $$$n$$$ moves. On the $$$i$$$-th move she does the following: Pick an uncolored integer $$$x...
2,400
false
true
false
true
false
false
false
false
true
false
1,723
1133D
Problem - 1133D - 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,500
true
false
false
false
false
false
false
false
false
false
5,051
932B
Problem - 932B - 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,300
false
false
false
false
true
false
false
true
false
false
5,977
514A
Problem - 514A - 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
7,780
464A
Problem - 464A - 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,700
false
true
false
false
false
false
false
false
false
false
7,984
858E
The All-Berland National Olympiad in Informatics has just ended! Now Vladimir wants to upload the contest from the Olympiad as a gym to a popular Codehorses website. Unfortunately, the archive with Olympiad's data is a mess. For example, the files with tests are named arbitrary without any logic. Vladimir wants to rena...
2,200
false
true
true
false
false
false
false
false
false
false
6,310
500F
Dohyun is running a grocery store. He sells _n_ items numbered by integers from 1 to _n_. The _i_-th (1u2009≀u2009_i_u2009≀u2009_n_) of them costs _c__i_ dollars, and if I buy it, my happiness increases by _h__i_. Each item can be displayed only for _p_ units of time because of freshness. As Dohyun displays the _i_-th ...
2,700
false
false
false
true
false
false
false
false
false
false
7,832
1680D
You are walking with your dog, and now you are at the promenade. The promenade can be represented as an infinite line. Initially, you are in the point $$$0$$$ with your dog. You decided to give some freedom to your dog, so you untied her and let her run for a while. Also, you watched what your dog is doing, so you have...
2,400
true
true
false
false
false
false
true
false
false
false
2,188
533C
Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move in turns, Polycarp starts. In each turn Polycarp can move his pawn from cell (_x_,u2009_y_) to (_x_u2009-u20091,u2009_y_) or (_x_,u2009_y_u2009-u20091). Vasiliy can mov...
1,700
true
true
true
false
false
false
false
false
false
false
7,705
2037B
To help you prepare for your upcoming Codeforces contest, Citlali set a grid problem and is trying to give you a $$$n$$$ by $$$m$$$ grid through your input stream. Specifically, your input stream should contain the following: The first line contains two integers $$$n$$$ and $$$m$$$ β€” the dimensions of the grid. The f...
800
false
false
true
false
false
false
true
false
false
false
44
937A
The recent All-Berland Olympiad in Informatics featured _n_ participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine the set of participants to be awarded with diplomas with respect to the following criteria: At least one participant should get a diploma...
800
false
false
true
false
false
false
false
false
true
false
5,953
1679B
Once upon a time Mike and Mike decided to come up with an outstanding problem for some stage of ROI (rare olympiad in informatics). One of them came up with a problem prototype but another stole the idea and proposed that problem for another stage of the same olympiad. Since then the first Mike has been waiting for an ...
1,200
false
false
true
false
true
false
false
false
false
false
2,196
1299D
Guy-Manuel and Thomas are planning $$$144$$$ trips around the world. You are given a simple weighted undirected connected graph with $$$n$$$ vertexes and $$$m$$$ edges with the following restriction: there isn't any simple cycle (i. e. a cycle which doesn't pass through any vertex more than once) of length greater than...
3,000
true
false
false
true
false
false
false
false
false
true
4,198
1665E
You are given an array $$$a$$$ of $$$n$$$ non-negative integers, numbered from $$$1$$$ to $$$n$$$. Let's define the cost of the array $$$a$$$ as $$$displaystyle min_{i eq j} a_i a_j$$$, where $$$$$$ denotes the . For each query you should find the cost of the subarray $$$a_{l}, a_{l + 1}, ldots, a_{r}$$$. Input Each ...
2,500
false
true
true
false
true
false
true
false
false
false
2,286
466A
Problem - 466A - 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
false
false
false
false
false
7,977
163E
The best programmers of Embezzland compete to develop a part of the project called "e-Government" β€” the system of automated statistic collecting and press analysis. We know that any of the _k_ citizens can become a member of the Embezzland government. The citizens' surnames are _a_1,u2009_a_2,u2009...,u2009_a__k_. All ...
2,800
false
false
false
true
true
false
false
false
false
false
9,211