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
1878D
You are given a string $$$s$$$ of length $$$n$$$, containing lowercase Latin letters. Next you will be given a positive integer $$$k$$$ and two arrays, $$$l$$$ and $$$r$$$ of length $$$k$$$. It is guaranteed that the following conditions hold for these 2 arrays: $$$l_1 = 1$$$; $$$r_k = n$$$; $$$l_i le r_i$$$, for ea...
1,600
false
true
false
false
true
false
false
false
false
false
1,014
1619A
Problem - 1619A - 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
2,535
1451E1
The only difference between the easy and hard versions is the constraints on the number of queries. This is an interactive problem. Ridbit has a hidden array $$$a$$$ of $$$n$$$ integers which he wants Ashish to guess. Note that $$$n$$$ is a power of two. Ashish is allowed to ask three different types of queries. They a...
2,000
true
false
false
false
false
true
false
false
false
false
3,424
1310E
Problem - 1310E - 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
false
false
false
false
false
false
4,145
117C
Problem - 117C - Codeforces =============== xa0 ") exists either an edge going from _u_ to _v_, or an edge from _v_ to _u_. You are given a tournament consisting of _n_ vertexes. Your task is to find there a cycle of length three. Input The first line contains an integer _n_ (1u2009≀u2009_n_u2009≀u200...
2,000
false
false
false
false
false
false
false
false
false
true
9,419
958D1
The Rebel fleet is on the run. It consists of _m_ ships currently gathered around a single planet. Just a few seconds ago, the vastly more powerful Empire fleet has appeared in the same solar system, and the Rebels will need to escape into hyperspace. In order to spread the fleet, the captain of each ship has independe...
1,400
true
false
false
false
false
false
false
false
false
false
5,885
156E
Mrs. Hudson hasn't made her famous pancakes for quite a while and finally she decided to make them again. She has learned _m_ new recipes recently and she can't wait to try them. Those recipes are based on _n_ special spices. Mrs. Hudson has these spices in the kitchen lying in jars numbered with integers from 0 to _n_...
3,000
false
false
false
true
false
false
true
false
false
false
9,248
1537F
You have a connected undirected graph made of $$$n$$$ nodes and $$$m$$$ edges. The $$$i$$$-th node has a value $$$v_i$$$ and a target value $$$t_i$$$. In an operation, you can choose an edge $$$(i, j)$$$ and add $$$k$$$ to both $$$v_i$$$ and $$$v_j$$$, where $$$k$$$ can be any integer. In particular, $$$k$$$ can be neg...
2,200
true
true
false
false
false
true
false
false
false
true
2,956
1878A
We define an integer to be the most common on a subsegment, if its number of occurrences on that subsegment is larger than the number of occurrences of any other integer in that subsegment. A subsegment of an array is a consecutive segment of elements in the array $$$a$$$. Given an array $$$a$$$ of size $$$n$$$, and an...
800
false
true
false
false
false
false
false
false
false
false
1,017
290B
Problem - 290B - Codeforces =============== xa0 , separated by a single space. Output Output a single integer. Examples Input 1 1 Output 0 Input 3 7 Output 0 Input 13 10 Output 1
1,500
false
false
true
false
false
false
false
false
false
false
8,676
1720D1
It is the easy version of the problem. The only difference is that in this version $$$a_i le 200$$$. You are given an array of $$$n$$$ integers $$$a_0, a_1, a_2, ldots a_{n - 1}$$$. Bryap wants to find the longest beautiful subsequence in the array. An array $$$b = xa0β€” the number of test cases. The description of the...
1,800
false
false
false
true
false
false
true
false
false
false
1,962
388D
Problem - 388D - 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,700
true
false
false
false
false
false
false
false
false
false
8,274
1256C
There is a river of width $$$n$$$. The left bank of the river is cell $$$0$$$ and the right bank is cell $$$n + 1$$$ (more formally, the river can be represented as a sequence of $$$n + 2$$$ cells numbered from $$$0$$$ to $$$n + 1$$$). There are also $$$m$$$ wooden platforms on a river, the $$$i$$$-th platform has leng...
1,700
false
true
false
false
false
false
false
false
false
false
4,405
482E
You have a root tree containing _n_ vertexes. Let's number the tree vertexes with integers from 1 to _n_. The tree root is in the vertex 1. Each vertex (except fot the tree root) _v_ has a direct ancestor _p__v_. Also each vertex _v_ has its integer value _s__v_. Your task is to perform following queries: P _v_ _u_ (_...
3,200
false
false
false
false
true
false
false
false
false
false
7,905
1443A
Today the kindergarten has a new group of $$$n$$$ kids who need to be seated at the dinner table. The chairs at the table are numbered from $$$1$$$ to $$$4n$$$. Two kids can't sit on the same chair. It is known that two kids who sit on chairs with numbers $$$a$$$ and $$$b$$$ ($$$a eq b$$$) will indulge if: 1. $$$gcd(a...
800
true
false
false
false
false
true
false
false
false
false
3,458
1555F
You have an undirected graph consisting of $$$n$$$ vertices with weighted edges. A simple cycle is a cycle of the graph without repeated vertices. Let the weight of the cycle be the xa0β€” the number of vertices and queries. Next $$$q$$$ lines contain queriesxa0β€” one per line. Each query contains three integers $$$u$$$, ...
2,700
false
false
false
false
true
false
false
false
false
true
2,856
919B
Problem - 919B - 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
false
false
true
true
false
false
true
true
false
false
6,055
1810E
There is an undirected graph with $$$n$$$ vertices and $$$m$$$ edges. Initially, for each vertex $$$i$$$, there is a monster with danger $$$a_{i}$$$ on that vertex. For a monster with danger $$$a_{i}$$$, you can defeat it if and only if you have defeated at least $$$a_{i}$$$ other monsters before. Now you want to defea...
2,100
false
true
false
false
true
false
true
false
false
true
1,409
26D
Problem - 26D - 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...
2,400
true
false
false
false
false
false
false
false
false
false
9,865
1110G
The tic-tac-toe game is starting on a tree of $$$n$$$ vertices. Some vertices are already colored in white while the remaining are uncolored. There are two playersxa0β€” white and black. The players make moves alternatively. The white player starts the game. In his turn, a player must select one uncolored vertex and pain...
3,100
false
false
false
false
false
true
false
false
false
false
5,143
653A
Limak is a little polar bear. He has _n_ balls, the _i_-th ball has size _t__i_. Limak wants to give one ball to each of his three friends. Giving gifts isn't easyxa0β€” there are two rules Limak must obey to make friends happy: No two friends can get balls of the same size. No two friends can get balls of sizes that d...
900
false
false
true
false
false
false
true
false
true
false
7,204
737E
Tanya is now five so all her friends gathered together to celebrate her birthday. There are _n_ children on the celebration, including Tanya. The celebration is close to its end, and the last planned attraction is gaming machines. There are _m_ machines in the hall, they are numbered 1 through _m_. Each of the children...
3,300
false
true
false
false
false
false
false
false
false
true
6,845
1395C
Boboniu likes bit operations. He wants to play a game with you. Boboniu gives you two sequences of non-negative integers $$$a_1,a_2,ldots,a_n$$$ and $$$b_1,b_2,ldots,b_m$$$. For each $$$i$$$ ($$$1le ile n$$$), you're asked to choose a $$$j$$$ ($$$1le jle m$$$) and let $$$c_i=a_i& b_j$$$, where $$$&$$$ denotes the . The...
1,600
false
true
false
true
false
false
true
false
false
false
3,694
1389D
You are given two lists of segments $$$[al_1, ar_1], [al_2, ar_2], dots, [al_n, ar_n]$$$ and $$$[bl_1, br_1], [bl_2, br_2], dots, [bl_n, br_n]$$$. Initially, all segments $$$[al_i, ar_i]$$$ are equal to $$$[l_1, r_1]$$$ and all segments $$$[bl_i, br_i]$$$ are equal to $$$[l_2, r_2]$$$. In one step, you can choose one s...
2,100
true
true
true
false
false
false
true
false
false
false
3,725
1606B
Berland State University has received a new update for the operating system. Initially it is installed only on the $$$1$$$-st computer. Update files should be copied to all $$$n$$$ computers. The computers are not connected to the internet, so the only way to transfer update files from one computer to another is to cop...
1,100
true
true
true
false
false
false
false
false
false
false
2,628
314C
Problem - 314C - 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
false
false
false
true
true
false
false
false
false
false
8,588
959E
Problem - 959E - 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
false
true
true
false
false
false
false
false
true
5,873
747B
The process of mammoth's genome decoding in Berland comes to its end! One of the few remaining tasks is to restore unrecognized nucleotides in a found chain _s_. Each nucleotide is coded with a capital letter of English alphabet: 'A', 'C', 'G' or 'T'. Unrecognized nucleotides are coded by a question mark '?'. Thus, _s_...
900
false
false
true
false
false
false
false
false
false
false
6,809
757D
The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon. The organizers of the camp gave the gym leaders a PokeBlock, a sequence of _n_ ingredients. Each ingredient can be of type 0 or 1. Now the organizers told the gym ...
2,200
false
false
false
true
false
false
false
false
false
false
6,761
30A
Problem - 30A - 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,400
true
false
false
false
false
false
true
false
false
false
9,848
1717C
Given an array of integer $$$a_1, a_2, ldots, a_n$$$. In one operation you can make $$$a_i := a_i + 1$$$ if $$$i < n$$$ and $$$a_i leq a_{i + 1}$$$, or $$$i = n$$$ and $$$a_i leq a_1$$$. You need to check whether the array $$$a_1, a_2, ldots, a_n$$$ can become equal to the array $$$b_1, b_2, ldots, b_n$$$ in some numbe...
1,300
false
true
false
false
false
false
false
false
false
false
1,979
482A
Problem - 482A - 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
false
false
false
true
false
false
false
false
7,909
157B
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall into several parts. Some parts were painted red and all the other were painted blue. Besides,...
1,000
false
false
false
false
false
false
false
false
true
false
9,246
1514A
Problem - 1514A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
false
false
false
false
false
false
false
false
false
3,096
1945H
In the evenings during the hike, Kirill and Anton decided to take out an array of integers $$$a$$$ of length $$$n$$$ from their backpack and play a game with it. The rules are as follows: 1. Kirill chooses from $$$2$$$ to $$$(n-2)$$$ numbers and encircles them in red. 2. Anton encircles all the remaining numbers in blu...
2,600
true
false
false
false
true
false
true
false
false
false
606
1790C
A sequence of $$$n$$$ numbers is called permutation if it contains all integers from $$$1$$$ to $$$n$$$ exactly once. For example, the sequences [$$$3, 1, 4, 2$$$], [$$$1$$$] and [$$$2,1$$$] are permutations, but [$$$1,2,1$$$], [$$$0,1$$$] and [$$$1,3,4$$$]xa0β€” are not. Kristina had a permutation $$$p$$$ of $$$n$$$ ele...
1,000
true
false
true
false
false
false
true
false
false
false
1,540
1090G
, # Problem A. Combostone Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 512 megabytes One big company is developing a computer game named β€œCombostone”, that should blast the market. The rules of the game are quite complicated, so implementation of the server engine, whic...
2,500
false
false
true
false
false
false
false
false
false
false
5,266
1036C
Problem - 1036C - 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,900
false
false
false
true
false
false
false
false
false
false
5,521
2A
The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a pla...
1,500
false
false
true
false
false
false
false
false
false
false
9,981
34A
Problem - 34A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - so...
800
false
false
true
false
false
false
false
false
false
false
9,828
221A
Problem - 221A - 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
false
true
false
false
false
false
false
false
false
8,954
1450H2
The only difference between the two versions of the problem is that there are no updates in the easy version. There are $$$n$$$ spools of thread placed on the rim of a circular table. The spools come in two types of thread: the first thread is black and the second thread is white. For any two spools of the same color, ...
3,300
true
false
true
false
false
false
false
false
false
false
3,429
49C
Problem - 49C - 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,700
true
false
false
false
false
true
false
false
false
false
9,727
1285F
Problem - 1285F - 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
false
false
false
false
true
false
false
4,262
582B
Problem - 582B - 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
false
false
false
true
false
true
false
false
false
false
7,516
1381D
There is an undirected tree of $$$n$$$ vertices, connected by $$$n-1$$$ bidirectional edges. There is also a snake stuck inside of this tree. Its head is at vertex $$$a$$$ and its tail is at vertex $$$b$$$. The snake's body occupies all vertices on the unique simple path between $$$a$$$ and $$$b$$$. The snake wants to ...
3,000
false
true
false
true
false
false
false
false
false
false
3,760
1143A
Three years have passes and nothing changed. It is still raining in London, and Mr. Black has to close all the doors in his home in order to not be flooded. Once, however, Mr. Black became so nervous that he opened one door, then another, then one more and so on until he opened all the doors in his house. There are exa...
800
false
false
true
false
false
false
false
false
false
false
5,008
1528F
To AmShZ, all arrays are equal, but some arrays are more-equal than others. Specifically, the arrays consisting of $$$n$$$ elements from $$$1$$$ to $$$n$$$ that can be turned into permutations of numbers from $$$1$$$ to $$$n$$$ by adding a non-negative integer to each element. Mashtali who wants to appear in every prob...
3,300
true
false
false
false
false
false
false
false
false
false
3,018
929C
Statement is not available on English language Π—Π°Π²Ρ‚Ρ€Π° Ρƒ Ρ…ΠΎΠΊΠΊΠ΅ΠΉΠ½ΠΎΠΉ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹, ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠΉ Ρ€ΡƒΠΊΠΎΠ²ΠΎΠ΄ΠΈΡ‚ Π•Π²Π³Π΅Π½ΠΈΠΉ, Π²Π°ΠΆΠ½Ρ‹ΠΉ ΠΌΠ°Ρ‚Ρ‡. Π•Π²Π³Π΅Π½ΠΈΡŽ Π½ΡƒΠΆΠ½ΠΎ Π²Ρ‹Π±Ρ€Π°Ρ‚ΡŒ ΡˆΠ΅ΡΡ‚ΡŒ ΠΈΠ³Ρ€ΠΎΠΊΠΎΠ², ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π²Ρ‹ΠΉΠ΄ΡƒΡ‚ Π½Π° Π»Π΅Π΄ Π² стартовом составС: ΠΎΠ΄ΠΈΠ½ Π²Ρ€Π°Ρ‚Π°Ρ€ΡŒ, Π΄Π²Π° Π·Π°Ρ‰ΠΈΡ‚Π½ΠΈΠΊΠ° ΠΈ Ρ‚Ρ€ΠΈ Π½Π°ΠΏΠ°Π΄Π°ΡŽΡ‰ΠΈΡ…. Π’Π°ΠΊ ΠΊΠ°ΠΊ это стартовый состав, ЕвгСния большС Π²ΠΎΠ»Π½ΡƒΠ΅Ρ‚, насколько красива Π±ΡƒΠ΄Π΅Ρ‚ ΠΊ...
1,700
true
false
false
false
false
false
false
false
false
false
5,988
1807G2
The only difference between the two versions is that in this version, the constraints are higher. Initially, array $$$a$$$ contains just the number $$$1$$$. You can perform several operations in order to change the array. In an operation, you can select some subsequence$$$^{dagger}$$$ of $$$a$$$ and add into $$$a$$$ an...
1,100
false
true
true
true
false
false
false
false
true
false
1,428
1440A
You are given four integers $$$n$$$, $$$c_0$$$, $$$c_1$$$ and $$$h$$$ and a binary string $$$s$$$ of length $$$n$$$. A binary string is a string consisting of characters $$$0$$$ and $$$1$$$. You can change any character of the string $$$s$$$ (the string should be still binary after the change). You should pay $$$h$$$ c...
800
true
false
true
false
false
false
false
false
false
false
3,466
73A
Vasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monsters is Unkillable Slug. Why it is "Unkillable"? Firstly, because it can be killed with cutting weapon only, so ...
1,600
true
true
false
false
false
false
false
false
false
false
9,602
1930B
You are given a positive integer $$$n$$$. Find a permutation$$$^dagger$$$ $$$p$$$ of length $$$n$$$ such that there do not exist two distinct indices $$$i$$$ and $$$j$$$ ($$$1 leq i, j < n$$$; $$$i eq j$$$) such that $$$p_i$$$ divides $$$p_j$$$ and $$$p_{i+1}$$$ divides $$$p_{j+1}$$$. Refer to the Notes section for so...
1,000
true
false
false
false
false
true
true
false
false
false
710
1514C
Problem - 1514C - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
1,600
false
true
false
false
false
false
false
false
false
false
3,094
1646C
A number is called powerful if it is a power of two or a factorial. In other words, the number $$$m$$$ is powerful if there exists a non-negative integer $$$d$$$ such that $$$m=2^d$$$ or $$$m=d!$$$, where $$$d!=1cdot 2cdot ldots cdot d$$$ (in particular, $$$0! = 1$$$). For example $$$1$$$, $$$4$$$, and $$$6$$$ are powe...
1,500
true
false
false
true
false
true
true
false
false
false
2,393
191C
They say that Berland has exactly two problems, fools and roads. Besides, Berland has _n_ cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berland, between each pair of cities there is a path (or else the fools would get upset). Also, between eac...
1,900
false
false
false
false
true
false
false
false
false
false
9,075
348C
You are given an array _a_1,u2009_a_2,u2009...,u2009_a__n_ and _m_ sets _S_1,u2009_S_2,u2009...,u2009_S__m_ of indices of elements of this array. Let's denote _S__k_u2009=u2009{_S__k_,u2009_i_}xa0(1u2009≀u2009_i_u2009≀u2009_S__k_). In other words, _S__k_,u2009_i_ is some element from set _S__k_. In this problem you hav...
2,500
false
false
false
false
true
false
true
false
false
false
8,440
1550B
You are given a string $$$s$$$ of length $$$n$$$ consisting only of the characters 0 and 1. You perform the following operation until the string becomes empty: choose some consecutive substring of equal characters, erase it from the string and glue the remaining two parts together (any of them can be empty) in the same...
1,000
true
true
false
false
false
false
false
false
false
false
2,897
771E
Limak has a grid that consists of 2 rows and _n_ columns. The _j_-th cell in the _i_-th row contains an integer _t__i_,u2009_j_ which can be positive, negative or zero. A non-empty rectangle of cells is called nice if and only if the sum of numbers in its cells is equal to 0. Limak wants to choose some nice rectangles ...
3,000
false
true
false
true
false
false
false
false
false
false
6,694
375A
Problem - 375A - 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,331
864A
Petya and Vasya decided to play a game. They have _n_ cards (_n_ is an even number). A single integer is written on each card. Before the game Petya will choose an integer and after that Vasya will choose another integer (different from the number that Petya chose). During the game each player takes all the cards with ...
1,000
false
false
true
false
false
false
false
false
true
false
6,287
1578M
This is an interactive problem. In this problem, you need to come up with a strategy for a cooperative game. This game is played by two players. Each player receives 5 cards. Each card has a random integer between 1 and 100 on it. It is guaranteed that all numbers on cards are distinct. The goal of the game is to play ...
2,700
false
false
false
false
false
true
false
false
false
false
2,742
1455D
You are given a sequence $$$a$$$ consisting of $$$n$$$ integers $$$a_1, a_2, dots, a_n$$$, and an integer $$$x$$$. Your task is to make the sequence $$$a$$$ sorted (it is considered sorted if the condition $$$a_1 le a_2 le a_3 le dots le a_n$$$ holds). To make the sequence sorted, you may perform the following operatio...
1,600
false
true
false
true
false
false
false
false
true
false
3,399
747A
Problem - 747A - 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
true
false
false
false
false
false
true
false
false
false
6,810
1195F
Denis holds a Geometers Anonymous Club meeting in SIS. He has prepared $$$n$$$ convex polygons numbered from $$$1$$$ to $$$n$$$ for the club. He plans to offer members of the club to calculate Minkowski sums of these polygons. More precisely, he plans to give $$$q$$$ tasks, the $$$i$$$-th of them asks to calculate the ...
2,500
true
false
false
false
true
false
false
false
true
false
4,723
1824A
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 872 (Div. 1) 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...
1,400
false
true
true
false
false
false
false
false
false
false
1,337
1089D
, # Problem A. Distance Sum Time limit: 3 seconds You are given a connected undirected unweighted graph. The distance d(u, v ) between two vertices u and v is defined as the number of edges in the shortest path between them. Find the sum of d(u, v ) over all unordered pairs (u, v ). ## Input The first line of the in...
3,100
false
false
false
false
false
false
false
false
false
true
5,282
1868C
During the summer vacation after Zhongkao examination, Tom and Daniel are planning to go traveling. There are $$$n$$$ cities in their country, numbered from $$$1$$$ to $$$n$$$. And the traffic system in the country is very special. For each city $$$i$$$ ($$$1 le i le n$$$), there is a road between city $$$i$$$ and $$$...
2,400
true
false
true
true
false
false
false
false
false
false
1,065
1389E
Problem - 1389E - 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
false
false
false
false
false
false
false
false
3,724
2025G
Monocarp is gathering an army to fight a dragon in a videogame. The army consists of two parts: the heroes and the defensive artifacts. Each hero has one parameterxa0β€” his health. Each defensive artifact also has one parameterxa0β€” its durability. Before the battle begins, Monocarp distributes artifacts to the heroes so...
3,000
false
false
false
false
true
false
false
false
false
false
117
1882E2
This is the hard version of the problem. The difference between the two versions is that you have to minimize the number of operations in this version. You can make hacks only if both versions of the problem are solved. You have two permutations$$$^{dagger}$$$ $$$p_{1}, p_{2}, ldots, p_{n}$$$ (of integers $$$1$$$ to $$...
3,100
false
false
false
false
false
true
false
false
false
false
992
1598F
A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence (or, shortly, an RBS) is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example: bracket sequences ...
2,400
false
false
false
true
true
false
true
true
false
false
2,666
124A
Problem - 124A - 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
false
false
false
false
false
false
false
false
false
9,384
471A
Two polar bears Menshykov and Uslada from the St.Petersburg zoo and elephant Horace from the Kiev zoo got six sticks to play with and assess the animals' creativity. Menshykov, Uslada and Horace decided to make either an elephant or a bear from those sticks. They can make an animal from sticks in the following way: Fo...
1,100
false
false
true
false
false
false
false
false
false
false
7,952
1211E
Polycarp recently became an employee of the company "Double Permutation Inc." Now he is a fan of permutations and is looking for them everywhere! A permutation in this problem is a sequence of integers $$$p_1, p_2, dots, p_k$$$ such that every integer from $$$1$$$ to $$$k$$$ occurs exactly once in it. For example, the ...
2,000
false
true
false
false
false
false
false
true
false
false
4,624
1876E
With a problem title like that, there is no way this is going to be a graph problem. Chaneka has a graph with $$$n$$$ vertices and $$$n-1$$$ edges. Some of the edges are directed and some of the edges are undirected. Edge $$$i$$$ connects vertex $$$u_i$$$ to vertex $$$v_i$$$. If $$$t_i=0$$$, edge $$$i$$$ is undirected....
3,300
false
false
false
true
true
true
false
false
false
false
1,022
1100E
Andrew prefers taxi to other means of transport, but recently most taxi drivers have been acting inappropriately. In order to earn more money, taxi drivers started to drive in circles. Roads in Andrew's city are one-way, and people are not necessary able to travel from one part to another, but it pales in comparison to...
2,200
false
false
false
false
false
false
false
true
false
true
5,202
1336A
Writing light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and of course, she is the queen of it. xa0There are $$$n$$$ cities and $$$n-1$$$ two-way roads connecting pairs of cities in t...
1,600
false
true
false
true
false
false
false
false
true
false
4,023
439D
Devu and his brother love each other a lot. As they are super geeks, they only like to play with arrays. They are given two arrays _a_ and _b_ by their father. The array _a_ is given to Devu and _b_ to his brother. As Devu is really a naughty kid, he wants the minimum value of his array _a_ should be at least as much a...
1,700
false
false
false
false
false
false
false
true
true
false
8,081
1525A
You have an initially empty cauldron, and you want to brew a potion in it. The potion consists of two ingredients: magic essence and water. The potion you want to brew should contain exactly $$$k %$$$ magic essence and $$$(100 - k) %$$$ water. In one step, you can pour either one liter of magic essence or one liter of ...
800
true
false
false
false
false
false
false
false
false
false
3,042
387A
Problem - 387A - Codeforces =============== xa0 ]( --- Finished β†’ Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
900
false
false
true
false
false
false
false
false
false
false
8,282
24D
Problem - 24D - Codeforces =============== xa0 . The board consists of _N_ rows and _M_ columns of cells. The robot is initially at some cell on the _i_-th row and the _j_-th column. Then at every step the robot could go to some another cell. The aim is to go to the bottommost (_N_-th) row. The robot can ...
2,400
true
false
false
true
false
false
false
false
false
false
9,875
796A
Zane the wizard had never loved anyone before, until he fell in love with a girl, whose name remains unknown to us. The girl lives in house _m_ of a village. There are _n_ houses in that village, lining in a straight line from left to right: house 1, house 2, ..., house _n_. The village is also well-structured: house _...
800
false
false
true
false
false
false
true
false
false
false
6,593
670B
In late autumn evening _n_ robots gathered in the cheerful company of friends. Each robot has a unique identifierxa0β€” an integer from 1 to 109. At some moment, robots decided to play the game "Snowball". Below there are the rules of this game. First, all robots stand in a row. Then the first robot says his identifier. ...
1,000
false
false
true
false
false
false
false
false
false
false
7,146
1599E
You are given two integer arrays of length $$$N$$$, $$$A1$$$ and $$$A2$$$. You are also given $$$Q$$$ queries of 4 types: 1 k l r x: set $$$Ak_i:=min(Ak_i, x)$$$ for each $$$l leq i leq r$$$. 2 k l r x: set $$$Ak_i:=max(Ak_i, x)$$$ for each $$$l leq i leq r$$$. 3 k l r x: set $$$Ak_i:=Ak_i+x$$$ for each $$$l leq i leq ...
3,200
false
false
false
false
true
false
false
false
false
false
2,660
1848E
In Vika's hometown, Vladivostok, there is a beautiful sea. Often you can see kids skimming stones. This is the process of throwing a stone into the sea at a small angle, causing it to fly far and bounce several times off the water surface. Vika has skimmed stones many times and knows that if you throw a stone from the ...
2,600
true
false
true
false
false
false
true
false
false
false
1,190
544A
Problem - 544A - 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
false
false
true
false
false
false
false
false
false
false
7,664
1992G
K1o0n gave you an array $$$a$$$ of length $$$n$$$, consisting of numbers $$$1, 2, ldots, n$$$. Accept it? Of course! But what to do with it? Of course, calculate $$$ ext{MEOW}(a)$$$. Let $$$ ext{MEX}(S, k)$$$ be the $$$k$$$-th positive (strictly greater than zero) integer in ascending order that is not present in the s...
2,000
true
false
false
true
false
false
false
false
false
false
313
1753A1
This is the easy version of the problem. The difference is that in this version the array can not contain zeros. You can make hacks only if both versions of the problem are solved. You are given an array $$$[a_1, a_2, ldots a_n]$$$ consisting of integers $$$-1$$$ and $$$1$$$. You have to build a partition of this array...
1,300
false
true
false
true
false
true
false
false
false
false
1,777
1422E
Some time ago Lesha found an entertaining string $$$s$$$ consisting of lowercase English letters. Lesha immediately developed an unique algorithm for this string and shared it with you. The algorithm is as follows. Lesha chooses an arbitrary (possibly zero) number of pairs on positions $$$(i, i + 1)$$$ in such a way th...
2,700
false
true
true
true
false
false
false
false
false
false
3,565
1548D2
This is the hard version of the problem. The only difference from the easy version is that in this version the coordinates can be both odd and even. There are $$$n$$$ fence-posts at distinct coordinates on a plane. It is guaranteed that no three fence posts lie on the same line. There are an infinite number of cows on ...
3,300
true
false
false
false
false
false
true
false
false
false
2,902
721E
Once Danil the student was returning home from tram stop lately by straight road of length _L_. The stop is located at the point _x_u2009=u20090, but the Danil's homexa0β€” at the point _x_u2009=u2009_L_. Danil goes from _x_u2009=u20090 to _x_u2009=u2009_L_ with a constant speed and does not change direction of movement....
2,700
false
false
false
true
false
false
false
true
false
false
6,927
85E
In a far away kingdom lives a very greedy king. To defend his land, he built _n_ guard towers. Apart from the towers the kingdom has two armies, each headed by a tyrannical and narcissistic general. The generals can't stand each other, specifically, they will never let soldiers of two armies be present in one tower. Du...
2,600
false
false
false
false
false
false
false
true
true
true
9,542
1114B
An array $$$b$$$ is called to be a subarray of $$$a$$$ if it forms a continuous subsequence of $$$a$$$, that is, if it is equal to $$$a_l$$$, $$$a_{l + 1}$$$, $$$ldots$$$, $$$a_r$$$ for some $$$l, r$$$. Suppose $$$m$$$ is some known constant. For any array, having $$$m$$$ or more elements, let's define it's beauty as t...
1,500
false
true
false
false
false
true
false
false
true
false
5,133
932F
You are given a tree with _n_ nodes (numbered from 1 to _n_) rooted at node 1. Also, each node has two values associated with it. The values for _i_-th node are _a__i_ and _b__i_. You can jump from a node to any node in its subtree. The cost of one jump from node _x_ to node _y_ is the product of _a__x_ and _b__y_. The...
2,700
false
false
false
true
true
false
false
false
false
false
5,973
1097G
A great legend used to be here, but some troll hacked Codeforces and erased it. Too bad for us, but in the troll society he earned a title of an ultimate-greatest-over troll. At least for them, it's something good. And maybe a formal statement will be even better for us? You are given a tree $$$T$$$ with $$$n$$$ vertic...
3,000
false
false
false
true
false
false
false
false
false
false
5,218
553C
There are many anime that are about "love triangles": Alice loves Bob, and Charlie loves Bob as well, but Alice hates Charlie. You are thinking about an anime which has _n_ characters. The characters are labeled from 1 to _n_. Every pair of two characters can either mutually love each other or mutually hate each other ...
2,200
false
false
false
false
false
false
false
false
false
true
7,620
715E
ZS the Coder is given two permutations _p_ and _q_ of {1,u20092,u2009...,u2009_n_}, but some of their elements are replaced with 0. The distance between two permutations _p_ and _q_ is defined as the minimum number of moves required to turn _p_ into _q_. A move consists of swapping exactly 2 elements of _p_. ZS the Cod...
3,400
true
false
false
false
false
false
false
false
false
true
6,955
1676F
Given an array $$$a$$$ of length $$$n$$$ and an integer $$$k$$$, you are tasked to find any two numbers $$$l$$$ and $$$r$$$ ($$$l leq r$$$) such that: For each $$$x$$$ $$$(l leq x leq r)$$$, $$$x$$$ appears in $$$a$$$ at least $$$k$$$ times (i.e. $$$k$$$ or more array elements are equal to $$$x$$$). The value $$$r-l$...
1,300
false
true
true
false
true
false
false
false
true
false
2,210
505A
Mr. Kitayuta has kindly given you a string _s_ consisting of lowercase English letters. You are asked to insert exactly one lowercase English letter into _s_ to make it a palindrome. A palindrome is a string that reads the same forward and backward. For example, "noon", "testset" and "a" are all palindromes, while "tes...
1,100
false
false
true
false
false
false
true
false
false
false
7,823