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
1373F
# Network Coverage Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes The government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and n cities in a circle around the capital. The capital...
2,400
false
true
false
false
true
true
false
true
false
false
3,796
228A
Problem - 228A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
800
false
false
true
false
false
false
false
false
false
false
8,928
1208F
You are given an array $$$a$$$ of $$$n$$$ integers. You need to find the maximum value of $$$a_{i} ( a_{j} & a_{k} )$$$ over all triplets $$$(i,j,k)$$$ such that $$$i < j < k$$$. Here $$$&$$$ denotes the , the size of the array $$$a$$$. Next line contains $$$n$$$ space separated integers $$$a_1$$$, $$$a_2$$$, ..., $$$...
2,600
false
true
false
true
false
false
false
false
false
false
4,649
3C
Problem - 3C - Codeforces =============== xa0 . The player who succeeds first in placing three of his marks in a horizontal, vertical or diagonal line wins, and the game is finished. The player who draws crosses goes first. If the grid is filled, but neither Xs, nor 0s form the required line, a draw i...
1,800
false
false
true
false
false
false
true
false
false
false
9,976
1657E
Problem - 1657E - 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
true
false
false
false
false
false
false
2,341
1162A
You are planning to build housing on a street. There are $$$n$$$ spots available on the street on which you can build a house. The spots are labeled from $$$1$$$ to $$$n$$$ from left to right. In each spot, you can build a house with an integer height between $$$0$$$ and $$$h$$$. In each spot, if a house has height $$$...
800
false
false
true
false
false
false
false
false
false
false
4,906
816A
Karen is getting ready for a new school day! It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindr...
1,000
false
false
true
false
false
false
true
false
false
false
6,495
1348A
Phoenix has $$$n$$$ coins with weights $$$2^1, 2^2, dots, 2^n$$$. He knows that $$$n$$$ is even. He wants to split the coins into two piles such that each pile has exactly $$$frac{n}{2}$$$ coins and the difference of weights between the two piles is minimized. Formally, let $$$a$$$ denote the sum of weights in the firs...
800
true
true
false
false
false
false
false
false
false
false
3,970
1872F
You are the owner of a menagerie consisting of $$$n$$$ animals numbered from $$$1$$$ to $$$n$$$. However, maintaining the menagerie is quite expensive, so you have decided to sell it! It is known that each animal is afraid of exactly one other animal. More precisely, animal $$$i$$$ is afraid of animal $$$a_i$$$ ($$$a_i...
1,800
true
false
true
false
false
false
false
false
false
true
1,046
431C
Problem - 431C - 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
false
false
true
true
false
false
false
false
false
false
8,117
1919A
Alice and Bob are bored, so they decide to play a game with their wallets. Alice has $$$a$$$ coins in her wallet, while Bob has $$$b$$$ coins in his wallet. Both players take turns playing, with Alice making the first move. In each turn, the player will perform the following steps in order: 1. Choose to exchange wallet...
800
true
false
false
false
false
false
false
false
false
false
781
118E
Bertown has _n_ junctions and _m_ bidirectional roads. We know that one can get from any junction to any other one by the existing roads. As there were more and more cars in the city, traffic jams started to pose real problems. To deal with them the government decided to make the traffic one-directional on all the road...
2,000
false
false
false
false
false
false
false
false
false
true
9,412
1305E
Kuroni is the coordinator of the next Mathforces round written by the "Proof by AC" team. All the preparation has been done, and he is discussing with the team about the score distribution for the round. The round consists of $$$n$$$ problems, numbered from $$$1$$$ to $$$n$$$. The problems are ordered in increasing ord...
2,200
true
true
true
false
false
true
false
false
false
false
4,160
1535E
You are given a rooted tree. Each vertex contains $$$a_i$$$ tons of gold, which costs $$$c_i$$$ per one ton. Initially, the tree consists only a root numbered $$$0$$$ with $$$a_0$$$ tons of gold and price $$$c_0$$$ per ton. There are $$$q$$$ queries. Each query has one of two types: 1. Add vertex $$$i$$$ (where $$$i$$$...
2,200
false
true
false
true
true
false
false
true
false
false
2,970
1582B
Luntik came out for a morning stroll and found an array $$$a$$$ of length $$$n$$$. He calculated the sum $$$s$$$ of the elements of the array ($$$s= sum_{i=1}^{n} a_i$$$). Luntik calls a subsequence of the array $$$a$$$ nearly full if the sum of the numbers in that subsequence is equal to $$$s-1$$$. Luntik really wants...
900
true
false
false
false
false
false
false
false
false
false
2,724
1277A
Hooray! Polycarp turned $$$n$$$ years old! The Technocup Team sincerely congratulates Polycarp! Polycarp celebrated all of his $$$n$$$ birthdays: from the $$$1$$$-th to the $$$n$$$-th. At the moment, he is wondering: how many times he turned beautiful number of years? According to Polycarp, a positive integer is beauti...
1,000
false
false
true
false
false
false
false
false
false
false
4,309
2038C
You are given a list of $$$n$$$ integers $$$a_1, a_2, dots, a_n$$$. You need to pick $$$8$$$ elements from the list and use them as coordinates of four points. These four points should be corners of a rectangle which has its sides parallel to the coordinate axes. Your task is to pick coordinates in such a way that the ...
1,400
false
true
false
false
true
false
false
false
true
false
36
174B
Eudokimus, a system administrator is in trouble again. As a result of an error in some script, a list of names of very important files has been damaged. Since they were files in the BerFS file system, it is known that each file name has a form "name.ext", where: name is a string consisting of lowercase Latin letters, ...
1,400
false
true
true
true
false
false
false
false
false
false
9,167
316B2
In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to another. (Cultural note: standing in huge and disorganized queues for hours is a native t...
1,600
false
false
false
true
false
false
false
false
false
false
8,580
1267H
Very soon, the new cell phone services provider "BerLine" will begin its work in Berland! The start of customer service is planned along the main street of the capital. There are $$$n$$$xa0base stations that are already installed. They are located one after another along the main street in the order from thexa0$$$1$$$-...
3,200
false
false
false
false
false
true
false
false
false
false
4,356
259A
The Little Elephant loves chess very much. One day the Little Elephant and his friend decided to play chess. They've got the chess pieces but the board is a problem. They've got an 8u2009×u20098 checkered board, each square is painted either black or white. The Little Elephant and his friend know that a proper chessboa...
1,000
false
false
false
false
false
false
true
false
false
false
8,797
1747D
You are given an array $$$a$$$ of $$$n$$$ integers $$$a_1, a_2, a_3, ldots, a_n$$$. You have to answer $$$q$$$ independent queries, each consisting of two integers $$$l$$$ and $$$r$$$. Consider the subarray $$$a$$$ xa0— the length of the array $$$a$$$ and the number of queries. The next line contains $$$n$$$ integers ...
1,900
false
false
false
false
true
true
false
true
false
false
1,799
1537D
Alice and Bob are playing a game. They start with a positive integer $$$n$$$ and take alternating turns doing operations on it. Each turn a player can subtract from $$$n$$$ one of its divisors that isn't $$$1$$$ or $$$n$$$. The player who cannot make a move on his/her turn loses. Alice always moves first. Note that the...
1,700
true
false
false
false
false
false
false
false
false
false
2,959
1654G
There are $$$n$$$ locations on a snowy mountain range (numbered from $$$1$$$ to $$$n$$$), connected by $$$n-1$$$ trails in the shape of a tree. Each trail has length $$$1$$$. Some of the locations are base lodges. The height $$$h_i$$$ of each location is equal to the distance to the nearest base lodge (a base lodge has...
2,900
false
true
false
false
true
false
false
false
false
true
2,356
1336F
In the wilds far beyond lies the Land of Sacredness, which can be viewed as a tree xa0— connected undirected graph consisting of $$$n$$$ nodes and $$$n-1$$$ edges. The nodes are numbered from $$$1$$$ to $$$n$$$. There are $$$m$$$ travelers attracted by its prosperity and beauty. Thereupon, they set off their journey on...
3,500
false
false
false
false
true
false
false
false
false
true
4,017
1313C1
This is an easier version of the problem. In this version $$$n le 1000$$$ The outskirts of the capital are being actively built up in Berland. The company "Kernel Panic" manages the construction of a residential complex of skyscrapers in New Berlskva. All skyscrapers are built along the highway. It is known that the co...
1,500
false
true
false
true
true
false
true
false
false
false
4,128
401E
2,500
true
false
false
false
false
false
false
false
false
false
8,218
264A
Problem - 264A - 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
true
true
false
false
false
false
8,778
946A
Problem - 946A - 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
true
false
false
false
false
false
false
false
false
5,932
208B
A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules: A deck of _n_ cards is carefully shuffled, then all _n_ cards are put on the table in a line from left to right; Before each move the table has several piles of cards lying in a...
1,900
false
false
false
true
false
false
false
false
false
false
9,000
1338D
You have a tree of $$$n$$$ vertices. You are going to convert this tree into $$$n$$$ rubber bands on infinitely large plane. Conversion rule follows: For every pair of vertices $$$a$$$ and $$$b$$$, rubber bands $$$a$$$ and $$$b$$$ should intersect if and only if there is an edge exists between $$$a$$$ and $$$b$$$ in t...
2,700
true
false
false
true
false
true
false
false
false
false
4,011
643F
There are _n_ bears in the inn and _p_ places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don't like wine but they can't distinguish it from juice by taste or smell. A bear doesn't sleep unless he drinks wine. A bear must go to sleep a few hours after drinki...
2,900
true
false
false
true
false
false
false
false
false
false
7,239
1450H1
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, ...
2,900
true
false
false
false
false
false
false
false
false
false
3,430
724B
You are given a table consisting of _n_ rows and _m_ columns. Numbers in each row form a permutation of integers from 1 to _m_. You are allowed to pick two elements in one row and swap them, but no more than once for each row. Also, no more than once you are allowed to pick two columns and swap them. Thus, you are allo...
1,500
true
true
true
false
false
false
true
false
false
false
6,913
424C
Problem - 424C - 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,141
1304D
Gildong recently learned how to find the in $$$O(nlog{n})$$$ time for a sequence of length $$$n$$$. He wants to test himself if he can implement it correctly, but he couldn't find any online judges that would do it (even though there are actually many of them). So instead he's going to make a quiz for you about making ...
1,800
false
true
false
false
false
true
false
false
false
true
4,168
1638B
You are given an array $$$a_1, a_2, dots, a_n$$$. You can perform operations on the array. In each operation you can choose an integer $$$i$$$ ($$$1 le i < n$$$), and swap elements $$$a_i$$$ and $$$a_{i+1}$$$ of the array, if $$$a_i + a_{i+1}$$$ is odd. Determine whether it can be sorted in non-decreasing order using t...
1,100
true
false
false
false
true
false
false
false
true
false
2,425
916A
Jamie loves sleeping. One day, he decides that he needs to wake up at exactly _hh_:u2009_mm_. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will then press the snooze button every _x_ minutes until _hh_:u2009_mm_ is reached, and only then he will wake u...
900
true
false
true
false
false
false
true
false
false
false
6,068
1797E
Li Hua wants to solve a problem about $$$varphi$$$xa0— Euler's totient function. Please recall that $$$varphi(x)=sumlimits_{i=1}^xxa0— the number of elements in the array and the number of operations to process, respectively. The second line contains $$$n$$$ integers $$$a_{1},a_{2},cdots ,a_{n}$$$ ($$$1le a_{i}le 5cdot...
2,300
true
false
false
false
true
false
true
false
false
false
1,492
1916C
Masha and Olya have an important team olympiad coming up soon. In honor of this, Masha, for warm-up, suggested playing a game with Olya: There is an array $$$a$$$ of size $$$n$$$. Masha goes first, and the players take turns. Each move is described by the following sequence of actions: $$$bullet$$$ If the size of the a...
1,200
true
true
true
false
false
true
false
false
false
false
801
1216E1
The only difference between the easy and the hard versions is the maximum value of $$$k$$$. You are given an infinite sequence of form "112123123412345$$$dots$$$" which consist of blocks of all consecutive positive integers written one after another. The first block consists of all numbers from $$$1$$$ to $$$1$$$, the ...
1,900
true
false
false
false
false
false
true
true
false
false
4,593
30C
One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize — big pink plush panda. The king is not good at shooting, so he invited you to help him. The shooting gallery is an infinite vertical plane with Cartesian coordinate system on it. The targe...
1,800
false
false
false
true
false
false
false
false
false
false
9,846
811A
Problem - 811A - 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
true
false
false
false
6,521
558E
Problem - 558E - 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,300
false
false
false
false
true
false
false
false
true
false
7,599
1320C
Roma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind. Roma has a choice to buy exactly one of $$$n$$$ different weapons and exactly one of $$$m$$$ different armor sets. Weapon $$$i$$$ has attack modifier $$$a_i$$$ and is worth $$$ca_i$$$ coins...
2,000
false
false
false
false
true
false
true
false
true
false
4,113
420C
Recently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the _n_ coders on the meeting said: 'I know for sure that either _x_ or _y_ did it!' The head of the comp...
1,900
false
false
true
false
true
false
false
false
false
true
8,148
630J
Problem - 630J - Codeforces =============== xa0 ]( "Experimental Educational Round: VolBIT Formulas Blitz") — the prediction on the number of people who will buy the game. Output Output one integer showing how many numbers from 1 to _n_ are divisible by all numbers from 2 to 10. Examples Input ...
1,100
true
false
false
false
false
false
false
false
false
false
7,295
986C
Problem - 986C - 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,500
false
false
false
false
false
false
false
false
false
true
5,770
911G
Problem - 911G - 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,500
false
false
false
false
true
false
false
false
false
false
6,097
1926D
Vladislav has $$$n$$$ non-negative integers, and he wants to divide all of them into several groups so that in any group, any pair of numbers does not have matching bit values among bits from $$$1$$$-st to $$$31$$$-st bit (i.e., considering the $$$31$$$ least significant bits of the binary representation). For an integ...
1,300
false
true
false
false
false
false
false
false
false
false
734
859B
Problem - 859B - Codeforces =============== xa0 ]( "Announcing MemSQL Start , the number of city blocks that must be enclosed by the route. Output Print the minimum perimeter that can be achieved. Examples Input 4 Output 8 Input 11 Output 14 Input 22 Output 20 Note Here are some possible shapes for the e...
1,000
true
false
false
false
false
false
true
false
false
false
6,307
906C
Arseny likes to organize parties and invite people to it. However, not only friends come to his parties, but friends of his friends, friends of friends of his friends and so on. That's why some of Arseny's guests can be unknown to him. He decided to fix this issue using the following procedure. At each step he selects ...
2,400
false
false
false
true
false
false
true
false
false
true
6,125
1322E
Berlandxa0— is a huge country with diverse geography. One of the most famous natural attractions of Berland is the "Median mountain range". This mountain range is $$$n$$$ mountain peaks, located on one straight line and numbered in order of $$$1$$$ to $$$n$$$. The height of the $$$i$$$-th mountain top is $$$a_i$$$. "Me...
3,300
false
false
false
false
true
false
false
false
false
false
4,103
1728G
Consider a segment $$$[0, d]$$$ of the coordinate line. There are $$$n$$$ lanterns and $$$m$$$ points of interest in this segment. For each lantern, you can choose its power — an integer between $$$0$$$ and $$$d$$$ (inclusive). A lantern with coordinate $$$x$$$ illuminates the point of interest with coordinate $$$y$$$ ...
2,700
true
false
false
true
false
false
true
true
false
false
1,919
574A
Limak is a grizzly bear who desires power and adoration. He wants to win in upcoming elections and rule over the Bearland. There are _n_ candidates, including Limak. We know how many citizens are going to vote for each candidate. Now _i_-th candidate would get _a__i_ votes. Limak is candidate number 1. To win in electi...
1,200
false
true
true
false
false
false
false
false
false
false
7,554
34D
There are _n_ cities in Berland. Each city has its index — an integer number from 1 to _n_. The capital has index _r_1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital to each city, i.e. the road map looks like a tree. In Berland's chronicles the road map is...
1,600
false
false
false
false
false
false
false
false
false
true
9,825
177A1
Problem - 177A1 - Codeforces =============== xa0 separated by single spaces — the elements of the given matrix. The input limitations for getting 30 points are: 1u2009≤u2009_n_u2009≤u20095 The input limitations for getting 100 points are: 1u2009≤u2009_n_u2009≤u2009101 Output Print a single integer — the...
800
false
false
true
false
false
false
false
false
false
false
9,154
1141A
Problem - 1141A - 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,000
true
false
true
false
false
false
false
false
false
false
5,021
817B
Problem - 817B - Codeforces =============== xa0 (_i_u2009<u2009_j_u2009<u2009_k_), such that _a__i_·_a__j_·_a__k_ is minimum possible, are there in the array? Help him with it! Input The first line of input contains a positive integer number _n_xa0(3u2009≤u2009_n_u2009≤u2009105) — the number of elements i...
1,500
true
false
true
false
false
false
false
false
true
false
6,492
1676H2
The only difference between the two versions is that in this version $$$n leq 2 cdot 10^5$$$ and the sum of $$$n$$$ over all test cases does not exceed $$$2 cdot 10^5$$$. A terminal is a row of $$$n$$$ equal segments numbered $$$1$$$ to $$$n$$$ in order. There are two terminals, one above the other. You are given an ar...
1,500
false
false
false
false
true
false
false
false
true
false
2,207
741B
Just to remind, girls in Arpa's land are really nice. Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight _w__i_ and some beauty _b__i_. Also each Hos may have some friends. Hoses are divided in some friendship groups. Two Hoses _x_ and _y_ are in the same friendship group if ...
1,600
false
false
false
true
false
false
false
false
false
false
6,835
1753B
You are given an integer $$$x$$$ and an array of integers $$$a_1, a_2, ldots, a_n$$$. You have to determine if the number $$$a_1! + a_2! + ldots + a_n!$$$ is divisible by $$$x!$$$. Here $$$k!$$$ is a factorial of $$$k$$$xa0— the product of all positive integers less than or equal to $$$k$$$. For example, $$$3! = 1 cdot...
1,600
true
false
false
false
false
false
false
false
false
false
1,775
1676H1
The only difference between the two versions is that in this version $$$n leq 1000$$$ and the sum of $$$n$$$ over all test cases does not exceed $$$1000$$$. A terminal is a row of $$$n$$$ equal segments numbered $$$1$$$ to $$$n$$$ in order. There are two terminals, one above the other. You are given an array $$$a$$$ of...
1,400
false
false
false
false
false
false
true
false
false
false
2,208
1228A
Problem - 1228A - 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
true
false
false
false
4,535
888C
Problem - 888C - Codeforces =============== xa0 . Output Print one number — the minimum value of _k_ such that there exists at least one _k_-dominant character. Examples Input abacaba Output 2 Input zzzzz Output 1 Input abcde Output 3
1,400
false
false
true
false
false
false
false
true
false
false
6,194
1774A
Problem - 1774A - 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
true
false
false
false
false
1,644
766B
Problem - 766B - 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
true
false
false
true
false
6,722
1427B
You like playing chess tournaments online. In your last tournament you played $$$n$$$ games. For the sake of this problem, each chess game is either won or lost (no draws). When you lose a game you get $$$0$$$ points. When you win you get $$$1$$$ or $$$2$$$ points: if you have won also the previous game you get $$$2$$$...
1,400
false
true
true
false
false
false
false
false
true
false
3,532
830A
There are _n_ people and _k_ keys on a straight line. Every person wants to get to the office which is located on the line as well. To do that, he needs to reach some point with a key, take the key and then go to the office. Once a key is taken by somebody, it couldn't be taken by anybody else. You are to determine the...
1,800
false
true
false
true
false
false
true
true
true
false
6,447
1985D
Given a $$$n$$$ by $$$m$$$ grid consisting of '.' and '#' characters, there exists a whole manhattan circle on the grid. The top left corner of the grid has coordinates $$$(1,1)$$$, and the bottom right corner has coordinates $$$(n, m)$$$. Point ($$$a, b$$$) belongs to the manhattan circle centered at ($$$h, k$$$) if $...
900
true
false
true
false
false
false
false
false
false
false
371
1015D
There are $$$n$$$ houses in a row. They are numbered from $$$1$$$ to $$$n$$$ in order from left to right. Initially you are in the house $$$1$$$. You have to perform $$$k$$$ moves to other house. In one move you go from your current house to some other house. You can't stay where you are (i.e., in each move the new hou...
1,600
false
true
false
false
false
true
false
false
false
false
5,616
1788B
The sum of digits of a non-negative integer $$$a$$$ is the result of summing up its digits together when written in the decimal system. For example, the sum of digits of $$$123$$$ is $$$6$$$ and the sum of digits of $$$10$$$ is $$$1$$$. In a formal way, the sum of digits of $$$displaystyle a=sum_{i=0}^{infty} a_i cdot ...
1,100
true
true
true
false
false
true
false
false
false
false
1,553
757E
Problem - 757E - 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,500
false
false
false
true
false
false
true
false
false
false
6,760
128E
Anna's got a birthday today. She invited many guests and cooked a huge (nearly infinite) birthday cake decorated by _n_ banana circles of different sizes. Maria's birthday is about to start in 7 minutes too, and while Anna is older, she decided to play the boss a little. She told Maria to cut the cake by _k_ straight-l...
2,900
true
false
false
false
false
false
false
false
false
false
9,366
1451E2
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,300
true
false
false
false
false
true
false
false
false
false
3,423
520C
Vasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences. Let's assume that strings _s_ and _t_ have the same length _n_, then the function _h_(_s_,u2009_t_) is defined as the number of po...
1,500
true
false
false
false
false
false
false
false
false
false
7,755
1025G
There are $$$n$$$ startups. Startups can be active or acquired. If a startup is acquired, then that means it has exactly one active startup that it is following. An active startup can have arbitrarily many acquired startups that are following it. An active startup cannot follow any other startup. The following steps ha...
3,200
true
false
false
false
false
true
false
false
false
false
5,577
600C
Problem - 600C - Codeforces =============== xa0 ]( "21794") smallest palindrome. So firstly you should minimize the number of changes and then minimize the palindrome lexicographically. Input The only line contains string _s_ (1u2009≤u2009_s_u2009≤u20092·105) consisting of only lowercase Latin letters. Out...
1,800
false
true
false
false
false
true
false
false
false
false
7,444
1738H
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Global Round 22 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 yo...
3,300
false
false
false
false
true
false
false
false
false
false
1,854
678F
Lena is a programmer. She got a task to solve at work. There is an empty set of pairs of integers and _n_ queries to process. Each query is one of three types: 1. Add a pair (_a_,u2009_b_) to the set. 2. Remove a pair added in the query number _i_. All queries are numbered with integers from 1 to _n_. 3. For a given in...
2,500
false
false
false
false
true
false
false
false
false
false
7,111
762F
You are given two trees (connected undirected acyclic graphs) _S_ and _T_. Count the number of subtrees (connected subgraphs) of _S_ that are isomorphic to tree _T_. Since this number can get quite large, output it modulo 109u2009+u20097. Two subtrees of tree _S_ are considered different, if there exists a vertex in _S...
2,800
false
false
false
false
false
false
false
false
false
true
6,738
1735F
There are two currencies: pebbles and beads. Initially you have $$$a$$$ pebbles, $$$b$$$ beads. There are $$$n$$$ days, each day you can exchange one currency for another at some exchange rate. On day $$$i$$$, you can exchange $$$-p_i leq x leq p_i$$$ pebbles for $$$-q_i leq y leq q_i$$$ beads or vice versa. It's allow...
2,900
false
false
false
false
true
false
false
false
false
false
1,875
1835E
During the latest mission of the starship U.S.S. Coder, Captain Jan Bitovsky was accidentally teleported to the surface of an unknown planet. Trying to find his way back, Jan found an artifact from planet Earth's ancient civilization — a mobile device capable of interstellar calls created by Byterola. Unfortunately, th...
3,500
false
false
false
true
false
false
false
false
false
false
1,274
1716E
You are given an array of length $$$2^n$$$. The elements of the array are numbered from $$$1$$$ to $$$2^n$$$. You have to process $$$q$$$ queries to this array. In the $$$i$$$-th query, you will be given an integer $$$k$$$ ($$$0 le k le n-1$$$). To process the query, you should do the following: for every $$$i in [1, ...
2,500
false
false
false
true
true
false
false
false
false
false
1,983
1559C
The city where Mocha lives in is called Zhijiang. There are $$$n+1$$$ villages and $$$2n-1$$$ directed roads in this city. There are two kinds of roads: $$$n-1$$$ roads are from village $$$i$$$ to village $$$i+1$$$, for all $$$1leq i leq n-1$$$. $$$n$$$ roads can be described by a sequence $$$a_1,ldots,a_n$$$. If $$$...
1,200
false
false
false
false
false
true
false
false
false
true
2,834
1462F
Polycarp found $$$n$$$ segments on the street. A segment with the index $$$i$$$ is described by two integers $$$l_i$$$ and $$$r_i$$$xa0— coordinates of the beginning and end of the segment, respectively. Polycarp realized that he didn't need all the segments, so he wanted to delete some of them. Polycarp believes that ...
1,800
false
true
false
false
true
false
false
true
false
false
3,374
1692H
Marian is at a casino. The game at the casino works like this. Before each round, the player selects a number between $$$1$$$ and $$$10^9$$$. After that, a dice with $$$10^9$$$ faces is rolled so that a random number between $$$1$$$ and $$$10^9$$$ appears. If the player guesses the number correctly their total money is...
1,700
true
true
false
true
true
false
false
false
false
false
2,123
1695D1
The only difference between this problem and D2 is the bound on the size of the tree. You are given an unrooted tree with $$$n$$$ vertices. There is some hidden vertex $$$x$$$ in that tree that you are trying to find. To do this, you may ask $$$k$$$ queries $$$v_1, v_2, ldots, v_k$$$ where the $$$v_i$$$ are vertices in...
2,200
false
true
false
true
false
true
true
false
false
false
2,111
607A
There are _n_ beacons located at distinct positions on a number line. The _i_-th beacon has position _a__i_ and power level _b__i_. When the _i_-th beacon is activated, it destroys all beacons to its left (direction of decreasing coordinates) within distance _b__i_ inclusive. The beacon itself is not destroyed however....
1,600
false
false
false
true
false
false
false
true
false
false
7,419
1305H
As a professional private tutor, Kuroni has to gather statistics of an exam. Kuroni has appointed you to complete this important task. You must not disappoint him. The exam consists of $$$n$$$ questions, and $$$m$$$ students have taken the exam. Each question was worth $$$1$$$ point. Question $$$i$$$ was solved by at l...
3,500
false
true
false
false
false
false
false
true
false
false
4,157
1447A
There are $$$n$$$ bags with candies, initially the $$$i$$$-th bag contains $$$i$$$ candies. You want all the bags to contain an equal amount of candies in the end. To achieve this, you will: Choose $$$m$$$ such that $$$1 le m le 1000$$$ Perform $$$m$$$ operations. In the $$$j$$$-th operation, you will pick one bag ...
800
true
false
false
false
false
true
false
false
false
false
3,440
1187A
Your favorite shop sells $$$n$$$ Kinder Surprise chocolate eggs. You know that exactly $$$s$$$ stickers and exactly $$$t$$$ toys are placed in $$$n$$$ eggs in total. Each Kinder Surprise can be one of three types: it can contain a single sticker and no toy; it can contain a single toy and no sticker; it can contain ...
900
true
false
false
false
false
false
false
false
false
false
4,766
1114C
The number "zero" is called "love" (or "l'oeuf" to be precise, literally means "egg" in French), for example when denoting the zero score in a game of tennis. Aki is fond of numbers, especially those with trailing zeros. For example, the number $$$9200$$$ has two trailing zeros. Aki thinks the more trailing zero digits...
1,700
true
false
true
false
false
false
true
false
false
false
5,132
1681A
Alice and Bob play a game. Alice has $$$n$$$ cards, the $$$i$$$-th of them has the integer $$$a_i$$$ written on it. Bob has $$$m$$$ cards, the $$$j$$$-th of them has the integer $$$b_j$$$ written on it. On the first turn of the game, the first player chooses one of his/her cards and puts it on the table (plays it). On ...
800
false
true
false
false
false
false
false
false
false
false
2,185
1979E
The Manhattan distance between two points $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ is defined as: $$$$$$x_1 - x_2 + y_1 - y_2.$$$$$$ We call a Manhattan triangle three points on the plane, the Manhattan distances between each pair of which are equal. You are given a set of pairwise distinct points and an even integer $$$d...
2,400
false
false
true
false
true
true
false
true
false
false
412
1538A
Polycarp is playing a new computer game. This game has $$$n$$$ stones in a row. The stone on the position $$$i$$$ has integer power $$$a_i$$$. The powers of all stones are distinct. Each turn Polycarp can destroy either stone on the first position or stone on the last position (in other words, either the leftmost or th...
800
false
true
false
true
false
false
true
false
false
false
2,955
849B
Problem - 849B - 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
false
false
false
false
false
false
true
false
false
false
6,352
5C
Problem - 5C - Codeforces =============== xa0 )()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not. You are given a string of «(» and «)» characters. You are to find its longest substring that is a regular bracket sequence. You are to find the number of such substrings as well...
1,900
false
true
false
true
true
true
false
false
true
false
9,968
1266D
There are $$$n$$$ people in this world, conveniently numbered $$$1$$$ through $$$n$$$. They are using burles to buy goods and services. Occasionally, a person might not have enough currency to buy what he wants or needs, so he borrows money from someone else, with the idea that he will repay the loan later with interes...
2,000
true
true
true
false
true
true
false
false
false
true
4,368
554B
Ohana Matsumae is trying to clean a room, which is divided up into an _n_ by _n_ grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom is very strange: if she sweeps over a clean square, it will become dirty, and if she sweeps over a dirty square,...
1,200
false
true
false
false
false
false
true
false
false
false
7,616