task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Natalia was walking in the woods when she met a little mushroom gnome. The gnome told her the following story: Everybody knows that the mushroom gnomes' power lies in the magic mushrooms that grow in the native woods of t...
1,800
Title: Minimal Subset Difference Time Limit: None seconds Memory Limit: None megabytes Problem Description: We call a positive integer *x* a *k*-beautiful integer if and only if it is possible to split the multiset of its digits in the decimal representation into two subsets such that the difference between the sum ...
1,801
Title: Kirill And The Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers — amount of experience and cost. The efficiency of a potion is the ratio of the...
1,802
Title: Bacterial Melee Time Limit: None seconds Memory Limit: None megabytes Problem Description: Julia is conducting an experiment in her lab. She placed several luminescent bacterial colonies in a horizontal testtube. Different types of bacteria can be distinguished by the color of light they emit. Julia marks typ...
1,803
Title: Guess Your Way Out! II Time Limit: None seconds Memory Limit: None megabytes Problem Description: Amr bought a new video game "Guess Your Way Out! II". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height *h*. The player is initially standing at the root of the...
1,804
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nanami is an expert at playing games. This day, Nanami's good friend Hajime invited her to watch a game of baseball. Unwilling as she was, she followed him to the stadium. But Nanami had no interest in the game, so she looked arou...
1,805
Title: School Marks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Vova studies programming in an elite school. Vova and his classmates are supposed to write *n* progress tests, for each test they will get a mark from 1 to *p*. Vova is very smart and he can write every test for any...
1,806
Title: none 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*,<=*h*) ...
1,807
Title: Hongcow's Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is an interactive problem. In the interaction section below you will see the information about flushing the output. In this problem, you will be playing a game with Hongcow. How lucky of you! Hongcow has a hidden ...
1,808
Title: Password Check Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password...
1,809
Title: The Evil Temple and the Moving Rocks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Important: All possible tests are in the pretest, so you shouldn't hack on this problem. So, if you passed pretests, you will also pass the system test. You are an adventurer currently journeying i...
1,810
Title: Inventory Time Limit: None seconds Memory Limit: None megabytes Problem Description: Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is an inventory number assigned with each item. It is much easier to create a database by using those numb...
1,811
Title: Sleep in Class Time Limit: None seconds Memory Limit: None megabytes Problem Description: The academic year has just begun, but lessons and olympiads have already occupied all the free time. It is not a surprise that today Olga fell asleep on the Literature. She had a dream in which she was on a stairs. The...
1,812
Title: Vlad and Cafes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vlad likes to eat in cafes very much. During his life, he has visited cafes *n* times. Unfortunately, Vlad started to feel that his last visits are not any different from each other. To fix that Vlad had a small research...
1,813
Title: Jzzhu and Sequences Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jzzhu has invented a kind of sequences, they meet the following property: You are given *x* and *y*, please calculate *f**n* modulo 1000000007 (109<=+<=7). Input Specification: The first line contains two integers...
1,814
Title: Bear and Rectangle Strips Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak has a grid that consists of 2 rows and *n* columns. The *j*-th cell in the *i*-th row contains an integer *t**i*,<=*j* which can be positive, negative or zero. A non-empty rectangle of cells is called n...
1,815
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasilisa the Wise from a far away kingdom got a present from her friend Helga the Wise from a farther away kingdom. The present is a surprise box, yet Vasilisa the Wise doesn't know yet what the surprise actually is because she ca...
1,816
Title: Garlands Time Limit: None seconds Memory Limit: None megabytes Problem Description: Like all children, Alesha loves New Year celebration. During the celebration he and his whole family dress up the fir-tree. Like all children, Alesha likes to play with garlands — chains consisting of a lightbulbs. Alesha use...
1,817
Title: Deputies Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Trinitarian kingdom has exactly *n*<==<=3*k* cities. All of them are located on the shores of river Trissisipi, which flows through the whole kingdom. Some of the cities are located on one side of the river, and all the re...
1,818
Title: Piglet's Birthday Time Limit: None seconds Memory Limit: None megabytes Problem Description: Piglet has got a birthday today. His friend Winnie the Pooh wants to make the best present for him — a honey pot. Of course Winnie realizes that he won't manage to get the full pot to Piglet. In fact, he is likely to ...
1,819
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerald has a friend, Pollard. Pollard is interested in lucky tickets (ticket is a sequence of digits). At first he thought that a ticket is lucky if between some its digits we can add arithmetic signs and brackets so that the resu...
1,820
Title: New Year Snowmen Time Limit: None seconds Memory Limit: None megabytes Problem Description: As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they...
1,821
Title: Synchrophasotron Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: For some experiments little Petya needs a synchrophasotron. He has already got the device, all that's left is to set the fuel supply. Fuel comes through a system of nodes numbered from 1 to *n* and connected by pipes. Pipe...
1,822
Title: Even Odds Time Limit: None seconds Memory Limit: None megabytes Problem Description: Being a nonconformist, Volodya is displeased with the current state of things, particularly with the order of natural numbers (natural number is positive integer number). He is determined to rearrange them. But there are too ...
1,823
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two players play a game. The game is played on a rectangular board with *n*<=×<=*m* squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same...
1,824
Title: Bear in the Field Time Limit: None seconds Memory Limit: None megabytes Problem Description: Our bear's forest has a checkered field. The checkered field is an *n*<=×<=*n* table, the rows are numbered from 1 to *n* from top to bottom, the columns are numbered from 1 to *n* from left to right. Let's denote a c...
1,825
Title: String Manipulation 1.0 Time Limit: None seconds Memory Limit: None megabytes Problem Description: One popular website developed an unusual username editing procedure. One can change the username only by deleting some characters from it: to change the current name *s*, a user can pick number *p* and character...
1,826
Title: Mittens Time Limit: None seconds Memory Limit: None megabytes Problem Description: A Christmas party in city S. had *n* children. All children came in mittens. The mittens can be of different colors, but each child had the left and the right mitten of the same color. Let's say that the colors of the mittens a...
1,827
Title: Vanya and Cubes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vanya got *n* cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of the pyramid must consist of 1 cube, the second level must consist of 1<=+<=2<==<=3 cubes, the t...
1,828
Title: Free Cash Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valera runs a 24/7 fast food cafe. He magically learned that next day *n* people will visit his cafe. For each person we know the arrival time: the *i*-th person comes exactly at *h**i* hours *m**i* minutes. The cafe spends l...
1,829
Title: Maximize Sum of Digits Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anton has the integer *x*. He is interested what positive integer, which doesn't exceed *x*, has the maximum sum of digits. Your task is to help Anton and to find the integer that interests him. If there are sev...
1,830
Title: Fly Time Limit: None seconds Memory Limit: None megabytes Problem Description: Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $n - 2$ intermediate planets. Formally: we number all the planets from $1$ to $n$. $1$ is Earth, $n$ is Mars. Natasha will ...
1,831
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is an interactive problem. Refer to the Interaction section below for better understanding. Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight. Initially, Ithea puts *n* clear she...
1,832
Title: Hag's Khashba Time Limit: None seconds Memory Limit: None megabytes Problem Description: Hag is a very talented person. He has always had an artist inside him but his father forced him to study mechanical engineering. Yesterday he spent all of his time cutting a giant piece of wood trying to make it look lik...
1,833
Title: Levels and Regions Time Limit: None seconds Memory Limit: None megabytes Problem Description: Radewoosh is playing a computer game. There are *n* levels, numbered 1 through *n*. Levels are divided into *k* regions (groups). Each region contains some positive number of consecutive levels. The game repeats the...
1,834
Title: Little Artem and Time Machine Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply this time machine to a well-known data structure: multise...
1,835
Title: Minimization Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got array *A*, consisting of *n* integers and a positive integer *k*. Array *A* is indexed by integers from 1 to *n*. You need to permute the array elements so that value Input Specification: The first line contai...
1,836
Title: Shovel Sale Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* shovels in Polycarp's shop. The *i*-th shovel costs *i* burles, that is, the first shovel costs 1 burle, the second shovel costs 2 burles, the third shovel costs 3 burles, and so on. Polycarps wants to sell sh...
1,837
Title: T-Shirts Time Limit: None seconds Memory Limit: None megabytes Problem Description: The big consignment of t-shirts goes on sale in the shop before the beginning of the spring. In all *n* types of t-shirts go on sale. The t-shirt of the *i*-th type has two integer parameters — *c**i* and *q**i*, where *c**i* ...
1,838
Title: Levko and Sets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Levko loves all sorts of sets very much. Levko has two arrays of integers *a*1,<=*a*2,<=... ,<=*a**n* and *b*1,<=*b*2,<=... ,<=*b**m* and a prime number *p*. Today he generates *n* sets. Let's describe the generation pr...
1,839
Title: Three Garlands Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on. When a garland is switched on, it periodically changes its st...
1,840
Title: Morrowindows Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya plays The Elder Trolls III: Morrowindows. He has a huge list of items in the inventory, however, there is no limits on the size of things. Vasya does not know the total amount of items but he is sure that are not more th...
1,841
Title: Random Ranking Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine a real contest or exam of *n* participants. Every participant will get a particular score. We can predict the standings board more or less, if we do some statistics on their previous performance. Let's say the s...
1,842
Title: Representative Sampling Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows. Th...
1,843
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1<=×<=*n*. Your task is help Appleman with folding of such a sheet. Actually, you need to perform *q* queries. Each query will have one of ...
1,844
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems. For this round the dynamic problem scoring is used. If you were lucky not to participate in any Codeforces round with dyna...
1,845
Title: Median Smoothing Time Limit: None seconds Memory Limit: None megabytes Problem Description: A schoolboy named Vasya loves reading books on programming and mathematics. He has recently read an encyclopedia article that described the method of median smoothing (or median filter) and its many applications in sci...
1,846
Title: New Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any titles of recent Codeforces problems. You'...
1,847
Title: none 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. Sh...
1,848
Title: Nearly Lucky Number Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. ...
1,849
Title: Mahmoud and Ehab and the xor-MST Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ehab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of *n* vertices numbered from 0 to *n*<=-<=1. Fo...
1,850
Title: Magic Five Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a long plate *s* containing *n* digits. Iahub wants to delete some digits (possibly none, but he is not allowed to delete all the digits) to form his "magic number" on the plate, a number that is divisible by 5. Not...
1,851
Title: Hometask Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sergey attends lessons of the *N*-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the *N*-ish language. Sentences of the *N*-ish language can be represented as strings cons...
1,852
Title: Making Sequences is Fun Time Limit: None seconds Memory Limit: None megabytes Problem Description: We'll define *S*(*n*) for positive integer *n* as follows: the number of the *n*'s digits in the decimal base. For example, *S*(893)<==<=3, *S*(114514)<==<=6. You want to make a consecutive integer sequence sta...
1,853
Title: Vasily the Bear and Fly Time Limit: None seconds Memory Limit: None megabytes Problem Description: One beautiful day Vasily the bear painted 2*m* circles of the same radius *R* on a coordinate plane. Circles with numbers from 1 to *m* had centers at points (2*R*<=-<=*R*,<=0), (4*R*<=-<=*R*,<=0), ..., (2*Rm*<=...
1,854
Title: Lucky Tree Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One day ...
1,855
Title: Factory Time Limit: None seconds Memory Limit: None megabytes Problem Description: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were *x* details in the factory storage, then by the end of the day the fac...
1,856
Title: Amusement Park Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pupils decided to go to amusement park. Some of them were with parents. In total, *n* people came to the park and they all want to get to the most extreme attraction and roll on it exactly once. Tickets for group of *x*...
1,857
Title: Mr. Kitayuta vs. Bamboos Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Kitayuta's garden is planted with *n* bamboos. (Bamboos are tall, fast-growing tropical plants with hollow stems.) At the moment, the height of the *i*-th bamboo is *h**i* meters, and it grows *a**i* meters...
1,858
Title: Browser Time Limit: None seconds Memory Limit: None megabytes Problem Description: Luba is surfing the Internet. She currently has *n* opened tabs in her browser, indexed from 1 to *n* from left to right. The mouse cursor is currently located at the *pos*-th tab. Luba needs to use the tabs with indices from *...
1,859
Title: FreeDiv Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: Vasya plays FreeDiv. In this game he manages a huge state, which has *n* cities and *m* two-way roads between them. Unfortunately, not from every city you can reach any other one moving along these roads. Therefore Vasya decided to...
1,860
Title: Hongcow Masters the Cyclic Shift Time Limit: None seconds Memory Limit: None megabytes Problem Description: Hongcow's teacher heard that Hongcow had learned about the cyclic shift, and decided to set the following problem for him. You are given a list of *n* strings *s*1,<=*s*2,<=...,<=*s**n* contained in th...
1,861
Title: Points Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: You are given *N* points on a plane. Write a program which will find the sum of squares of distances between all pairs of points. Input Specification: The first line of input contains one integer number *N* (1<=≤<=*N*<=≤<=100<=000)...
1,862
Title: Line to Cashier Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Vasya went to the supermarket to get some groceries. He walked about the supermarket for a long time and got a basket full of products. Now he needs to choose the cashier to pay for the products. There are *n* c...
1,863
Title: Tourist Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are *n* destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The *n* d...
1,864
Title: Anton and Fairy Tale Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anton likes to listen to fairy tales, especially when Danik, Anton's best friend, tells them. Right now Danik tells Anton a fairy tale: "Once upon a time, there lived an emperor. He was very rich and had much grai...
1,865
Title: none 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 1 t...
1,866
Title: Duck Hunt Time Limit: None seconds Memory Limit: None megabytes Problem Description: A duck hunter is doing his favorite thing, hunting. He lives in a two dimensional world and is located at point (0,<=0). As he doesn't like walking for his prey, he prefers to shoot only vertically up (because in this case, t...
1,867
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Firecrackers scare Nian the monster, but they're wayyyyy too noisy! Maybe fireworks make a nice complement. Little Tommy is watching a firework show. As circular shapes spread across the sky, a splendid view unfolds on the night ...
1,868
Title: Permanent Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little X has solved the #P-complete problem in polynomial time recently. So he gives this task to you. There is a special *n*<=×<=*n* matrix *A*, you should calculate its permanent modulo 1000000007 (109<=+<=7). The special...
1,869
Title: The Wall (hard) Time Limit: None seconds Memory Limit: None megabytes Problem Description: So many wall designs to choose from! Even modulo 106<=+<=3, it's an enormous number. Given that recently Heidi acquired an unlimited supply of bricks, her choices are endless! She really needs to do something to narrow ...
1,870
Title: Constellation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Cat Noku has obtained a map of the night sky. On this map, he found a constellation with *n* stars numbered from 1 to *n*. For each *i*, the *i*-th star is located at coordinates (*x**i*,<=*y**i*). No two stars are locate...
1,871
Title: Seat Arrangements Time Limit: None seconds Memory Limit: None megabytes Problem Description: Suppose that you are in a campus and have to go for classes day by day. As you may see, when you hurry to a classroom, you surprisingly find that many seats there are already occupied. Today you and your friends went ...
1,872
Title: Declined Finalists Time Limit: None seconds Memory Limit: None megabytes Problem Description: This year, as in previous years, MemSQL is inviting the top 25 competitors from the Start[c]up qualification round to compete onsite for the final round. Not everyone who is eligible to compete onsite can afford to t...
1,873
Title: Dome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Input Specification: The input contains a single floating-point number *x* with exactly 6 decimal places (0<=&lt;<=*x*<=&lt;<=5). Output Specification: Output two integers separated by a single space. Each integer should be bet...
1,874
Title: Queries about less or equal elements Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two arrays of integers *a* and *b*. For each element of the second array *b**j* you should find the number of elements in array *a* that are less than or equal to the value *b**j*. In...
1,875
Title: Hot Bath Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bob is about to take a hot bath. There are two taps to fill the bath: a hot water tap and a cold water tap. The cold water's temperature is *t*1, and the hot water's temperature is *t*2. The cold water tap can transmit any i...
1,876
Title: Cipher Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sherlock Holmes found a mysterious correspondence of two VIPs and made up his mind to read it. But there is a problem! The correspondence turned out to be encrypted. The detective tried really hard to decipher the correspondence...
1,877
Title: Hungry Student Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan's classes at the university have just finished, and now he wants to go to the local CFK cafe and eat some fried chicken. CFK sells chicken chunks in small and large portions. A small portion contains 3 chun...
1,878
Title: Cheese Board Time Limit: None seconds Memory Limit: None megabytes Problem Description: Not to be confused with [chessboard](https://en.wikipedia.org/wiki/Chessboard). Input Specification: The first line of input contains a single integer *N* (1<=≤<=*N*<=≤<=100) — the number of cheeses you have. The next *N...
1,879
Title: Two Bases Time Limit: None seconds Memory Limit: None megabytes Problem Description: After seeing the "ALL YOUR BASE ARE BELONG TO US" meme for the first time, numbers *X* and *Y* realised that they have different bases, which complicated their relations. You're given a number *X* represented in base *b**x* ...
1,880
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Petya likes positive integers a lot. Recently his mom has presented him a positive integer *a*. There's only one thing Petya likes more than numbers: playing with little Masha. It turned out that Masha already has a positiv...
1,881
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Copying large hexadecimal (base 16) strings by hand can be error prone, but that doesn't stop people from doing it. You've discovered a bug in the code that was likely caused by someone making a mistake when copying such a string....
1,882
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. ...
1,883
Title: Cut Ribbon Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has a ribbon, its length is *n*. He wants to cut the ribbon in a way that fulfils the following two conditions: - After the cutting each ribbon piece should have length *a*, *b* or *c*. - After the cutting the...
1,884
Title: Double Profiles Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have been offered a job in a company developing a large social network. Your first task is connected with searching profiles that most probably belong to the same user. The social network contains *n* registered pr...
1,885
Title: Dividing Kingdom Time Limit: None seconds Memory Limit: None megabytes Problem Description: A country called Flatland is an infinite two-dimensional plane. Flatland has *n* cities, each of them is a point on the plane. Flatland is ruled by king Circle IV. Circle IV has 9 sons. He wants to give each of his so...
1,886
Title: Distributed Join 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...
1,887
Title: Recover a functional graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: Functional graph is a directed graph in which all vertices have outdegree equal to 1. Loops are allowed. Some vertices of a functional graph lay on a cycle. From the others we can come to a cycle by making a...
1,888
Title: Tricky and Clever Password Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In his very young years the hero of our story, king Copa, decided that his private data was hidden not enough securely, what is unacceptable for the king. That's why he invented tricky and clever password (later ...
1,889
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Greg has an array *a*<==<=*a*1,<=*a*2,<=...,<=*a**n* and *m* operations. Each operation looks as: *l**i*, *r**i*, *d**i*, (1<=≤<=*l**i*<=≤<=*r**i*<=≤<=*n*). To apply operation *i* to the array means to increase all array elements ...
1,890
Title: Buggy Robot Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan has a robot which is situated on an infinite grid. Initially the robot is standing in the starting cell (0,<=0). The robot can process commands. There are four types of commands it can perform: - U — move from the ce...
1,891
Title: Theseus and labyrinth Time Limit: None seconds Memory Limit: None megabytes Problem Description: Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size *n*<=×<=*m* and consists of blocks of size 1<=×<=1. Each block of the labyrinth has a butto...
1,892
Title: Hard problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given *n* strings consisting of lowercase English letters. He wants them to be sorted in l...
1,893
Title: Shooshuns and Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day shooshuns found a sequence of *n* integers, written on a blackboard. The shooshuns can perform one operation with it, the operation consists of two steps: 1. Find the number that goes *k*-th in the cur...
1,894
Title: Mishka and Contest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mishka started participating in a programming contest. There are $n$ problems in the contest. Mishka's problem-solving skill is equal to $k$. Mishka arranges all problems from the contest into a list. Because of his...
1,895
Title: Night at the Museum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition. Embosser is a special devis...
1,896
Title: The Door Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Moriarty has trapped *n* people in *n* distinct rooms in a hotel. Some rooms are locked, others are unlocked. But, there is a condition that the people in the hotel can only escape when all the doors are unlocked at th...
1,897
Title: Mike and Geometry Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mike wants to prepare for IMO but he doesn't know geometry, so his teacher gave him an interesting geometry problem. Let's define *f*([*l*,<=*r*])<==<=*r*<=-<=*l*<=+<=1 to be the number of integer points in th...
1,898
Title: Fountains Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are *n* available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coins and diamonds, so ea...
1,899