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
492A
Problem - 492A - 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,868
626G
Johnny is at a carnival which has _n_ raffles. Raffle _i_ has a prize with value _p__i_. Each participant can put tickets in whichever raffles they choose (they may have more than one ticket in a single raffle). At the end of the carnival, one ticket is selected at random from each raffle, and the owner of the ticket w...
3,100
true
true
false
true
true
false
false
false
false
false
7,322
1431B
Polycarp has just finished writing down the lecture on elvish languages. The language this week was "VwV" (pronounced as "uwu"). The writing system of this language consists of only two lowercase Latin letters: 'v' and 'w'. Unfortunately, Polycarp has written all the lecture in cursive and without any spaces, so the no...
1,400
false
false
true
false
false
false
false
false
false
false
3,508
1428G1
This is the easy version of the problem. The only difference is that in this version $$$q=1$$$. You can make hacks only if all versions of the problem are solved. Zookeeper has been teaching his $$$q$$$ sheep how to write and how to add. The $$$i$$$-th sheep has to write exactly $$$k$$$ non-negative integers with the s...
2,900
false
true
false
true
false
false
false
false
false
false
3,519
581D
Three companies decided to order a billboard with pictures of their logos. A billboard is a big square board. A logo of each company is a rectangle of a non-zero area. Advertisers will put up the ad only if it is possible to place all three logos on the billboard so that they do not overlap and the billboard has no emp...
1,700
true
false
true
false
false
true
true
false
false
false
7,520
490F
The "Road Accident" band is planning an unprecedented tour around Treeland. The RA fans are looking forward to the event and making bets on how many concerts their favorite group will have. Treeland consists of _n_ cities, some pairs of cities are connected by bidirectional roads. Overall the country has _n_u2009-u2009...
2,200
false
false
false
true
true
false
false
false
false
false
7,872
1988F
Problem - 1988F - 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 - ...
3,000
true
false
false
true
false
false
false
false
false
false
342
839E
There are _n_ castles in the Lannister's Kingdom and some walls connect two castles, no two castles are connected by more than one wall, no wall connects a castle to itself. Sir Jaime Lannister has discovered that Daenerys Targaryen is going to attack his kingdom soon. Therefore he wants to defend his kingdom. He has _...
2,700
true
false
false
false
false
false
true
false
false
true
6,404
1603A
YouKn0wWho has an integer sequence $$$a_1, a_2, ldots, a_n$$$. He will perform the following operation until the sequence becomes empty: select an index $$$i$$$ such that $$$1 le i le a$$$ and $$$a_i$$$ is not divisible by $$$(i + 1)$$$, and erase this element from the sequence. Here $$$a$$$ is the length of sequence $...
1,300
true
false
false
false
false
true
false
false
false
false
2,643
61C
It's now 260 AD. Shapur, being extremely smart, became the King of Persia. He is now called Shapur, His majesty King of kings of Iran and Aniran. Recently the Romans declared war on Persia. They dreamed to occupy Armenia. In the recent war, the Romans were badly defeated. Now their senior army general, Philip is captur...
2,000
true
false
false
false
false
false
false
false
false
false
9,668
785D
As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (characters "(" and ")" (without quotes)). On the last lesson Anton learned about the regular simple bracket se...
2,300
true
false
false
true
false
false
false
false
false
false
6,630
820B
On one quiet day all of sudden Mister B decided to draw angle _a_ on his field. Aliens have already visited his field and left many different geometric figures on it. One of the figures is regular convex _n_-gon (regular convex polygon with _n_ sides). That's why Mister B decided to use this polygon. Now Mister B must ...
1,300
true
false
false
false
false
true
false
false
false
false
6,474
66D
Little Petya has a birthday soon. Due this wonderful event, Petya's friends decided to give him sweets. The total number of Petya's friends equals to _n_. Let us remind you the definition of the greatest common divisor: _GCD_(_a_1,u2009...,u2009_a__k_)u2009=u2009_d_, where _d_ represents such a maximal positive number ...
1,700
true
false
false
false
false
true
false
false
false
false
9,638
1190E
Tokitsukaze and her friends are trying to infiltrate a secret base built by Claris. However, Claris has been aware of that and set a bomb which is going to explode in a minute. Although they try to escape, they have no place to go after they find that the door has been locked. At this very moment, CJB, Father of Tokits...
3,100
false
true
false
false
false
false
false
true
false
false
4,746
1902A
You are given a string $$$s$$$, consisting only of characters '0' and/or '1'. In one operation, you choose a position $$$i$$$ from $$$1$$$ to $$$s - 1$$$, where $$$s$$$ is the current length of string $$$s$$$. Then you insert a character between the $$$i$$$-th and the $$$(i+1)$$$-st characters of $$$s$$$. If $$$s_i = s...
800
false
false
false
false
false
true
false
false
false
false
903
1479B1
The only difference between the two versions is that this version asks the maximal possible answer. Homer likes arrays a lot. Today he is painting an array $$$a_1, a_2, dots, a_n$$$ with two kinds of colors, white and black. A painting assignment for $$$a_1, a_2, dots, a_n$$$ is described by an array $$$b_1, b_2, dots,...
1,900
false
true
true
true
true
true
false
false
false
false
3,280
405E
Little Chris is participating in a graph cutting contest. He's a pro. The time has come to test his skills to the fullest. Chris is given a simple undirected connected graph with _n_ vertices (numbered from 1 to _n_) and _m_ edges. The problem is to cut it into edge-distinct paths of length 2. Formally, Chris has to pa...
2,300
false
false
false
false
false
false
false
false
false
true
8,201
1398F
Alice and Bob play a game. The game consists of several sets, and each set consists of several rounds. Each round is won either by Alice or by Bob, and the set ends when one of the players has won $$$x$$$ rounds in a row. For example, if Bob won five rounds in a row and $$$x = 2$$$, then two sets ends. You know that Al...
2,500
false
true
false
true
true
false
false
true
false
false
3,681
989A
When the curtains are opened, a canvas unfolds outside. Kanno marvels at all the blonde colours along the riversidexa0— not tangerines, but blossoms instead."What a pity it's already late spring," sighs Mino with regret, "one more drizzling night and they'd be gone." "But these blends are at their best, aren't they?" A...
900
false
false
true
false
false
false
false
false
false
false
5,757
1726G
There are $$$n$$$ people at a party. The $$$i$$$-th person has an amount of happiness $$$a_i$$$. Every person has a certain kind of personality which can be represented as a binary integer $$$b$$$. If $$$b = 0$$$, it means the happiness of the person will increase if he tells the story to someone strictly less happy th...
3,300
false
true
false
false
true
false
false
false
true
false
1,927
363D
A group of _n_ schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them. The renting site offered them _m_ bikes. The renting price is different for different bikes, renting the _j_-th bike costs _p__j_ rubles. In total, the boys' shared budget is _a_ rubles. Besides, each of them has ...
1,800
false
true
false
false
false
false
false
true
false
false
8,379
2035D
Three r there are's in strawberry. You are given an array $$$b$$$ of length $$$m$$$. You can perform the following operation any number of times (possibly zero): Choose two distinct indices $$$i$$$ and $$$j$$$ where $$$bf{1le i < jle m}$$$ and $$$b_i$$$ is even, divide $$$b_i$$$ by $$$2$$$ and multiply $$$b_j$$$ by $$...
1,800
true
true
true
false
true
false
false
true
false
false
58
756F
Consider the following grammar: <expression> ::= <term> <expression> '+' <term> <term> ::= <number> <number> '-' <number> <number> '(' <expression> ')' <number> ::= <pos_digit> <number> <digit> <digit> ::= '0' <pos_digit> <pos_digit> ::= '1' '2' '3' '4' '5' '6' '7' '8' '9' This grammar describes a num...
3,400
true
false
false
false
false
false
false
false
false
false
6,765
1267G
Esports is a form of competitive sports using video games. Dotaxa02 is one of the most popular competitive video games in Esports. Recently, a new video game Dotaxa03 was released. In Dotaxa03 a player can buy some relics for their hero. Relics are counters that track hero's actions and statistics in a game. Gloria lik...
3,000
true
false
false
false
false
false
false
false
false
false
4,357
1400C
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $$$w$$$ of length $$$n$$$ and an integer $$$x$$$. You build a new binary string $$$s$$$ consisting of $$$n$$$ characters. The $$$i$$$-th character of $$$s$$$ is chosen as follows: if the character $$$w_{i-x}$$$ ex...
1,500
false
true
false
false
false
true
true
false
false
false
3,670
737F
After one of celebrations there is a stack of dirty plates in Nikita's kitchen. Nikita has to wash them and put into a dryer. In dryer, the plates should be also placed in a stack also, and the plates sizes should increase down up. The sizes of all plates are distinct. Nikita has no so much free space, specifically, he...
3,300
true
false
false
false
false
true
false
false
false
false
6,844
1713A
You are living on an infinite plane with the Cartesian coordinate system on it. In one move you can go to any of the four adjacent points (left, right, up, down). More formally, if you are standing at the point $$$(x, y)$$$, you can: go left, and move to $$$(x - 1, y)$$$, or go right, and move to $$$(x + 1, y)$$$, or...
800
false
true
true
false
false
false
false
false
false
false
2,006
1783F
You are given two permutations $$$a$$$ and $$$b$$$, both of size $$$n$$$. A permutation of size $$$n$$$ is an array of $$$n$$$ elements, where each integer from $$$1$$$ to $$$n$$$ appears exactly once. The elements in each permutation are indexed from $$$1$$$ to $$$n$$$. You can perform the following operation any numb...
2,500
false
false
false
false
false
false
false
false
false
true
1,574
1090D
Vasya had an array of $$$n$$$ integers, each element of the array was from $$$1$$$ to $$$n$$$. He chose $$$m$$$ pairs of different positions and wrote them down to a sheet of paper. Then Vasya compared the elements at these positions, and wrote down the results of the comparisons to another sheet of paper. For each pai...
1,800
false
false
false
false
false
true
false
false
false
false
5,269
1085A
Polycarp loves ciphers. He has invented his own cipher called Right-Left. Right-Left cipher is used for strings. To encrypt the string $$$s=s_{1}s_{2} dots s_{n}$$$ Polycarp uses the following algorithm: he writes down $$$s_1$$$, he appends the current word with $$$s_2$$$ (i.e. writes down $$$s_2$$$ to the right of t...
800
false
false
true
false
false
false
false
false
false
false
5,299
319A
Problem - 319A - 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,600
true
false
false
false
false
false
false
false
false
false
8,558
258A
Problem - 258A - 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,100
true
true
false
false
false
false
false
false
false
false
8,802
1249C2
The only difference between easy and hard versions is the maximum value of $$$n$$$. You are given a positive integer number $$$n$$$. You really love good numbers so you want to find the smallest good number greater than or equal to $$$n$$$. The positive integer is called good if it can be represented as a sum of distin...
1,500
true
true
false
false
false
false
false
true
false
false
4,460
535A
Problem - 535A - 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
true
false
false
false
7,695
1425B
It's our faculty's 34th anniversary! To celebrate this great event, the Faculty of Computer Science, University of Indonesia (Fasilkom), held CPC - Coloring Pavements Competition. The gist of CPC is two players color the predetermined routes of Fasilkom in Blue and Red. There are $$$N$$$ Checkpoints and $$$M$$$ undirec...
2,600
false
false
false
true
false
false
false
false
false
false
3,546
805A
Problem - 805A - 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
6,539
318B
Volodya likes listening to heavy metal and (occasionally) reading. No wonder Volodya is especially interested in texts concerning his favourite music style. Volodya calls a string powerful if it starts with "heavy" and ends with "metal". Finding all powerful substrings (by substring Volodya means a subsequence of conse...
1,300
false
false
true
false
false
false
false
false
false
false
8,559
1077F1
The only difference between easy and hard versions is the constraints. Vova likes pictures with kittens. The news feed in the social network he uses can be represented as an array of $$$n$$$ consecutive pictures (with kittens, of course). Vova likes all these pictures, but some are more beautiful than the others: the $...
1,900
false
false
false
true
false
false
false
false
false
false
5,332
1877A
There are $$$n$$$ teams in a football tournament. Each pair of teams match up once. After every match, Pak Chanek receives two integers as the result of the match, the number of goals the two teams score during the match. The efficiency of a team is equal to the total number of goals the team scores in each of its matc...
800
true
false
false
false
false
false
false
false
false
false
1,019
858D
There are _n_ phone numbers in Polycarp's contacts on his phone. Each number is a 9-digit integer, starting with a digit different from 0. All the numbers are distinct. There is the latest version of Berdroid OS installed on Polycarp's phone. If some number is entered, is shows up all the numbers in the contacts for wh...
1,600
false
false
true
false
true
false
false
false
true
false
6,311
1433A
There is a building consisting of $$$10~000$$$ apartments numbered from $$$1$$$ to $$$10~000$$$, inclusive. Call an apartment boring, if its number consists of the same digit. Examples of boring apartments are $$$11, 2, 777, 9999$$$ and so on. Our character is a troublemaker, and he calls the intercoms of all boring ap...
800
true
false
true
false
false
false
false
false
false
false
3,499
1667F
You are given a rectangular grid with $$$n$$$ rows and $$$m$$$ columns. $$$n$$$ and $$$m$$$ are divisible by $$$4$$$. Some of the cells are already colored black or white. It is guaranteed that no two colored cells share a corner or an edge. Color the remaining cells in a way that both the black and the white cells bec...
3,500
false
false
true
false
false
false
false
false
false
false
2,268
36B
Ever since Kalevitch, a famous Berland abstractionist, heard of fractals, he made them the main topic of his canvases. Every morning the artist takes a piece of graph paper and starts with making a model of his future canvas. He takes a square as big as _n_u2009×u2009_n_ squares and paints some of them black. Then he t...
1,600
false
false
true
false
false
false
false
false
false
false
9,817
1039A
There are two bus stops denoted A and B, and there $$$n$$$ buses that go from A to B every day. The shortest path from A to B takes $$$t$$$ units of time but some buses might take longer paths. Moreover, buses are allowed to overtake each other during the route. At each station one can find a sorted list of moments of ...
2,300
true
true
false
false
true
true
false
false
false
false
5,502
644B
In this problem you have to simulate the workflow of one-thread server. There are _n_ queries to process, the _i_-th will be received at moment _t__i_ and needs to be processed for _d__i_ units of time. All _t__i_ are guaranteed to be distinct. When a query appears server may react in three possible ways: 1. If server ...
1,700
false
false
false
false
true
true
false
false
false
false
7,236
187A
Happy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot. One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through _n_ and is asked to convert the first one to the second. In one move he can remove the last number from the per...
1,500
false
true
false
false
false
false
false
false
false
false
9,097
1485B
Given a positive integer $$$k$$$, two arrays are called $$$k$$$-similar if: they are strictly increasing; they have the same length; all their elements are positive integers between $$$1$$$ and $$$k$$$ (inclusive); they differ in exactly one position. You are given an integer $$$k$$$, a strictly increasing array $$...
1,200
true
false
true
true
false
false
false
false
false
false
3,258
459A
Problem - 459A - 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
8,006
933B
In order to put away old things and welcome a fresh new year, a thorough cleaning of the house is a must. Little Tommy finds an old polynomial and cleaned it up by taking it modulo another. But now he regrets doing this... Given two integers _p_ and _k_, find a polynomial _f_(_x_) with non-negative integer coefficients...
2,000
true
false
false
false
false
false
false
false
false
false
5,970
625A
Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much more complicated. Kolya is hungry, so he went to the nearest milk shop. In 2084 you may buy kefir in a plast...
1,700
true
false
true
false
false
false
false
false
false
false
7,333
1912E
Problem - 1912E - 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,200
true
false
true
false
false
true
false
false
false
false
833
1684B
You are given three positive integers $$$a$$$, $$$b$$$, $$$c$$$ ($$$a < b < c$$$). You have to find three positive integers $$$x$$$, $$$y$$$, $$$z$$$ such that: $$$$$$x bmod y = a,$$$$$$ $$$$$$y bmod z = b,$$$$$$ $$$$$$z bmod x = c.$$$$$$ Here $$$p bmod q$$$ denotes the remainder from dividing $$$p$$$ by $$$q$$$. It is...
800
true
false
false
false
false
true
false
false
false
false
2,172
101A
Once when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of _n_ small Latin letters; the task was to learn the way the letters that the string contains are written. However, as Gerald is too lazy, he has no desire whatsoever to...
1,200
false
true
false
false
false
false
false
false
false
false
9,479
1392B
Being stuck at home, Ray became extremely bored. To pass time, he asks Lord Omkar to use his time bending power: Infinity Clock! However, Lord Omkar will only listen to mortals who can solve the following problem: You are given an array $$$a$$$ of $$$n$$$ integers. You are also given an integer $$$k$$$. Lord Omkar want...
800
true
false
true
false
false
false
false
false
false
false
3,715
466C
Problem - 466C - 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
false
true
true
false
true
true
false
false
7,975
1994F
Pelican Town represents $$$n$$$ houses connected by $$$m$$$ bidirectional roads. Some roads have NPCs standing on them. Farmer Buba needs to walk on each road with an NPC and talk to them. Help the farmer find a route satisfying the following properties: The route starts at some house, follows the roads, and ends at t...
2,500
false
false
false
false
false
true
false
false
false
true
300
1779H
Iron and Werewolf are participating in a chess Olympiad, so they want to practice team building. They gathered $$$n$$$ players, where $$$n$$$ is a power of $$$2$$$, and they will play sports. Iron and Werewolf are among those $$$n$$$ people. One of the sports is tug of war. For each $$$1leq i leq n$$$, the $$$i$$$-th p...
3,500
false
false
false
false
false
false
true
false
false
false
1,595
1167F
You are given an array $$$a_1, a_2, dots, a_n$$$. All $$$a_i$$$ are pairwise distinct. Let's define function $$$f(l, r)$$$ as follows: let's define array $$$b_1, b_2, dots, b_{r - l + 1}$$$, where $$$b_i = a_{l - 1 + i}$$$; sort array $$$b$$$ in increasing order; result of the function $$$f(l, r)$$$ is $$$sumlimits_...
2,300
true
false
false
false
true
false
false
false
true
false
4,878
123C
A two dimensional array is called a bracket array if each grid contains one of the two possible brackets — "(" or ")". A path through the two dimensional array cells is called monotonous if any two consecutive cells in the path are side-adjacent and each cell of the path is located below or to the right from the previo...
2,300
false
true
false
true
false
false
false
false
false
false
9,387
1627B
Rahul and Tina are looking forward to starting their new year at college. As they enter their new classroom, they observe the seats of students are arranged in a $$$n imes m$$$ grid. The seat in row $$$r$$$ and column $$$c$$$ is denoted by $$$(r, c)$$$, and the distance between two seats $$$(a,b)$$$ and $$$(c,d)$$$ is...
1,300
false
true
false
false
false
false
false
false
true
false
2,480
1552A
A string $$$s$$$ of length $$$n$$$, consisting of lowercase letters of the English alphabet, is given. You must choose some number $$$k$$$ between $$$0$$$ and $$$n$$$. Then, you select $$$k$$$ characters of $$$s$$$ and permute them however you want. In this process, the positions of the other $$$n-k$$$ characters remai...
800
false
false
false
false
false
false
false
false
true
false
2,884
1680F
You are given a simple connected undirected graph, consisting of $$$n$$$ vertices and $$$m$$$ edges. The vertices are numbered from $$$1$$$ to $$$n$$$. A vertex cover of a graph is a set of vertices such that each edge has at least one of its endpoints in the set. Let's call a lenient vertex cover such a vertex cover t...
2,600
false
false
false
false
false
false
false
false
false
true
2,186
1415B
There is a street with $$$n$$$ houses in a line, numbered from $$$1$$$ to $$$n$$$. The house $$$i$$$ is initially painted in color $$$c_i$$$. The street is considered beautiful if all houses are painted in the same color. Tom, the painter, is in charge of making the street beautiful. Tom's painting capacity is defined ...
1,100
false
true
false
false
false
false
true
false
false
false
3,607
1918E
This is an interactive problem! In the new round, there were $$$n$$$ tasks with difficulties from $$$1$$$ to $$$n$$$. The coordinator, who decided to have the first round with tasks in unsorted order of difficulty, rearranged the tasks, resulting in a permutation of difficulties from $$$1$$$ to $$$n$$$. After that, the...
2,200
false
false
true
false
false
true
false
false
true
false
784
1876C
Chaneka writes down an array $$$a$$$ of $$$n$$$ positive integer elements. Initially, all elements are not circled. In one operation, Chaneka can circle an element. It is possible to circle the same element more than once. After doing all operations, Chaneka makes a sequence $$$r$$$ consisting of all uncircled elements...
2,100
false
true
false
false
false
true
false
false
true
true
1,024
253C
Vasya is pressing the keys on the keyboard reluctantly, squeezing out his ideas on the classical epos depicted in Homer's Odysseus... How can he explain to his literature teacher that he isn't going to become a writer? In fact, he is going to become a programmer. So, he would take great pleasure in writing a program, b...
1,600
false
true
false
false
true
false
false
false
false
true
8,822
1605B
Ashish has a binary string $$$s$$$ of length $$$n$$$ that he wants to sort in non-decreasing order. He can perform the following operation: 1. Choose a subsequence of any length such that its elements are in non-increasing order. Formally, choose any $$$k$$$ such that $$$1 leq k leq n$$$ and any sequence of $$$k$$$ ind...
1,000
false
true
false
false
false
false
false
false
true
false
2,634
1644E
Consider a grid of size $$$n imes n$$$. The rows are numbered top to bottom from $$$1$$$ to $$$n$$$, the columns are numbered left to right from $$$1$$$ to $$$n$$$. The robot is positioned in a cell $$$(1, 1)$$$. It can perform two types of moves: Dxa0— move one cell down; Rxa0— move one cell right. The robot is not...
1,900
true
false
true
false
true
false
true
false
false
false
2,397
1868E
Tom is waiting for his results of Zhongkao examination. To ease the tense atmosphere, his friend, Daniel, decided to play a game with him. This game is called "Divide the Array". The game is about the array a consisting of n integers. Denote [l,r] as the subsegment consisting of integers al,al+1,…,ar. Tom will divide t...
3,500
false
true
false
true
false
true
false
false
false
false
1,063
1452G
Alice and Bob are playing a game. They have a tree consisting of $$$n$$$ vertices. Initially, Bob has $$$k$$$ chips, the $$$i$$$-th chip is located in the vertex $$$a_i$$$ (all these vertices are unique). Before the game starts, Alice will place a chip into one of the vertices of the tree. The game consists of turns. E...
2,700
false
true
false
false
true
false
false
false
false
false
3,415
1737G
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Dytechlab Cup 2022 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 see...
3,500
false
false
false
false
true
false
false
true
false
false
1,862
225D
Let us remind you the rules of a very popular game called "Snake" (or sometimes "Boa", "Python" or "Worm"). The game field is represented by an _n_u2009×u2009_m_ rectangular table. Some squares of the field are considered impassable (walls), all other squares of the fields are passable. You control a snake, the snake c...
2,200
false
false
true
false
false
false
false
false
false
true
8,937
1187C
Vasya has an array $$$a_1, a_2, dots, a_n$$$. You don't know this array, but he told you $$$m$$$ facts about this array. The $$$i$$$-th fact is a triple of numbers $$$t_i$$$, $$$l_i$$$ and $$$r_i$$$ ($$$0 le t_i le 1, 1 le l_i < r_i le n$$$) and it means: if $$$t_i=1$$$ then subbarray $$$a_{l_i}, a_{l_i + 1}, dots, a_...
1,800
false
true
true
false
false
true
false
false
false
false
4,764
630C
Problem - 630C - Codeforces =============== xa0 ]( "Experimental Educational Round: VolBIT Formulas Blitz") — the maximum length of a number that a door-plate can hold. Output Output one integer — the maximum number of offices, than can have unique lucky numbers not longer than _n_ digits. Exam...
1,100
true
false
false
false
false
false
false
false
false
false
7,302
936A
Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after _k_ minutes after turning on. During cooking, Julia goes to the kitchen every _d_ minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. Th...
1,700
true
false
true
false
false
false
false
true
false
false
5,958
1742E
Timur has a stairway with $$$n$$$ steps. The $$$i$$$-th step is $$$a_i$$$ meters higher than its predecessor. The first step is $$$a_1$$$ meters higher than the ground, and the ground starts at $$$0$$$ meters. The stairs for the first test case. Timur has $$$q$$$ questions, each denoted by an integer $$$k_1, dots, k_q...
1,200
true
true
false
false
false
false
false
true
false
false
1,827
1015E2
A star is a figure of the following type: an asterisk character '*' in the center of the figure and four rays (to the left, right, top, bottom) of the same positive length. The size of a star is the length of its rays. The size of a star must be a positive number (i.e. rays of length $$$0$$$ are not allowed). Let's con...
1,900
false
true
false
true
false
false
false
true
false
false
5,614
119A
Simon and Antisimon play a game. Initially each player receives one fixed positive integer that doesn't change throughout the game. Simon receives number _a_ and Antisimon receives number _b_. They also have a heap of _n_ stones. The players take turns to make a move and Simon starts. During a move a player should take...
800
false
false
true
false
false
false
false
false
false
false
9,411
1987A
Oh no, the ForceCodes servers are running out of memory! Luckily, you can help them out by uploading some of your RAM! You want to upload $$$n$$$ GBs of RAM. Every second, you will upload either $$$0$$$ or $$$1$$$ GB of RAM. However, there is a restriction on your network speed: in any $$$k$$$ consecutive seconds, you ...
800
true
true
false
false
false
false
false
false
false
false
357
1351C
Problem - 1351C - 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,400
false
false
true
false
true
false
false
false
false
false
3,953
1220F
Gardener Alex loves to grow trees. We remind that tree is a connected acyclic graph on $$$n$$$ vertices. Today he decided to grow a rooted binary tree. A binary tree is a tree where any vertex has no more than two sons. Luckily, Alex has a permutation of numbers from $$$1$$$ to $$$n$$$ which he was presented at his las...
2,700
false
false
false
false
true
false
false
true
false
false
4,568
1923D
There are $$$n$$$ slimes placed in a line. The slimes are numbered from $$$1$$$ to $$$n$$$ in order from left to right. The size of the $$$i$$$-th slime is $$$a_i$$$. Every second, the following happens: exactly one slime eats one of its neighbors and increases its size by the eaten neighbor's size. A slime can eat its...
1,800
false
true
false
false
true
true
false
true
false
false
749
1404C
Let $$$a_1, ldots, a_n$$$ be an array of $$$n$$$ positive integers. In one operation, you can choose an index $$$i$$$ such that $$$a_i = i$$$, and remove $$$a_i$$$ from the array (after the removal, the remaining parts are concatenated). The weight of $$$a$$$ is defined as the maximum number of elements you can remove....
2,300
false
true
false
false
true
true
false
true
false
false
3,651
1009G
Polycarp has just launched his new startup idea. The niche is pretty free and the key vector of development sounds really promising, so he easily found himself some investors ready to sponsor the company. However, he is yet to name the startup! Actually, Polycarp has already came up with the name but some improvement t...
2,400
false
true
false
false
false
false
false
false
false
true
5,636
1073C
Vasya has got a robot which is situated on an infinite Cartesian plane, initially in the cell $$$(0, 0)$$$. Robot can perform the following four kinds of operations: U — move from $$$(x, y)$$$ to $$$(x, y + 1)$$$; D — move from $$$(x, y)$$$ to $$$(x, y - 1)$$$; L — move from $$$(x, y)$$$ to $$$(x - 1, y)$$$; R — mo...
1,800
false
false
false
false
false
false
false
true
false
false
5,351
1873E
You love fish, that's why you have decided to build an aquarium. You have a piece of coral made of $$$n$$$ columns, the $$$i$$$-th of which is $$$a_i$$$ units tall. Afterwards, you will build a tank around the coral as follows: Pick an integer $$$h geq 1$$$xa0— the height of the tank. Build walls of height $$$h$$$ on ...
1,100
false
false
false
false
false
false
false
true
true
false
1,040
1472D
During their New Year holidays, Alice and Bob play the following game using an array $$$a$$$ of $$$n$$$ integers: Players take turns, Alice moves first. Each turn a player chooses any element and removes it from the array. If Alice chooses even value, then she adds it to her score. If the chosen value is odd, Alice'...
1,200
false
true
false
true
false
false
false
false
true
false
3,321
105E
You are given a straight half-line divided into segments of unit length, which we will call positions. The positions are numbered by positive integers that start with 1 from the end of half-line, i. e. 1, 2, 3 and so on. The distance between the positions is the absolute difference between the respective numbers. Lahar...
2,500
false
false
false
false
false
false
true
false
false
false
9,462
255B
Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string _s_, consisting of characters "x" and "y", and uses two following operations at runtime: 1. Find two consecutive characters in the string, such that the first of them equals "y", and the se...
1,200
false
false
true
false
false
false
false
false
false
false
8,813
1658C
Shinju loves permutations very much! Today, she has borrowed a permutation $$$p$$$ from Juju to play with. The $$$i$$$-th cyclic shift of a permutation $$$p$$$ is a transformation on the permutation such that $$$p = [p_1, p_2, ldots, p_n] $$$ will now become $$$ p = [p_{n-i+1}, ldots, p_n, p_1,p_2, ldots, p_{n-i}]$$$. ...
1,700
true
false
false
false
false
true
false
false
false
false
2,337
1552E
The numbers $$$1, , 2, , dots, , n cdot k$$$ are colored with $$$n$$$ colors. These colors are indexed by $$$1, , 2, , dots, , n$$$. For each $$$1 le i le n$$$, there are exactly $$$k$$$ numbers colored with color $$$i$$$. Let $$$[a, , b]$$$ denote the interval of integers between $$$a$$$ and $$$b$$$ inclusive, that is...
2,300
false
true
false
false
true
true
false
false
true
false
2,880
1110E
Grigory has $$$n$$$ magic stones, conveniently numbered from $$$1$$$ to $$$n$$$. The charge of the $$$i$$$-th stone is equal to $$$c_i$$$. Sometimes Grigory gets bored and selects some inner stone (that is, some stone with index $$$i$$$, where $$$2 le i le n - 1$$$), and after that synchronizes it with neighboring ston...
2,200
true
false
false
false
false
true
false
false
true
false
5,145
1036F
Problem - 1036F - 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,400
true
false
false
false
false
false
false
false
false
false
5,518
137B
Hey, it's homework time" — thought Polycarpus and of course he started with his favourite subject, IT. Polycarpus managed to solve all tasks but for the last one in 20 minutes. However, as he failed to solve the last task after some considerable time, the boy asked you to help him. The sequence of _n_ integers is calle...
1,000
false
true
false
false
false
false
false
false
false
false
9,329
90B
Problem - 90B - 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,100
false
false
true
false
false
false
false
false
false
false
9,523
733F
In one kingdom there are _n_ cities and _m_ two-way roads. Each road connects a pair of cities, and for each road we know the level of drivers dissatisfactionxa0— the value _w__i_. For each road we know the value _c__i_xa0— how many lamziks we should spend to reduce the level of dissatisfaction with this road by one. T...
2,200
false
false
false
false
true
false
false
false
false
true
6,859
992A
Problem - 992A - 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
true
false
5,739
815D
Karen just got home from the supermarket, and is getting ready to go to sleep. After taking a shower and changing into her pajamas, she looked at her shelf and saw an album. Curious, she opened it and saw a trading card collection. She recalled that she used to play with those cards as a child, and, although she is now...
2,800
false
false
false
false
true
false
false
true
false
false
6,497
1374B
You are given an integer $$$n$$$. In one move, you can either multiply $$$n$$$ by two or divide $$$n$$$ by $$$6$$$ (if it is divisible by $$$6$$$ without the remainder). Your task is to find the minimum number of moves needed to obtain $$$1$$$ from $$$n$$$ or determine if it's impossible to do that. You have to answer ...
900
true
false
false
false
false
false
false
false
false
false
3,793
1101G
You are given an array $$$a_1, a_2, dots, a_n$$$ of integer numbers. Your task is to divide the array into the maximum number of segments in such a way that: each element is contained in exactly one segment; each segment contains at least one element; there doesn't exist a non-empty subset of segments such that bitw...
2,300
true
false
false
false
false
false
false
false
false
false
5,194