task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One day Pe...
4,800
Title: Snow Footprints Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a straight snowy road, divided into *n* blocks. The blocks are numbered from 1 to *n* from left to right. If one moves from the *i*-th block to the (*i*<=+<=1)-th block, he will leave a right footprint on the *...
4,801
Title: Intense Heat Time Limit: None seconds Memory Limit: None megabytes Problem Description: The heat during the last few days has been really intense. Scientists from all over the Berland study how the temperatures and weather change, and they claim that this summer is abnormally hot. But any scientific claim sou...
4,802
Title: Link/Cut Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Programmer Rostislav got seriously interested in the Link/Cut Tree data structure, which is based on Splay trees. Specifically, he is now studying the *expose* procedure. Unfortunately, Rostislav is unable to understand ...
4,803
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little grizzly bear. He will once attack Deerland but now he can only destroy trees in role-playing games. Limak starts with a tree with one vertex. The only vertex has index 1 and is a root of the tree. Sometimes, a g...
4,804
Title: Mahmoud and a xor trip Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mahmoud and Ehab live in a country with *n* cities numbered from 1 to *n* and connected by *n*<=-<=1 undirected roads. It's guaranteed that you can reach any city from any other using these roads. Each city has a...
4,805
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A function is called Lipschitz continuous if there is a real constant *K* such that the inequality |*f*(*x*)<=-<=*f*(*y*)|<=≀<=*K*Β·|*x*<=-<=*y*| holds for all . We'll deal with a more... discrete version of this term. For an arr...
4,806
Title: Yet Another Maxflow Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem you will have to deal with a very special network. The network consists of two parts: part *A* and part *B*. Each part consists of *n* vertices; *i*-th vertex of part *A* is denoted as *A**i...
4,807
Title: Shaass and Oskols Time Limit: None seconds Memory Limit: None megabytes Problem Description: Shaass has decided to hunt some birds. There are *n* horizontal electricity wires aligned parallel to each other. Wires are numbered 1 to *n* from top to bottom. On each wire there are some oskols sitting next to each...
4,808
Title: Chess Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Brian the Rabbit adores chess. Not long ago he argued with Stewie the Rabbit that a knight is better than a king. To prove his point he tries to show that the knight is very fast but Stewie doesn't accept statements without evidence....
4,809
Title: Plug-in Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Polycarp thinks about the meaning of life very often. He does this constantly, even when typing in the editor. Every time he starts brooding he can no longer fully concentrate and repeatedly presses the keys that need to be pressed...
4,810
Title: Chat Order Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his friend's chat rises to the very top of the page. The rela...
4,811
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub got lost in a very big desert. The desert can be represented as a *n*<=Γ—<=*n* square matrix, where each cell is a zone of the desert. The cell (*i*,<=*j*) represents the cell at row *i* and column *j* (1<=≀<=*i*,<=*j*<=≀<=*n...
4,812
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* types of coins in Byteland. Conveniently, the denomination of the coin type *k* divides the denomination of the coin type *k*<=+<=1, the denomination of the coin type 1 equals 1 tugrick. The ratio of the denomination...
4,813
Title: Stripe Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Once Bob took a paper stripe of *n* squares (the height of the stripe is 1 square). In each square he wrote an integer number, possibly negative. He became interested in how many ways exist to cut this stripe into two pieces so that ...
4,814
Title: Alyona and Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: After returned from forest, Alyona started reading a book. She noticed strings *s* and *t*, lengths of which are *n* and *m* respectively. As usual, reading bored Alyona and she decided to pay her attention to string...
4,815
Title: DravDe saves the world Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: How horrible! The empire of galactic chickens tries to conquer a beautiful city "Z", they have built a huge incubator that produces millions of chicken soldiers a day, and fenced it around. The huge incubator looks l...
4,816
Title: Data Center Maintenance Time Limit: None seconds Memory Limit: None megabytes Problem Description: BigData Inc. is a corporation that has *n* data centers indexed from 1 to *n* that are located all over the world. These data centers provide storage for client data (you can figure out that client data is reall...
4,817
Title: Billiard Time Limit: None seconds Memory Limit: None megabytes Problem Description: Consider a [billiard table](https://en.wikipedia.org/wiki/Billiard_table) of rectangular size $n \times m$ with four pockets. Let's introduce a coordinate system with the origin at the lower left corner (see the picture). Th...
4,818
Title: Russian Roulette Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of *n* bullet slots able to conta...
4,819
Title: Petya and Exam Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help with one.. There is a glob pattern in ...
4,820
Title: Four Melodies Time Limit: None seconds Memory Limit: None megabytes Problem Description: Author note: I think some of you might remember the problem "Two Melodies" from Eductational Codeforces Round 22. Now it's time to make it a bit more difficult! Alice is a composer, and recently she had recorded two trac...
4,821
Title: Headquarters Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sensation, sensation in the two-dimensional kingdom! The police have caught a highly dangerous outlaw, member of the notorious "Pihters" gang. The law department states that the outlaw was driving from the gang's headquart...
4,822
Title: Periodic RMQ Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a* consisting of positive integers and *q* queries to this array. There are two types of queries: - 1 *l* *r* *x* β€” for each index *i* such that *l*<=≀<=*i*<=≀<=*r* set *a**i*<==<=*x*. - ...
4,823
Title: Soldier and Number Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two soldiers are playing a game. At the beginning first of them chooses a positive integer *n* and gives it to the second soldier. Then the second one tries to make maximum possible number of rounds. Each round ...
4,824
Title: Hyperspace Jump (hard) Time Limit: None seconds Memory Limit: None megabytes Problem Description: It is now 125 years later, but humanity is still on the run from a humanoid-cyborg race determined to destroy it. Or perhaps we are getting some stories mixed up here... In any case, the fleet is now smaller. How...
4,825
Title: Balls Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub is training for the IOI. What is a better way to train than playing a Zuma-like game? There are *n* balls put in a row. Each ball is colored in one of *k* colors. Initially the row doesn't contain three or more conti...
4,826
Title: Longest Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given array *a* with *n* elements and the number *m*. Consider some subsequence of *a* and the value of least common multiple (LCM) of its elements. Denote LCM as *l*. Find any longest subsequence of *a* wit...
4,827
Title: Local Extrema Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a*. Some element of this array *a**i* is a local minimum iff it is strictly less than both of its neighbours (that is, *a**i*<=&lt;<=*a**i*<=-<=1 and *a**i*<=&lt;<=*a**i*<=+<=1). Also the element c...
4,828
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Allen is hosting a formal dinner party. $2n$ people come to the event in $n$ pairs (couples). After a night of fun, Allen wants to line everyone up for a final picture. The $2n$ people line up, but Allen doesn't like the ordering....
4,829
Title: Fire and Ice Time Limit: 0 seconds Memory Limit: 256 megabytes Problem Description: The Fire Lord attacked the Frost Kingdom. He has already got to the Ice Fortress, where the Snow Queen dwells. He arranged his army on a segment *n* in length not far from the city walls. And only the frost magician Solomon ca...
4,830
Title: Lock Puzzle Time Limit: None seconds Memory Limit: None megabytes Problem Description: Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the p...
4,831
Title: Ryouko's Memory Note Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what ...
4,832
Title: Tea Party Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp invited all his friends to the tea party to celebrate the holiday. He has *n* cups, one for each of his *n* friends, with volumes *a*1,<=*a*2,<=...,<=*a**n*. His teapot stores *w* milliliters of tea (*w*<=≀<=*a*1<=+<...
4,833
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. After reading the instructions he realized that it does not work like regular snow blowing machines. In order to make it work, you ...
4,834
Title: Blog Photo Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One popular blog site edits the uploaded photos like this. It cuts a rectangular area out of them so that the ratio of height to width (i.e. the *height*<=/<=*width* quotient) can vary from 0.8 to 1.25 inclusively. Besides, at l...
4,835
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Convexity of a set of points on the plane is the size of the largest subset of points that form a convex polygon. Your task is to build a set of *n* points with the convexity of exactly *m*. Your set of points should not contain t...
4,836
Title: Liar Time Limit: None seconds Memory Limit: None megabytes Problem Description: The first semester ended. You know, after the end of the first semester the holidays begin. On holidays Noora decided to return to Vičkopolis. As a modest souvenir for Leha, she brought a sausage of length *m* from Pavlopolis. Eve...
4,837
Title: Vasiliy's Multiset Time Limit: None seconds Memory Limit: None megabytes Problem Description: Author has gone out of the stories about Vasiliy, so here is just a formal task description. You are given *q* queries and a multiset *A*, initially containing only integer 0. There are three types of queries: 1. ...
4,838
Title: Neatness Time Limit: None seconds Memory Limit: None megabytes Problem Description: Simon loves neatness. So before he goes to bed, Simon wants to complete all chores in the house. Simon's house looks like a rectangular table consisting of *n* rows and *n* columns from above. All rows of the table are number...
4,839
Title: Two TVs Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp is a great fan of television. He wrote down all the TV programs he is interested in for today. His list contains *n* shows, *i*-th of them starts at moment *l**i* and ends at moment *r**i*. Polycarp owns two TVs. He ...
4,840
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting. The game consists of multiple rounds. Its rules are very simple: in each round, a natural number *k* is chosen. Then, the one who ...
4,841
Title: Too Much Money Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alfred wants to buy a toy moose that costs *c* dollars. The store doesn’t give change, so he must give the store exactly *c* dollars, no more and no less. He has *n* coins. To make *c* dollars from his coins, he follows ...
4,842
Title: Vasya and Petya's Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya and Petya are playing a simple game. Vasya thought of number *x* between 1 and *n*, and Petya tries to guess the number. Petya can ask questions like: "Is the unknown number divisible by number *y*?". The...
4,843
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After checking some examples, she ...
4,844
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja has an *n*<=Γ—<=*m* rectangular table *a*, each cell of the table contains a zero or a number one. Sereja wants his table to meet the following requirement: each connected component of the same values forms a rectangle with ...
4,845
Title: Subsegments Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Programmer Sasha has recently begun to study data structures. His coach Stas told him to solve the problem of finding a minimum on the segment of the array in , which Sasha coped with. For Sasha not to think that he had learned...
4,846
Title: TOF Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today Pari gave Arya a cool graph problem. Arya wrote a non-optimal solution for it, because he believes in his ability to optimize non-optimal solutions. In addition to being non-optimal, his code was buggy and he tried a lot to o...
4,847
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima came to the horse land. There are *n* horses living in the land. Each horse in the horse land has several enemies (enmity is a symmetric relationship). The horse land isn't very hostile, so the number of enemies of each horse...
4,848
Title: Sherlock and the Encrypted Data Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sherlock found a piece of encrypted data which he thinks will be useful to catch Moriarty. The encrypted data consists of two integer *l* and *r*. He noticed that these integers were in hexadecimal form....
4,849
Title: Sherlock's bet to Moriarty Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sherlock met Moriarty for a final battle of wits. He gave him a regular *n* sided convex polygon. In addition to it, he gave him certain diagonals to form regions on the polygon. It was guaranteed that the di...
4,850
Title: Mountain Scenery Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Bolek has found a picture with *n* mountain peaks painted on it. The *n* painted peaks are represented by a non-closed polyline, consisting of 2*n* segments. The segments go through 2*n*<=+<=1 points with coordi...
4,851
Title: Mister B and Astronomers Time Limit: None seconds Memory Limit: None megabytes Problem Description: After studying the beacons Mister B decided to visit alien's planet, because he learned that they live in a system of flickering star Moon. Moreover, Mister B learned that the star shines once in exactly *T* se...
4,852
Title: Fibonacci Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fibonacci strings are defined as follows: - *f*1 = Β«aΒ» - *f*2 = Β«bΒ» - *f**n* = *f**n*<=-<=1Β *f**n*<=-<=2, *n*<=&gt;<=2 Thus, the first five Fibonacci strings are: "a", "b", "ba", "bab", "babba". You are given a...
4,853
Title: Heidi and Library (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Your search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the lib...
4,854
Title: Infinite Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya likes everything infinite. Now he is studying the properties of a sequence *s*, such that its first element is equal to *a* (*s*1<==<=*a*), and the difference between any two neighbouring elements is equal to *c...
4,855
Title: k-rounding Time Limit: None seconds Memory Limit: None megabytes Problem Description: For a given positive integer *n* denote its *k*-rounding as the minimum positive integer *x*, such that *x* ends with *k* or more zeros in base 10 and is divisible by *n*. For example, 4-rounding of 375 is 375Β·80<==<=30000....
4,856
Title: Tree nesting Time Limit: None seconds Memory Limit: None megabytes Problem Description: 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...
4,857
Title: Surprise me! Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tired of boring dates, Leha and Noora decided to play a game. Leha found a tree with *n* vertices numbered from 1 to *n*. We remind you that tree is an undirected graph without cycles. Each vertex *v* of a tree has a numb...
4,858
Title: Recursive Queries Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let us define two functions *f* and *g* on positive integer numbers. You need to process *Q* queries. In each query, you will be given three integers *l*, *r* and *k*. You need to print the number of integers *x*...
4,859
Title: Prime Problem Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: In Berland prime numbers are fashionable β€” the respectable citizens dwell only on the floors with numbers that are prime numbers. The numismatists value particularly high the coins with prime nominal values. All the prime day...
4,860
Title: Graph and String Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day student Vasya was sitting on a lecture and mentioned a string *s*1*s*2... *s**n*, consisting of letters "a", "b" and "c" that was written on his desk. As the lecture was boring, Vasya decided to complete the pi...
4,861
Title: Beaver's Calculator 1.0 Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Smart Beaver from ABBYY has once again surprised us! He has developed a new calculating device, which he called the "Beaver's Calculator 1.0". It is very peculiar and it is planned to be used in a variety of...
4,862
Title: Bear and Tower of Cubes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many blocks of each side length. A block with side *a* has...
4,863
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alyona has built *n* towers by putting small cubes some on the top of others. Each cube has size 1<=Γ—<=1<=Γ—<=1. A tower is a non-zero amount of cubes standing on the top of each other. The towers are next to each other, forming a ...
4,864
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: John Doe decided that some mathematical object must be named after him. So he invented the Doe graphs. The Doe graphs are a family of undirected graphs, each of them is characterized by a single non-negative number β€” its order. ...
4,865
Title: Buy a Shovel Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp urgently needs a shovel! He comes to the shop and chooses an appropriate one. The shovel that Policarp chooses is sold for *k* burles. Assume that there is an unlimited number of such shovels in the shop. In his ...
4,866
Title: Dima and Salad Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima, Inna and Seryozha have gathered in a room. That's right, someone's got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something. Dima and Seryozha have *n* fruits in the fridge. ...
4,867
Title: Cowboy Beblop at his computer Time Limit: None seconds Memory Limit: None megabytes Problem Description: Cowboy Beblop is a funny little boy who likes sitting at his computer. He somehow obtained two elastic hoops in the shape of 2D polygons, which are not necessarily convex. Since there's no gravity on his s...
4,868
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dreamoon likes to play with sets, integers and . is defined as the largest positive integer that divides both *a* and *b*. Let *S* be a set of exactly four distinct integers greater than 0. Define *S* to be of rank *k* if and on...
4,869
Title: Simple Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to *n*. Let's assume that Misha chose number *m*, and Andrew chose number *a*. Then, by using a random gen...
4,870
Title: Fragile Bridges Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are playing a video game and you have just reached the bonus level, where the only possible goal is to score as many points as possible. Being a perfectionist, you've decided that you won't leave this level until yo...
4,871
Title: Nested Segments Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains. Input Specification: The first line contains a single integer *n* (1<=≀<...
4,872
Title: Fox And Dinner Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fox Ciel is participating in a party in Prime Kingdom. There are *n* foxes there (include Fox Ciel). The i-th fox is *a**i* years old. They will have dinner around some round tables. You want to distribute foxes such th...
4,873
Title: Police Patrol Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine that your city is an infinite 2D plane with Cartesian coordinate system. The only crime-affected road of your city is the *x*-axis. Currently, there are *n* criminals along the road. No police station has been bui...
4,874
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* phone numbers in Polycarp's contacts on his phone. Each number is a 9-digit integer, starting with a digit different from 0. All the numbers are distinct. There is the latest version of Berdroid OS installed on Poly...
4,875
Title: I.O.U. Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine that there is a group of three friends: A, B and Π‘. A owes B 20 rubles and B owes C 20 rubles. The total sum of the debts is 40 rubles. You can see that the debts are not organized in a very optimal manner. Let's rearran...
4,876
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: For a connected undirected weighted graph *G*, MST (minimum spanning tree) is a subgraph of *G* that contains all of *G*'s vertices, is a tree, and sum of its edges is minimum possible. You are given a graph *G*. If you run a MST...
4,877
Title: Substring and Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Polycarpus got hold of two non-empty strings *s* and *t*, consisting of lowercase Latin letters. Polycarpus is quite good with strings, so he immediately wondered, how many different pairs of "*x* *y*"...
4,878
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Crazy Town is a plane on which there are *n* infinite line roads. Each road is defined by the equation *a**i**x*<=+<=*b**i**y*<=+<=*c**i*<==<=0, where *a**i* and *b**i* are not both equal to the zero. The roads divide the plane in...
4,879
Title: Online Meeting Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nearly each project of the F company has a whole team of developers working on it. They often are in different rooms of the office in different cities and even countries. To keep in touch and track the results of the pro...
4,880
Title: Fixed Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: A permutation of length *n* is an integer sequence such that each integer from 0 to (*n*<=-<=1) appears exactly once in it. For example, sequence [0,<=2,<=1] is a permutation of length 3 while both [0,<=2,<=2] and [1,<=2,<...
4,881
Title: Title Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya has recently finished writing a book. Now he faces the problem of giving it the title. Vasya wants the title to be vague and mysterious for his book to be noticeable among others. That's why the title should be represented by a...
4,882
Title: Balls and Boxes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Vasya had *n* boxes with balls in the room. The boxes stood in a row and were numbered with numbers from 1 to *n* from left to right. Once Vasya chose one of the boxes, let's assume that its number is *i*, took ...
4,883
Title: Johny Likes Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Johny likes numbers *n* and *k* very much. Now Johny wants to find the smallest integer *x* greater than *n*, so it is divisible by the number *k*. Input Specification: The only line contains two integers *n* and *...
4,884
Title: Connected Components Time Limit: None seconds Memory Limit: None megabytes Problem Description: We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of *n* computers and *m* cables that connect some pairs of computers. In other words, t...
4,885
Title: Geometry Horse Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya plays the Geometry Horse. The game goal is to destroy geometric figures of the game world. A certain number of points is given for destroying each figure depending on the figure type and the current factor value. ...
4,886
Title: New Year Santa Network Time Limit: None seconds Memory Limit: None megabytes Problem Description: New Year is coming in Tree World! In this world, as the name implies, there are *n* cities connected by *n*<=-<=1 roads, and for any two distinct cities there always exists a path between them. The cities are num...
4,887
Title: Gena's Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's the year 4527 and the tanks game that we all know and love still exists. There also exists Great Gena's code, written in 2016. The problem this code solves is: given the number of tanks that go into the battle from eac...
4,888
Title: Permutations Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* *k*-digit integers. You have to rearrange the digits in the integers so that the difference between the largest and the smallest number was minimum. Digits should be rearranged by the same rule in all int...
4,889
Title: Renting Bikes Time Limit: None seconds Memory Limit: None megabytes Problem Description: A group of *n* schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them. The renting site offered them *m* bikes. The renting price is different for different bikes, renting the *j*-th b...
4,890
Title: Home Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: The main street of Berland is a straight line with *n* houses built along it (*n* is an even number). The houses are located at both sides of the street. The houses with odd numbers are at one side of the street and are nu...
4,891
Title: The Great Marathon Time Limit: 4 seconds Memory Limit: 256 megabytes Problem Description: On the Berland Dependence Day it was decided to organize a great marathon. Berland consists of *n* cities, some of which are linked by two-way roads. Each road has a certain length. The cities are numbered from 1 to *n*....
4,892
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have *n* devices that you want to use simultaneously. The *i*-th device uses *a**i* units of power per second. This usage is continuous. That is, in λ seconds, the device will use λ·*a**i* units of power. The *i*-th device cu...
4,893
Title: Wizards and Demonstration Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some country is populated by wizards. They want to organize a demonstration. There are *n* people living in the city, *x* of them are the wizards who will surely go to the demonstration. Other city people (*n...
4,894
Title: Turn Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya started working in a machine vision company of IT City. Vasya's team creates software and hardware for identification of people by their face. One of the project's know-how is a camera rotating around its optical axis on sh...
4,895
Title: Theft of Blueprints Time Limit: None seconds Memory Limit: None megabytes Problem Description: Insurgents accidentally got hold of the plan of a top secret research polygon created on a distant planet for the needs of the Galaxy Empire. The insurgents suppose that this polygon is developing new deadly weapon....
4,896
Title: Replace All Time Limit: None seconds Memory Limit: None megabytes Problem Description: Igor the analyst is at work. He learned about a feature in his text editor called "Replace All". Igor is too bored at work and thus he came up with the following problem: Given two strings *x* and *y* which consist of the ...
4,897
Title: Arthur and Walls Time Limit: None seconds Memory Limit: None megabytes Problem Description: Finally it is a day when Arthur has enough money for buying an apartment. He found a great option close to the center of the city with a nice price. Plan of the apartment found by Arthur looks like a rectangle *n*<=Γ—<...
4,898
Title: Fifa and Fafa Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fifa and Fafa are sharing a flat. Fifa loves video games and wants to download a new soccer game. Unfortunately, Fafa heavily uses the internet which consumes the quota. Fifa can access the internet through his Wi-Fi acce...
4,899