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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1250L | A group of students has recently been admitted to the Faculty of Computer Sciences at the Berland State University. Now the programming teacher wants to divide them into three subgroups for practice sessions. The teacher knows that a lot of programmers argue which language is the best. The teacher doesn't want to hear ... | 1,500 | true | true | false | false | false | false | false | true | false | false | 4,444 |
1948D | You are given a string $$$s$$$, consisting of lowercase Latin letters and/or question marks. A tandem repeat is a string of an even length such that its first half is equal to its second half. A string $$$a$$$ is a substring of a string $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by the deletion of several (possibl... | 1,700 | false | false | false | false | false | false | true | false | false | false | 596 |
325B | Daniel is organizing a football tournament. He has come up with the following tournament format: 1. In the first several (possibly zero) stages, while the number of teams is even, they split in pairs and play one game for each pair. At each stage the loser of each pair is eliminated (there are no draws). Such stages ar... | 1,800 | true | false | false | false | false | false | false | true | false | false | 8,540 |
549E | Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has _n_ points, Sasha β _m_. Since their subordinates constantly had conflicts with each other, they decided to build a fence in the form of a circle, so t... | 2,700 | true | false | false | false | false | false | false | false | false | false | 7,641 |
2000G | You live in a city consisting of $$$n$$$ intersections and $$$m$$$ streets connecting some pairs of intersections. You can travel in either direction on each street. No two streets connect the same pair of intersections, and no street connects an intersection to itself. You can reach any intersection from any other, po... | 2,100 | false | true | false | false | false | false | true | true | false | true | 257 |
954A | Problem - 954A - 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 | 5,909 |
1185B | Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more than once (if you press a key on a regular keyboard, it prints exactly one symbol). For example, as a result of typing the word "hello", the follow... | 1,200 | false | false | true | false | false | false | false | false | false | false | 4,779 |
580A | Problem - 580A - 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 | true | false | false | true | false | false | false | 7,528 |
1978B | Bob decided to open a bakery. On the opening day, he baked $$$n$$$ buns that he can sell. The usual price of a bun is $$$a$$$ coins, but to attract customers, Bob organized the following promotion: Bob chooses some integer $$$k$$$ ($$$0 le k le min(n, b)$$$). Bob sells the first $$$k$$$ buns at a modified price. In t... | 800 | true | true | false | false | false | false | false | true | false | false | 421 |
1791B | Alperen is standing at the point $$$(0,0)$$$. He is given a string $$$s$$$ of length $$$n$$$ and performs $$$n$$$ moves. The $$$i$$$-th move is as follows: if $$$s_i = exttt{L}$$$, then move one unit left; if $$$s_i = exttt{R}$$$, then move one unit right; if $$$s_i = exttt{U}$$$, then move one unit up; if $$$s_... | 800 | false | false | true | false | false | false | false | false | false | false | 1,534 |
1998B | You are given a permutation$$$^{ ext{β}}$$$ $$$p$$$ of length $$$n$$$. Find a permutation $$$q$$$ of length $$$n$$$ that minimizes the number of pairs ($$$i, j$$$) ($$$1 leq i leq j leq n$$$) such that $$$p_i + p_{i+1} + ldots + p_j = q_i + q_{i+1} + ldots + q_j$$$. $$$^{ ext{β}}$$$A permutation of length $$$n$$$ is an... | 1,000 | true | false | false | false | false | true | false | false | false | false | 276 |
632F | Problem - 632F - Codeforces =============== xa0 , _a__ii_u2009=u20090 and _a__ij_u2009β€u2009_max_(_a__ik_,u2009_a__jk_) for all triples _i_,u2009_j_,u2009_k_. Note that _i_,u2009_j_,u2009_k_ do not need to be distinct. Determine if the matrix is magic. As the input/output can reach very huge size it is recomm... | 2,400 | false | false | false | false | false | false | true | false | false | true | 7,276 |
93B | Students love to celebrate their holidays. Especially if the holiday is the day of the end of exams! Despite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to go to a cafe so that each of them could drink a bottle of... fresh cow milk. Having entered the cafe,... | 1,900 | false | true | false | false | false | false | false | false | false | false | 9,514 |
1749A | There's a chessboard of size $$$n imes n$$$. $$$m$$$ rooks are placed on it in such a way that: no two rooks occupy the same cell; no two rooks attack each other. A rook attacks all cells that are in its row or column. Is it possible to move exactly one rook (you can choose which one to move) into a different cell s... | 800 | false | true | true | false | false | false | false | false | false | false | 1,791 |
1742D | Given an array of $$$n$$$ positive integers $$$a_1, a_2, dots, a_n$$$ ($$$1 le a_i le 1000$$$). Find the maximum value of $$$i + j$$$ such that $$$a_i$$$ and $$$a_j$$$ are coprime,$$$^{dagger}$$$ or $$$-1$$$ if no such $$$i$$$, $$$j$$$ exist. For example consider the array $$$. Input The input consists of multiple test... | 1,100 | false | true | false | false | false | false | true | false | false | false | 1,828 |
238B | This problem is the most boring one you've ever seen. Given a sequence of integers _a_1,u2009_a_2,u2009...,u2009_a__n_ and a non-negative integer _h_, our goal is to partition the sequence into two subsequences (not necessarily consist of continuous elements). Each element of the original sequence should be contained i... | 1,800 | false | false | false | false | false | true | false | false | false | false | 8,883 |
1077A | A frog is currently at the point $$$0$$$ on a coordinate axis $$$Ox$$$. It jumps by the following algorithm: the first jump is $$$a$$$ units to the right, the second jump is $$$b$$$ units to the left, the third jump is $$$a$$$ units to the right, the fourth jump is $$$b$$$ units to the left, and so on. Formally: if th... | 800 | true | false | false | false | false | false | false | false | false | false | 5,337 |
818D | Alice and Bob got very bored during a long car trip so they decided to play a game. From the window they can see cars of different colors running past them. Cars are going one after another. The game rules are like this. Firstly Alice chooses some color _A_, then Bob chooses some color _B_ (_A_u2009β u2009_B_). After ea... | 1,700 | false | false | true | false | true | false | false | false | false | false | 6,484 |
1601C | You are given two arrays of integers $$$a_1, a_2, ldots, a_n$$$ and $$$b_1, b_2, ldots, b_m$$$. You need to insert all elements of $$$b$$$ into $$$a$$$ in an arbitrary way. As a result you will get an array $$$c_1, c_2, ldots, c_{n+m}$$$ of size $$$n + m$$$. Note that you are not allowed to change the order of elements... | 2,300 | false | true | false | true | true | false | false | false | true | false | 2,649 |
785A | Anton's favourite geometric figures are regular polyhedrons. Note that there are five kinds of regular polyhedrons: Tetrahedron. Tetrahedron has 4 triangular faces. Cube. Cube has 6 square faces. Octahedron. Octahedron has 8 triangular faces. Dodecahedron. Dodecahedron has 12 pentagonal faces. Icosahedron. Icosahe... | 800 | false | false | true | false | false | false | false | false | false | false | 6,633 |
630I | To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes. The parking lot before the office consists of one line of (2_n_u2009-u20092) parking spaces. Unfortunately the total numbe... | 1,700 | true | false | false | false | false | false | false | false | false | false | 7,296 |
1987B | You are given an array of integers $$$a$$$ of length $$$n$$$. You can apply the following operation any number of times (maybe, zero): First, choose an integer $$$k$$$ such that $$$1 le k le n$$$ and pay $$$k + 1$$$ coins. Then, choose exactly $$$k$$$ indices such that $$$1 le i_1 < i_2 < ldots < i_k le n$$$. Then, ... | 1,000 | false | true | false | false | false | false | false | false | false | false | 356 |
569A | Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk. Unfortunately, internet is not that fast in the city of Ekaterinozavodsk and the song takes a lot of time to download. But Lesha is quite i... | 1,500 | true | false | true | false | false | false | false | false | false | false | 7,573 |
1766C | Sir Monocarp Hamilton is planning to paint his wall. The wall can be represented as a grid, consisting of $$$2$$$ rows and $$$m$$$ columns. Initially, the wall is completely white. Monocarp wants to paint a black picture on the wall. In particular, he wants cell $$$(i, j)$$$ (the $$$j$$$-th cell in the $$$i$$$-th row) ... | 1,300 | false | false | true | true | false | false | false | false | false | false | 1,701 |
559B | Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings _a_ and _b_ of equal length are called equivalent in one of the two cases: 1. They are equal. 2. If we split string _a_ into two halves of the same size _a_1 and _a_2, and string _b_ into two halves of the same size _b_1... | 1,700 | false | false | false | false | false | false | false | false | true | false | 7,597 |
862E | Dr. Evil is interested in math and functions, so he gave Mahmoud and Ehab array _a_ of length _n_ and array _b_ of length _m_. He introduced a function _f_(_j_) which is defined for integers _j_, which satisfy 0u2009β€u2009_j_u2009β€u2009_m_u2009-u2009_n_. Suppose, _c__i_u2009=u2009_a__i_u2009-u2009_b__i_u2009+u2009_j_. ... | 2,100 | false | false | false | false | true | false | false | true | true | false | 6,296 |
1155E | Jury picked a polynomial $$$f(x) = a_0 + a_1 cdot x + a_2 cdot x^2 + dots + a_k cdot x^k$$$. $$$k le 10$$$ and all $$$a_i$$$ are integer numbers and $$$0 le a_i < 10^6 + 3$$$. It's guaranteed that there is at least one $$$i$$$ such that $$$a_i > 0$$$. Now jury wants you to find such an integer $$$x_0$$$ that $$$f(x_0) ... | 2,200 | true | false | false | false | false | false | true | false | false | false | 4,932 |
1346C | Tanya wants to organize her bookcase. There are $$$n$$$ bookshelves in the bookcase, the $$$i$$$-th bookshelf contains $$$a_i$$$ books on it. Tanya will be satisfied if each bookshelf contains no more than $$$k$$$ books. Tanya can do one of the two following operations to achieve her goal: 1. Choose exactly one bookshe... | 1,600 | false | true | false | false | false | false | false | false | true | false | 3,977 |
1583D | It turns out that the meaning of life is a permutation $$$p_1, p_2, ldots, p_n$$$ of the integers $$$1, 2, ldots, n$$$ ($$$2 leq n leq 100$$$). Omkar, having created all life, knows this permutation, and will allow you to figure it out using some queries. A query consists of an array $$$a_1, a_2, ldots, a_n$$$ of integ... | 1,800 | false | true | false | false | false | true | false | false | false | false | 2,714 |
1538D | You are given two integers $$$a$$$ and $$$b$$$. In one turn, you can do one of the following operations: Take an integer $$$c$$$ ($$$c > 1$$$ and $$$a$$$ should be divisible by $$$c$$$) and replace $$$a$$$ with $$$frac{a}{c}$$$; Take an integer $$$c$$$ ($$$c > 1$$$ and $$$b$$$ should be divisible by $$$c$$$) and repl... | 1,700 | true | false | false | false | false | true | false | false | false | false | 2,952 |
1776K | In a parallel universe there are $$$n$$$ chemical elements, numbered from $$$1$$$ to $$$n$$$. The element number $$$n$$$ has not been discovered so far, and its discovery would be a pinnacle of research and would bring the person who does it eternal fame and the so-called SWERC prize. There are $$$m$$$ independent rese... | 3,200 | true | false | false | true | false | false | false | false | false | false | 1,618 |
83B | There are _n_ animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly well and therefore knows exactly that the animal number _i_ in the queue will have to visit... | 1,800 | true | false | false | false | false | false | false | true | true | false | 9,552 |
1528B | Problem - 1528B - 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,700 | true | false | false | true | false | false | false | false | false | false | 3,022 |
1866B | On the trip to campus during the mid semester exam period, Chaneka thinks of two positive integers $$$X$$$ and $$$Y$$$. Since the two integers can be very big, both are represented using their prime factorisations, such that: $$$X=A_1^{B_1} imes A_2^{B_2} imesldots imes A_N^{B_N}$$$ (each $$$A_i$$$ is prime, each $$$B... | 1,400 | true | false | false | false | false | false | false | false | false | false | 1,087 |
548A | Problem - 548A - 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 | true | false | false | false | 7,647 |
256D | Problem - 256D - 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 | false | false | false | true | false | false | false | false | false | false | 8,809 |
1736E | Problem - 1736E - 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,600 | false | true | false | true | false | false | false | false | false | false | 1,869 |
1162B | You are given two $$$n imes m$$$ matrices containing integers. A sequence of integers is strictly increasing if each next number is greater than the previous one. A row is strictly increasing if all numbers from left to right are strictly increasing. A column is strictly increasing if all numbers from top to bottom ar... | 1,400 | false | true | false | false | false | false | true | false | false | false | 4,905 |
676D | Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size _n_u2009Γu2009_m_ and consists of blocks of size 1u2009Γu20091. Each block of the labyrinth has a button that rotates all blocks 90 degrees clockwise. Each block rotates around its center and doesn't... | 2,000 | false | false | true | false | false | false | false | false | false | true | 7,123 |
1271F | Recently a lot of students were enrolled in Berland State University. All students were divided into groups according to their education program. Some groups turned out to be too large to attend lessons in the same auditorium, so these groups should be divided into two subgroups. Your task is to help divide the first-y... | 2,700 | false | false | false | false | false | false | true | false | false | false | 4,330 |
556B | Andrewid the Android is a galaxy-famous detective. He is now investigating a case of frauds who make fake copies of the famous Stolp's gears, puzzles that are as famous as the Rubik's cube once was. Its most important components are a button and a line of _n_ similar gears. Each gear has _n_ teeth containing all number... | 1,100 | false | false | true | false | false | false | true | false | false | false | 7,609 |
303C | Problem - 303C - 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 | false | true | false | false | true | 8,621 |
250A | Polycarpus has been working in the analytic department of the "F.R.A.U.D." company for as much as _n_ days. Right now his task is to make a series of reports about the company's performance for the last _n_ days. We know that the main information in a day report is value _a__i_, the company's profit on the _i_-th day. ... | 1,000 | false | true | false | false | false | false | false | false | false | false | 8,836 |
55A | Problem - 55A - Codeforces =============== xa0 . For example, after the first minute the flea jumps to the neighboring hassock. You should answer: will the flea visit all the hassocks or not. We assume that flea has infinitely much time for this jumping. Input The only line contains single... | 1,200 | true | false | true | false | false | false | false | false | false | false | 9,700 |
1984D | You are given a string $$$s$$$ consisting of lowercase Latin characters. Count the number of nonempty strings $$$t eq$$$ "$$$ exttt{a}$$$" such that it is possible to partition$$$^{dagger}$$$ $$$s$$$ into some substrings satisfying the following conditions: each substring either equals $$$t$$$ or "$$$ exttt{a}$$$", a... | 2,000 | true | false | true | false | false | false | true | false | false | false | 379 |
975C | Ivar the Boneless is a great leader. He is trying to capture Kattegat from Lagertha. The war has begun and wave after wave Ivar's warriors are falling in battle. Ivar has $$$n$$$ warriors, he places them on a straight line in front of the main gate, in a way that the $$$i$$$-th warrior stands right after $$$(i-1)$$$-th... | 1,400 | false | false | false | false | false | false | false | true | false | false | 5,833 |
13B | Problem - 13B - Codeforces =============== xa0 , while the third segment connects two points on the different segments. The angle between the first and the second segments is greater than 0 and do not exceed 90 degrees. The third segment divides each of the first two segments in proportion not less than... | 2,000 | false | false | true | false | false | false | false | false | false | false | 9,929 |
292C | The problem uses a simplified TCP/IP address model, please read the statement carefully. An IP address is a 32-bit integer, represented as a group of four decimal 8-bit integers (without leading zeroes), separated by commas. For example, record 0.255.1.123 shows a correct IP address and records 0.256.1.123 and 0.255.1.... | 2,000 | false | false | false | false | false | false | true | false | false | false | 8,664 |
113E | One day Vasya was lying in bed watching his electronic clock to fall asleep quicker. Vasya lives in a strange country, where days have _h_ hours, and every hour has _m_ minutes. Clock shows time in decimal number system, in format H:M, where the string H always has a fixed length equal to the number of digits in the de... | 2,700 | true | false | true | false | false | false | false | false | false | false | 9,431 |
1119B | Alyona has recently bought a miniature fridge that can be represented as a matrix with $$$h$$$ rows and $$$2$$$ columns. Initially there is only one shelf at the bottom of the fridge, but Alyona can install arbitrary number of shelves inside the fridge between any two rows. A shelf is two cells wide, does not occupy an... | 1,300 | false | true | false | false | false | false | false | true | true | false | 5,093 |
1184D1 | The Third Doctor Who once correctly said that travel between parallel universes is "like travelling sideways". However, he incorrectly thought that there were infinite parallel universes, whereas in fact, as we now all know, there will never be more than 250. Heidi recently got her hands on a multiverse observation too... | 1,600 | false | false | true | false | false | false | false | false | false | false | 4,785 |
285D | Problem - 285D - 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 | true | true | false | false | false | false | false | false | 8,693 |
81B | Polycarp is very careful. He even types numeric sequences carefully, unlike his classmates. If he sees a sequence without a space after the comma, with two spaces in a row, or when something else does not look neat, he rushes to correct it. For example, number sequence written like "1,2xa0,3,...,xa0xa0xa010" will be co... | 1,700 | false | false | true | false | false | false | false | false | false | false | 9,562 |
1582F1 | This is an easier version of the problem with smaller constraints. Korney Korneevich dag up an array $$$a$$$ of length $$$n$$$. Korney Korneevich has recently read about the operation elements. A sequence $$$s_1, s_2, ldots , s_m$$$ is called increasing if $$$s_1 < s_2 < ldots < s_m$$$. Input The first line contains a ... | 1,800 | false | true | false | true | false | false | false | false | false | false | 2,720 |
137D | Friday is Polycarpus' favourite day of the week. Not because it is followed by the weekend, but because the lessons on Friday are 2 IT lessons, 2 math lessons and 2 literature lessons. Of course, Polycarpus has prepared to all of them, unlike his buddy Innocentius. Innocentius spent all evening playing his favourite ga... | 1,900 | false | false | false | true | false | false | false | false | false | false | 9,327 |
77B | For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes and shapes. Quite often they get the hero stuck deep in the ground. But have you ever thought who t... | 1,800 | true | false | false | false | false | false | false | false | false | false | 9,579 |
925D | Indiana Jones found ancient Aztec catacombs containing a golden idol. The catacombs consists of $$$n$$$ caves. Each pair of caves is connected with a two-way corridor that can be opened or closed. The entrance to the catacombs is in the cave $$$1$$$, the idol and the exit are in the cave $$$n$$$. When Indiana goes from... | 2,600 | false | false | false | false | false | true | false | false | false | false | 6,008 |
75C | Problem - 75C - 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,600 | false | false | false | false | false | false | false | true | false | false | 9,589 |
1478A | Nezzar has $$$n$$$ balls, numbered with integers $$$1, 2, ldots, n$$$. Numbers $$$a_1, a_2, ldots, a_n$$$ are written on them, respectively. Numbers on those balls form a non-decreasing sequence, which means that $$$a_i leq a_{i+1}$$$ for all $$$1 leq i < n$$$. Nezzar wants to color the balls using the minimum number o... | 800 | false | true | false | false | false | false | true | false | false | false | 3,284 |
1503C | Problem - 1503C - 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 | false | true | false | true | true | false | false | true | true | false | 3,158 |
1676G | You are given a rooted tree consisting of $$$n$$$ vertices numbered from $$$1$$$ to $$$n$$$. The root is vertex $$$1$$$. There is also a string $$$s$$$ denoting the color of each vertex: if $$$s_i = exttt{B}$$$, then vertex $$$i$$$ is black, and if $$$s_i = exttt{W}$$$, then vertex $$$i$$$ is white. A subtree of the ... | 1,300 | false | false | false | true | false | false | false | false | false | true | 2,209 |
1932E | You are in a nuclear laboratory that is about to explode and destroy the Earth. You must save the Earth before the final countdown reaches zero. The countdown consists of $$$n$$$ ($$$1 le n le 4 cdot 10^5$$$) mechanical indicators, each showing one decimal digit. You noticed that when the countdown changes its state fr... | 1,600 | true | false | true | false | false | false | false | false | false | false | 690 |
1601F | Integers from $$$1$$$ to $$$n$$$ (inclusive) were sorted lexicographically (considering integers as strings). As a result, array $$$a_1, a_2, dots, a_n$$$ was obtained. Calculate value of $$$(sum_{i = 1}^n ((i - a_i) mod 998244353)) mod 10^9 + 7$$$. $$$x mod y$$$ here means the remainder after division $$$x$$$ by $$$y$... | 3,400 | true | false | false | false | false | false | false | true | false | false | 2,646 |
1559E | Mocha wants to be an astrologer. There are $$$n$$$ stars which can be seen in Zhijiang, and the brightness of the $$$i$$$-th star is $$$a_i$$$. Mocha considers that these $$$n$$$ stars form a constellation, and she uses $$$(a_1,a_2,ldots,a_n)$$$ to show its state. A state is called mathematical if all of the following ... | 2,200 | true | false | false | true | false | false | false | false | false | false | 2,831 |
491B | Think of New York as a rectangular grid consisting of _N_ vertical avenues numerated from 1 to _N_ and _M_ horizontal streets numerated 1 to _M_. _C_ friends are staying at _C_ hotels located at some street-avenue crossings. They are going to celebrate birthday of one of them in the one of _H_ restaurants also located ... | 2,100 | true | true | false | false | false | false | false | false | false | false | 7,870 |
1191B | Tokitsukaze is playing a game derivated from Japanese mahjong. In this game, she has three tiles in her hand. Each tile she owns is a suited tile, which means it has a suit (manzu, pinzu or souzu) and a number (a digit ranged from $$$1$$$ to $$$9$$$). In this problem, we use one digit and one lowercase letter, which is... | 1,200 | false | false | true | false | false | false | true | false | false | false | 4,743 |
464C | Andrew and Eugene are playing a game. Initially, Andrew has string _s_, consisting of digits. Eugene sends Andrew multiple queries of type "_d__i_u2009βu2009_t__i_", that means "replace all digits _d__i_ in string _s_ with substrings equal to _t__i_". For example, if _s_u2009=u2009123123, then query "2u2009βu200900" tr... | 2,100 | false | false | false | true | false | false | false | false | false | false | 7,982 |
74B | A stowaway and a controller play the following game. The train is represented by _n_ wagons which are numbered with positive integers from 1 to _n_ from the head to the tail. The stowaway and the controller are initially in some two different wagons. Every minute the train can be in one of two conditions β moving or id... | 1,500 | false | true | false | true | false | false | false | false | false | false | 9,595 |
1626F | You are given an integer array $$$a_0, a_1, dots, a_{n - 1}$$$, and an integer $$$k$$$. You perform the following code with it: ``` long long ans = 0; // create a 64-bit signed variable which is initially equal to 0for(int i = 1; i <= k; i++){ int idx = rnd.next(0, n - 1); // generate a random integer between 0 and n -... | 2,800 | true | false | false | true | false | false | false | false | false | false | 2,482 |
366E | Dima loves Inna very much. He decided to write a song for her. Dima has a magic guitar with _n_ strings and _m_ frets. Dima makes the guitar produce sounds like that: to play a note, he needs to hold one of the strings on one of the frets and then pull the string. When Dima pulls the _i_-th string holding it on the _j_... | 2,200 | true | false | true | false | false | false | true | false | false | false | 8,366 |
660B | Consider 2_n_ rows of the seats in a bus. _n_ rows of the seats on the left and _n_ rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4_n_. Consider that _m_ (_m_u2009β€u20094_n_) people occupy the seats in the bus. The passengers entering the bus are numbered from... | 1,000 | false | false | true | false | false | false | false | false | false | false | 7,181 |
1367B | You are given an array $$$a[0 ldots n-1]$$$ of length $$$n$$$ which consists of non-negative integers. Note that array indices start from zero. An array is called good if the parity of each index matches the parity of the element at that index. More formally, an array is good if for all $$$i$$$ ($$$0 le i le n - 1$$$) ... | 800 | true | true | false | false | false | false | false | false | false | false | 3,842 |
916D | Why I have to finish so many assignments??? Jamie is getting very busy with his school life. He starts to forget the assignments that he has to do. He decided to write the things down on a to-do list. He assigns a value priority for each of his assignment (lower value means more important) so he can decide which he nee... | 2,200 | false | false | false | false | true | false | false | false | false | false | 6,065 |
1310D | Masha lives in a country with $$$n$$$ cities numbered from $$$1$$$ to $$$n$$$. She lives in the city number $$$1$$$. There is a direct train route between each pair of distinct cities $$$i$$$ and $$$j$$$, where $$$i eq j$$$. In total there are $$$n(n-1)$$$ distinct routes. Every route has a cost, cost for route from $... | 2,300 | false | false | false | true | false | false | false | false | false | true | 4,146 |
618A | Your friend recently gave you some slimes for your birthday. You have _n_ slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, you will add the other _n_u2009-u20091 slimes one by one. When you add a slime, you place it at the rig... | 800 | false | false | true | false | false | false | false | false | false | false | 7,364 |
1228C | Let's introduce some definitions that will be needed later. Let $$$prime(x)$$$ be the set of prime divisors of $$$x$$$. For example, $$$prime(140) = { 2, 5, 7 }$$$, $$$prime(169) = { 13 }$$$. Let $$$g(x, p)$$$ be the maximum possible integer $$$p^k$$$ where $$$k$$$ is an integer such that $$$x$$$ is divisible by $$$p^k... | 1,700 | true | false | false | false | false | false | false | false | false | false | 4,533 |
100F | Problem - 100F - Codeforces =============== xa0 u2009=u2009(_x_u2009+u2009_a_1)Β·(_x_u2009+u2009_a_2)Β·... (_x_u2009+u2009_a__n_). Write Pike program to print it in a standard form _p_(_x_)u2009=u2009_x__n_u2009+u2009_b_1_x__n_u2009-u20091u2009+u2009...u2009+u2009_b__n_u2009-u20091_x_u2009+u2009_b__n_. You shou... | 1,800 | false | false | true | false | false | false | false | false | false | false | 9,484 |
1780G | Today is an important day for chef Tonio β an auditor has arrived in his hometown of Morioh. He has also arrived at Tonio's restaurant and ordered dessert. Tonio has not been prepared for this turn of events. As you know, dessert is a string of lowercase English letters. Tonio remembered the rule of dessertsxa0β a stri... | 2,400 | true | false | false | false | false | false | false | true | false | false | 1,589 |
1616H | Problem - 1616H - Codeforces =============== xa0 $$$ where $$$1 leq i < j leq k$$$, the inequality $$$a_{b_i} oplus a_{b_j} leq x$$$ is held. Here, $$$oplus$$$ denotes the . Here, $$$n$$$ is the size of the array. The next line contains $$$n$$$ integers $$$a_1, a_2, ldots, a_n$$$ ($$$0 leq a_i < 2^{30}$$$... | 3,000 | true | false | false | true | true | false | false | false | false | false | 2,549 |
1312A | You are given two integers $$$n$$$ and $$$m$$$ ($$$m < n$$$). Consider a convex regular polygon of $$$n$$$ vertices. Recall that a regular polygon is a polygon that is equiangular (all angles are equal in measure) and equilateral (all sides have the same length). Examples of convex regular polygons Your task is to say... | 800 | true | true | false | false | false | false | false | false | false | false | 4,137 |
1829D | Initially you have a single pile with $$$n$$$ gold nuggets. In an operation you can do the following: Take any pile and split it into two piles, so that one of the resulting piles has exactly twice as many gold nuggets as the other. (All piles should have an integer number of nuggets.) One possible move is to take a p... | 1,000 | false | false | true | true | false | false | true | false | false | false | 1,311 |
1560D | You are given an integer $$$n$$$. In $$$1$$$ move, you can do one of the following actions: erase any digit of the number (it's acceptable that the number before the operation has exactly one digit and after the operation, it is "empty"); add one digit to the right. The actions may be performed in any order any numbe... | 1,300 | true | true | false | false | false | false | false | false | false | false | 2,827 |
1530H | Alan Turing is standing on a tape divided into cells that is infinite in both directions. Cells are numbered with consecutive integers from left to right. Alan is initially standing in cell $$$0$$$. Every cell $$$x$$$ has cell $$$x - 1$$$ on the left and cell $$$x + 1$$$ on the right. Each cell can either contain an in... | 3,400 | false | false | false | true | true | false | false | false | false | false | 3,008 |
98D | In a far away kingdom is the famous Lio Shan monastery. Gods constructed three diamond pillars on the monastery's lawn long ago. Gods also placed on one pillar _n_ golden disks of different diameters (in the order of the diameters' decreasing from the bottom to the top). Besides, gods commanded to carry all the disks f... | 2,500 | false | false | false | false | false | true | false | false | false | false | 9,493 |
1540B | You are given a tree consisting of $$$n$$$ nodes. You generate an array from the tree by marking nodes one by one. Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree. After that, until all nodes are marked, a node is equiprobably chosen and marked from the set of unmarked... | 2,300 | true | false | false | true | false | false | true | false | false | true | 2,941 |
39A | C*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an arithmetic expression in C*++ that looks like this (_expression_ is the main term): _expression_ :... | 2,000 | false | true | false | false | false | false | false | false | false | false | 9,800 |
294A | Shaass has decided to hunt some birds. There are _n_ horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to _n_ from top to bottom. On each wire there are some oskols sitting next to each other. Oskol is the name of a delicious kind of birds in Shaass's territory. Supposed there are _a__i_... | 800 | true | false | true | false | false | false | false | false | false | false | 8,656 |
1249B1 | The only difference between easy and hard versions is constraints. There are $$$n$$$ kids, each of them is reading a unique book. At the end of any day, the $$$i$$$-th kid will give his book to the $$$p_i$$$-th kid (in case of $$$i = p_i$$$ the kid will give his book to himself). It is guaranteed that all values of $$$... | 1,000 | true | false | false | false | false | false | false | false | false | false | 4,463 |
436F | All modern mobile applications are divided into free and paid. Even a single application developers often release two versions: a paid version without ads and a free version with ads. Suppose that a paid version of the app costs _p_ (_p_ is an integer) rubles, and the free version of the application contains _c_ ad ban... | 3,000 | false | false | false | true | true | false | true | false | false | false | 8,092 |
1482F | You are given a weighted undirected graph on $$$n$$$ vertices along with $$$q$$$ triples $$$(u, v, l)$$$, where in each triple $$$u$$$ and $$$v$$$ are vertices and $$$l$$$ is a positive integer. An edge $$$e$$$ is called useful if there is at least one triple $$$(u, v, l)$$$ and a path (not necessarily simple) with the... | 2,400 | false | false | false | false | false | false | false | false | false | true | 3,262 |
2032E | You are given a cyclic array $$$a$$$ with $$$n$$$ elements, where $$$n$$$ is odd. In each operation, you can do the following: Choose an index $$$1 le i le n$$$ and increase $$$a_{i - 1}$$$ by $$$1$$$, $$$a_i$$$ by $$$2$$$, and $$$a_{i + 1}$$$ by $$$1$$$. The element before the first element is the last element becaus... | 2,400 | true | true | true | false | true | true | false | false | false | false | 70 |
13A | Problem - 13A - Codeforces =============== xa0 . Output Output should contain required average value in format Β«X/YΒ», where X is the numerator and Y is the denominator. Examples Input 5 Output 7/3 Input 3 Output 2/1 Note In the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, ... | 1,000 | true | false | true | false | false | false | false | false | false | false | 9,930 |
1741A | Two T-shirt sizes are given: $$$a$$$ and $$$b$$$. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L. For example, strings M, XXL, S, XXXXXXXS could be the size of some T-shirts. And the strings XM, LL, SX are not sizes. The letter M sta... | 800 | false | false | true | false | false | false | false | false | false | false | 1,838 |
1530B | To celebrate your birthday you have prepared a festive table! Now you want to seat as many guests as possible. The table can be represented as a rectangle with height $$$h$$$ and width $$$w$$$, divided into $$$h imes w$$$ cells. Let $$$(i, j)$$$ denote the cell in the $$$i$$$-th row and the $$$j$$$-th column of the re... | 800 | false | false | true | false | false | true | false | false | false | false | 3,014 |
742B | There are some beautiful girls in Arpaβs land as mentioned before. Once Arpa came up with an obvious problem: Given an array and a number _x_, count the number of pairs of indices _i_,u2009_j_ (1u2009β€u2009_i_u2009<u2009_j_u2009β€u2009_n_) such that , where is bitwise xor operation (see notes for explanation). Immediate... | 1,500 | true | false | false | false | false | false | true | false | false | false | 6,830 |
377E | Kostya is playing the computer game Cookie Clicker. The goal of this game is to gather cookies. You can get cookies using different buildings: you can just click a special field on the screen and get the cookies for the clicks, you can buy a cookie factory, an alchemy lab, a time machine and it all will bring lots and ... | 2,800 | false | false | false | true | false | false | false | false | false | false | 8,320 |
599E | Rooted tree is a connected graph without any simple cycles with one vertex selected as a root. In this problem the vertex number 1 will always serve as a root. Lowest common ancestor of two vertices _u_ and _v_ is the farthest from the root vertex that lies on both the path from _u_ to the root and on path from _v_ to ... | 2,600 | false | false | false | true | false | false | false | false | false | false | 7,447 |
1606D | You are given a matrix, consisting of $$$n$$$ rows and $$$m$$$ columns. The $$$j$$$-th cell of the $$$i$$$-th row contains an integer $$$a_{ij}$$$. First, you have to color each row of the matrix either red or blue in such a way that at least one row is colored red and at least one row is colored blue. Then, you have t... | 2,400 | false | false | true | false | false | true | true | false | true | false | 2,626 |
1582D | Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number $$$0$$$, he threw away all numbers equal to $$$0$$$ from the array. As a result, he got an array $$$a$$$ of length $$$n$$$. Pupsen, on the contrary, likes the number $$$0$$$ and he got upset when he saw the array without zeroes. To che... | 1,600 | true | false | false | false | false | true | false | false | false | false | 2,722 |
5D | Problem - 5D - Codeforces =============== xa0 by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limiting the maximum speed. Traffic signs in Berland are a bit peculiar, because they limit the speed only at that point on the road where they are placed. Ri... | 2,100 | true | false | true | false | false | false | false | false | false | false | 9,967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.