task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: 1-2-3 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ilya is working for the company that constructs robots. Ilya writes programs for entertainment robots, and his current project is "Bob", a new-generation game robot. Ilya's boss wants to know his progress so far. Especially he is...
4,000
Title: Buy a Ticket Time Limit: None seconds Memory Limit: None megabytes Problem Description: Musicians of a popular band "Flayer" have announced that they are going to "make their exit" with a world tour. Of course, they will visit Berland as well. There are *n* cities in Berland. People can travel between cities...
4,001
Title: Tic-tac-toe Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Certainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3<=×<=3 grid (one player always draws crosses, the other — noughts). The player who succeeds ...
4,002
Title: A Trance of Nightfall Time Limit: None seconds Memory Limit: None megabytes Problem Description: "Flowing and passing like this, the water isn't gone ultimately; Waxing and waning like that, the moon doesn't shrink or grow eventually." "Everything is transient in a way and perennial in another." Kanno doesn...
4,003
Title: Where do I Turn? Time Limit: None seconds Memory Limit: None megabytes Problem Description: Trouble came from the overseas lands: a three-headed dragon Gorynych arrived. The dragon settled at point *C* and began to terrorize the residents of the surrounding villages. A brave hero decided to put an end to the...
4,004
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jeff loves regular bracket sequences. Today Jeff is going to take a piece of paper and write out the regular bracket sequence, consisting of *nm* brackets. Let's number all brackets of this sequence from 0 to *nm* - 1 from left t...
4,005
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Три брата договорились о встрече. Пронумеруем братьев следующим образом: пусть старший брат имеет номер 1, средний брат имеет номер 2, а младший брат — номер 3. Когда пришло время встречи, один из братьев опоздал. По заданным но...
4,006
Title: Prime Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got an *n*<=×<=*m* matrix. The matrix consists of integers. In one move, you can apply a single transformation to the matrix: choose an arbitrary element of the matrix and increase it by 1. Each element can be incre...
4,007
Title: Maximize! Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a multiset *S* consisting of positive integers (initially empty). There are two kind of queries: 1. Add a positive integer to *S*, the newly added integer is not less than any number in it. 1. Find a subset ...
4,008
Title: Om Nom and Necklace Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Om Nom found a thread with *n* beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly. Om Nom knows that his ...
4,009
Title: Annoying Present Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alice got an array of length $n$ as a birthday present once again! This is the third year in a row! And what is more disappointing, it is overwhelmengly boring, filled entirely with zeros. Bob decided to apply some c...
4,010
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hieroglyphs. We know that no hieroglyph occurs twice in either the first or the second ...
4,011
Title: Forming Teams Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day *n* students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people. We know that this group of people has archenemies. Each stu...
4,012
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are less than 60 years left till the 900-th birthday anniversary of a famous Italian mathematician Leonardo Fibonacci. Of course, such important anniversary needs much preparations. Dima is sure that it'll be great to learn...
4,013
Title: Design Tutorial: Increase the Constraints Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a simple way to create hard tasks: take one simple problem as the query, and try to find an algorithm that can solve it faster than bruteforce. This kind of tasks usually appears in OI...
4,014
Title: Cyclic Cipher Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* sequences. Each sequence consists of positive integers, not exceeding *m*. All integers in one sequence are distinct, but the same integer may appear in multiple sequences. The length of the *i*-th seque...
4,015
Title: Blocked Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points *A* and *B* on the plane are 4-connected if and only if: - the Eu...
4,016
Title: Tetrahedron Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tetrahedron. Let's mark its vertices with letters *A*, *B*, *C* and *D* correspondingly. An ant is standing in the vertex *D* of the tetrahedron. The ant is quite active and he wouldn't stay idle. At each m...
4,017
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maxim has opened his own restaurant! The restaurant has got a huge table, the table's length is *p* meters. Maxim has got a dinner party tonight, *n* guests will come to him. Let's index the guests of Maxim's restaurant from 1 to...
4,018
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect. The interior of the square is considered to be pa...
4,019
Title: Leha and Function Time Limit: None seconds Memory Limit: None megabytes Problem Description: Leha like all kinds of strange things. Recently he liked the function *F*(*n*,<=*k*). Consider all possible *k*-element subsets of the set [1,<=2,<=...,<=*n*]. For subset find minimal element in it. *F*(*n*,<=*k*) — m...
4,020
Title: Taymyr is calling you Time Limit: None seconds Memory Limit: None megabytes Problem Description: Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist. Ilia-alpinist calls every *n* minutes, i.e. in minutes *n*, 2*n*, 3*n* and so on. Artists com...
4,021
Title: Nastya and a Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nastya received one more array on her birthday, this array can be used to play a traditional Byteland game on it. However, to play the game the players should first select such a subsegment of the array that , where *...
4,022
Title: Fake News (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: As it's the first of April, Heidi is suspecting that the news she reads today are fake, and she does not want to look silly in front of all the contestants. She knows that a newspiece is fake if it contains heidi as a ...
4,023
Title: Destroying Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: In some country there are exactly *n* cities and *m* bidirectional roads connecting the cities. Cities are numbered with integers from 1 to *n*. If cities *a* and *b* are connected by a road, then in an hour you can go...
4,024
Title: Math, math everywhere Time Limit: None seconds Memory Limit: None megabytes Problem Description: If you have gone that far, you'll probably skip unnecessary legends anyway... You are given a binary string and an integer . Find the number of integers *k*, 0<=≤<=*k*<=&lt;<=*N*, such that for all *i*<==<=0, 1,...
4,025
Title: Ivan and Powers of Two Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan has got an array of *n* non-negative integers *a*1,<=*a*2,<=...,<=*a**n*. Ivan knows that the array is sorted in the non-decreasing order. Ivan wrote out integers 2*a*1,<=2*a*2,<=...,<=2*a**n* on a piece o...
4,026
Title: Fixing Typos Time Limit: None seconds Memory Limit: None megabytes Problem Description: Many modern text editors automatically check the spelling of the user's text. Some editors even suggest how to correct typos. In this problem your task to implement a small functionality to correct two types of typos in a...
4,027
Title: Commentator problem Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: The Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a running commentary. Today...
4,028
Title: Fence Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a fence in front of Polycarpus's home. The fence consists of *n* planks of the same width which go one after another from left to right. The height of the *i*-th plank is *h**i* meters, distinct planks can have distinct ...
4,029
Title: Campus Time Limit: None seconds Memory Limit: None megabytes Problem Description: Oscolcovo city has a campus consisting of *n* student dormitories, *n* universities and *n* military offices. Initially, the *i*-th dormitory belongs to the *i*-th university and is assigned to the *i*-th military office. Life ...
4,030
Title: Rats Time Limit: None seconds Memory Limit: None megabytes Problem Description: Rats have bred to hundreds and hundreds in the basement of the store, owned by Vasily Petrovich. Vasily Petrovich may have not noticed their presence, but they got into the habit of sneaking into the warehouse and stealing food fr...
4,031
Title: Building Bridge Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two villages are separated by a river that flows from the north to the south. The villagers want to build a bridge across the river to make it easier to move across the villages. The river banks can be assumed to be ve...
4,032
Title: Abbreviation Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a text consisting of $n$ space-separated words. There is exactly one space character between any pair of adjacent words. There are no spaces before the first word and no spaces after the last word. The length...
4,033
Title: Little Pony and Harmony Chest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony. A sequence of positive integers *b**i* is harmony if and only if for every two elements of the ...
4,034
Title: Bear and Different Names Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an orde...
4,035
Title: Burglar and Matches Time Limit: 0 seconds Memory Limit: 64 megabytes Problem Description: A burglar got into a matches warehouse and wants to steal as many matches as possible. In the warehouse there are *m* containers, in the *i*-th container there are *a**i* matchboxes, and each matchbox contains *b**i* mat...
4,036
Title: General Mobilization Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The Berland Kingdom is a set of *n* cities connected with each other with *n*<=-<=1 railways. Each road connects exactly two different cities. The capital is located in city 1. For each city there is a way to get from ...
4,037
Title: Bear and Compressing Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little polar bear. Polar bears hate long strings and thus they like to compress them. You should also know that Limak is so young that he knows only first six letters of the English alphabet: 'a', 'b', '...
4,038
Title: Maximum Xor Secondary Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers *x*1,<=*x*2,<=...,<=*x**k* (*k*<=&gt;<=1) is such maximum element *x**j*, that the ...
4,039
Title: Dima and Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima got into number sequences. Now he's got sequence *a*1,<=*a*2,<=...,<=*a**n*, consisting of *n* positive integers. Also, Dima has got a function *f*(*x*), which can be defined with the following recurrence: - *f...
4,040
Title: Compote Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nikolay has *a* lemons, *b* apples and *c* pears. He decided to cook a compote. According to the recipe the fruits should be in the ratio 1:<=2:<=4. It means that for each lemon in the compote should be exactly 2 apples and exa...
4,041
Title: Summarize to the Power of Two Time Limit: None seconds Memory Limit: None megabytes Problem Description: A sequence $a_1, a_2, \dots, a_n$ is called good if, for each element $a_i$, there exists an element $a_j$ ($i \ne j$) such that $a_i+a_j$ is a power of two (that is, $2^d$ for some non-negative integer $d...
4,042
Title: Choose Place Time Limit: None seconds Memory Limit: None megabytes Problem Description: A classroom in a school has six rows with 3 desks in each row. Two people can use the same desk: one sitting on the left and one sitting on the right. Some places are already occupied, and some places are vacant. Petya h...
4,043
Title: Two Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: A subsequence of length |*x*| of string *s*<==<=*s*1*s*2... *s*|*s*| (where |*s*| is the length of string *s*) is a string *x*<==<=*s**k*1*s**k*2... *s**k*|*x*| (1<=≤<=*k*1<=&lt;<=*k*2<=&lt;<=...<=&lt;<=*k*|*x*|<=≤<=|*s*|)....
4,044
Title: On the Bench Time Limit: None seconds Memory Limit: None megabytes Problem Description: A year ago on the bench in public park Leha found an array of *n* numbers. Leha believes that permutation *p* is right if for all 1<=≤<=*i*<=&lt;<=*n* condition, that *a**p**i*·*a**p**i*<=+<=1 is not perfect square, holds....
4,045
Title: Sort the Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array *a* consisting of *n* distinct integers. Unfortunately, the size of *a* is too small. You want a bigger array! Your frie...
4,046
Title: Mad Joe Time Limit: None seconds Memory Limit: None megabytes Problem Description: Joe has been hurt on the Internet. Now he is storming around the house, destroying everything in his path. Joe's house has *n* floors, each floor is a segment of *m* cells. Each cell either contains nothing (it is an empty cel...
4,047
Title: The Moral Dilemma Time Limit: None seconds Memory Limit: None megabytes Problem Description: Hibiki and Dita are in love with each other, but belong to communities that are in a long lasting conflict. Hibiki is deeply concerned with the state of affairs, and wants to figure out if his relationship with Dita i...
4,048
Title: Word Folding Time Limit: None seconds Memory Limit: None megabytes Problem Description: You will receive 5 points for solving this problem. Manao has invented a new operation on strings that is called folding. Each fold happens between a pair of consecutive letters and places the second part of the string ab...
4,049
Title: Yet Another Number Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Since most contestants do not read this part, I have to repeat that Bitlandians are quite weird. They have their own jobs, their own working method, their own lives, their own sausages and their own games! Sinc...
4,050
Title: Count Good Substrings Time Limit: None seconds Memory Limit: None megabytes Problem Description: We call a string good, if after merging all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba". Given a string,...
4,051
Title: Metro Scheme Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland is very concerned with privacy, so almost all plans and blueprints are secret. However, a spy of the neighboring state managed to steal the Bertown subway scheme. The Bertown Subway has *n* stations, numbered from...
4,052
Title: Noldbach problem Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Nick is interested in prime numbers. Once he read about Goldbach problem. It states that every even integer greater than 2 can be expressed as the sum of two primes. That got Nick's attention and he decided to invent a prob...
4,053
Title: Magic Formulas Time Limit: None seconds Memory Limit: None megabytes Problem Description: People in the Tomskaya region like magic formulas very much. You can see some of them below. Imagine you are given a sequence of positive integer numbers *p*1, *p*2, ..., *p**n*. Lets write down some magic formulas: He...
4,054
Title: Suspects Time Limit: None seconds Memory Limit: None megabytes Problem Description: As Sherlock Holmes was investigating a crime, he identified *n* suspects. He knows for sure that exactly one of them committed the crime. To find out which one did it, the detective lines up the suspects and numbered them from...
4,055
Title: Expected diameter of a tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pasha is a good student and one of MoJaK's best friends. He always have a problem to think about. Today they had a talk about the following problem. We have a forest (acyclic undirected graph) with *n* vert...
4,056
Title: Vasya and Shifts Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has a set of 4*n* strings of equal length, consisting of lowercase English letters "a", "b", "c", "d" and "e". Moreover, the set is split into *n* groups of 4 equal strings each. Vasya also has one special string...
4,057
Title: Cracking the Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: The protection of a popular program developed by one of IT City companies is organized the following way. After installation it outputs a random five digit number which should be sent in SMS to a particular phone numb...
4,058
Title: Radio stations Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the lattice points of the coordinate line there are *n* radio stations, the *i*-th of which is described by three integers: - *x**i* — the coordinate of the *i*-th station on the line, - *r**i* — the broadcasting r...
4,059
Title: Two Circles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's assume that we are given an *n*<=×<=*m* table filled by integers. We'll mark a cell in the *i*-th row and *j*-th column as (*i*,<=*j*). Thus, (1,<=1) is the upper left cell of the table and (*n*,<=*m*) is the lower ri...
4,060
Title: Binary Number Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Little walrus Fangy loves math very much. That's why when he is bored he plays with a number performing some operations. Fangy takes some positive integer *x* and wants to get a number one from it. While *x* is not equal to ...
4,061
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little bear who loves to play. Today he is playing by destroying block towers. He built *n* towers in a row. The *i*-th tower is made of *h**i* identical blocks. For clarification see picture for the first sample. Lima...
4,062
Title: PawnChess Time Limit: None seconds Memory Limit: None megabytes Problem Description: Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess». This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of ...
4,063
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: By 2312 there were *n* Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to *n*. However, scientists did not know what activating several colliders simultaneo...
4,064
Title: Inna and Sweet Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: Inna loves sweets very much. That's why she decided to play a game called "Sweet Matrix". Inna sees an *n*<=×<=*m* matrix and *k* candies. We'll index the matrix rows from 1 to *n* and the matrix columns from 1 t...
4,065
Title: Wizards and Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: In some country live wizards. They love to build cities and roads. The country used to have *k* cities, the *j*-th city (1<=≤<=*j*<=≤<=*k*) was located at a point (*x**j*, *y**j*). It was decided to create another *n...
4,066
Title: The Red Button Time Limit: None seconds Memory Limit: None megabytes Problem Description: Piegirl found the red button. You have one last chance to change the inevitable end. The circuit under the button consists of *n* nodes, numbered from 0 to *n* - 1. In order to deactivate the button, the *n* nodes must ...
4,067
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you know, Vova has recently become a new shaman in the city of Ultima Thule. So, he has received the shaman knowledge about the correct bracket sequences. The shamans of Ultima Thule have been using lots of different types of b...
4,068
Title: Order Book Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this task you need to process a set of stock exchange orders and use them to create order book. An order is an instruction of some participant to buy or sell stocks on stock exchange. The order number *i* has price *p**i...
4,069
Title: Inna and Large Sweet Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: Inna loves sweets very much. That's why she wants to play the "Sweet Matrix" game with Dima and Sereja. But Sereja is a large person, so the game proved small for him. Sereja suggested playing the "Large Swe...
4,070
Title: Marmots (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Heidi is a statistician to the core, and she likes to study the evolution of marmot populations in each of *V* (1<=≤<=*V*<=≤<=100) villages! So it comes that every spring, when Heidi sees the first snowdrops sprout in th...
4,071
Title: Game with Powers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya and Petya wrote down all integers from 1 to *n* to play the "powers" game (*n* can be quite large; however, Vasya and Petya are not confused by this fact). Players choose numbers in turn (Vasya chooses first). I...
4,072
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler! However, there is no reason for disappointment, as Valery has found another ruler, ...
4,073
Title: Vasily the Bear and Beautiful Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasily the Bear loves beautiful strings. String *s* is beautiful if it meets the following criteria: 1. String *s* only consists of characters 0 and 1, at that character 0 must occur in string *...
4,074
Title: WTF? Time Limit: None seconds Memory Limit: None megabytes Problem Description: Input Specification: The input contains between 1 and 10 lines, *i*-th line contains an integer number *x**i* (0<=≤<=*x**i*<=≤<=9). Output Specification: Output a single real number. The answer is considered to be correct if it...
4,075
Title: Intercity Travelling Time Limit: None seconds Memory Limit: None megabytes Problem Description: Leha is planning his journey from Moscow to Saratov. He hates trains, so he has decided to get from one city to another by car. The path from Moscow to Saratov can be represented as a straight line (well, it's not...
4,076
Title: Wilbur and Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: Wilbur is playing with a set of *n* points on the coordinate plane. All points have non-negative integer coordinates. Moreover, if some point (*x*, *y*) belongs to the set, then all points (*x*', *y*'), such that 0<=≤...
4,077
Title: Dima and Friends Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima and his friends have been playing hide and seek at Dima's place all night. As a result, Dima's place got messy. In the morning they decided that they need to clean the place. To decide who exactly would clean the...
4,078
Title: Labyrinth-6 Time Limit: None seconds Memory Limit: None megabytes Problem Description: See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01). Input Specification: none Output Specification: none Note: none
4,079
Title: Upside Down Time Limit: None seconds Memory Limit: None megabytes Problem Description: As we all know, Eleven has special abilities. Thus, Hopper convinced her to close the gate to the Upside Down World with her mind. Upside down monsters like to move between the worlds, so they are going to attack Hopper and...
4,080
Title: Archer Time Limit: None seconds Memory Limit: None megabytes Problem Description: SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is for SmallR while for Zanoes. The one w...
4,081
Title: Military Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem you will have to help Berland army with organizing their command delivery system. There are $n$ officers in Berland army. The first officer is the commander of the army, and he does not have any superi...
4,082
Title: Rooter's Song Time Limit: None seconds Memory Limit: None megabytes Problem Description: Wherever the destination is, whoever we meet, let's render this song together. On a Cartesian coordinate plane lies a rectangular stage of size *w*<=×<=*h*, represented by a rectangle with corners (0,<=0), (*w*,<=0), (*w...
4,083
Title: Cells Not Under Attack Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has the square chessboard of size *n*<=×<=*n* and *m* rooks. Initially the chessboard is empty. Vasya will consequently put the rooks on the board one after another. The cell of the field is under rook's a...
4,084
Title: Die Roll Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Yakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors. Wakko thought about T...
4,085
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Piegirl was asked to implement two table join operation for distributed database system, minimizing the network traffic. Suppose she wants to join two tables, *A* and *B*. Each of them has certain number of rows which are distrib...
4,086
Title: Alyona and the Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on. Th...
4,087
Title: Friends and Subsequences Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on their own, but together (with you) — who knows? Every one o...
4,088
Title: Bakery Time Limit: None seconds Memory Limit: None megabytes Problem Description: Masha wants to open her own bakery and bake muffins in one of the *n* cities numbered from 1 to *n*. There are *m* bidirectional roads, each of whose connects some pair of cities. To bake muffins in her bakery, Masha needs to e...
4,089
Title: Rocket Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is an interactive problem. Natasha is going to fly to Mars. Finally, Natasha sat in the rocket. She flies, flies... but gets bored. She wishes to arrive to Mars already! So she decides to find something to occupy herself. ...
4,090
Title: Sereja and Squares Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja has painted *n* distinct points on the plane. The coordinates of each point are integers. Now he is wondering: how many squares are there with sides parallel to the coordinate axes and with points painted in a...
4,091
Title: Misha, Grisha and Underground Time Limit: None seconds Memory Limit: None megabytes Problem Description: Misha and Grisha are funny boys, so they like to use new underground. The underground has *n* stations connected with *n*<=-<=1 routes so that each route connects two stations, and it is possible to reach ...
4,092
Title: Singer House Time Limit: None seconds Memory Limit: None megabytes Problem Description: It is known that passages in Singer house are complex and intertwined. Let's define a Singer *k*-house as a graph built by the following process: take complete binary tree of height *k* and add edges from each vertex to al...
4,093
Title: Links and Pearls Time Limit: None seconds Memory Limit: None megabytes Problem Description: A necklace can be described as a string of links ('-') and pearls ('o'), with the last link or pearl connected to the first one. You can remove a link or a pearl and insert it between two other existing links or pearl...
4,094
Title: Little Pony and Lord Tirek Time Limit: None seconds Memory Limit: None megabytes Problem Description: Lord Tirek is a centaur and the main antagonist in the season four finale episodes in the series "My Little Pony: Friendship Is Magic". In "Twilight's Kingdom" (Part 1), Tirek escapes from Tartarus and drains...
4,095
Title: Tablecity Time Limit: None seconds Memory Limit: None megabytes Problem Description: There was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than Albert – Tablecity’s Chief of Police. Albert does not know where the thief is located, but he does know how he moves...
4,096
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: For an array $b$ of length $m$ we define the function $f$ as where $\oplus$ is [bitwise exclusive OR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). For example, $f(1,2,4,8)=f(1\oplus2,2\oplus4,4\oplus8)=f(3,6,12)=f(3\op...
4,097
Title: INTERCALC Time Limit: None seconds Memory Limit: None megabytes Problem Description: DO YOU EXPECT ME TO FIND THIS OUT? WHAT BASE AND/XOR LANGUAGE INCLUDES string? DON'T BYTE OF MORE THAN YOU CAN CHEW YOU CAN ONLY DISTORT THE LARGEST OF MATHEMATICS SO FAR SAYING "ABRACADABRA" WITHOUT A MAGIC AND WON'T DO ...
4,098
Title: Petya and Catacombs Time Limit: None seconds Memory Limit: None megabytes Problem Description: A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs. Catacombs consist of several rooms and bidirectiona...
4,099