task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Dungeons and Candies Time Limit: None seconds Memory Limit: None megabytes Problem Description: During the loading of the game "Dungeons and Candies" you are required to get descriptions of *k* levels from the server. Each description is a map of an *n*<=×<=*m* checkered rectangular field. Some cells of the f...
600
Title: Bear and Paradox Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a big polar bear. He prepared *n* problems for an algorithmic contest. The *i*-th problem has initial score *p**i*. Also, testers said that it takes *t**i* minutes to solve the *i*-th problem. Problems aren't ...
601
Title: Soldier and Traveling Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the country there are *n* cities and *m* bidirectional roads between them. Each city has an army. Army of the *i*-th city consists of *a**i* soldiers. Now soldiers roam. After roaming each soldier has to either...
602
Title: Present Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his informatics teacher is going to have a birthday and the beaver has decided to prepare a present for her. He planted *n* flowers in a row o...
603
Title: Directed Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of *n* towns numbered from 1 to *n*. There are *n* directed roads in the Udayland. *i*-th of them goes from tow...
604
Title: Number Table Time Limit: 2 seconds Memory Limit: 216 megabytes Problem Description: As it has been found out recently, all the Berland's current economical state can be described using a simple table *n*<=×<=*m* in size. *n* — the number of days in each Berland month, *m* — the number of months. Thus, a table...
605
Title: Whose sentence is it? Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day, liouzhou_101 got a chat record of Freda and Rainbow. Out of curiosity, he wanted to know which sentences were said by Freda, and which were said by Rainbow. According to his experience, he thought that Fr...
606
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in differ...
607
Title: Sweets Game Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: Karlsson has visited Lillebror again. They found a box of chocolates and a big whipped cream cake at Lillebror's place. Karlsson immediately suggested to divide the sweets fairly between Lillebror and himself. Specifically, to ...
608
Title: Slime Combining Time Limit: None seconds Memory Limit: None megabytes Problem Description: Your friend recently gave you some slimes for your birthday. You have *n* slimes all initially with value 1. You are going to play a game with these slimes. Initially, you put a single slime by itself in a row. Then, y...
609
Title: Okabe and Future Gadget Laboratory Time Limit: None seconds Memory Limit: None megabytes Problem Description: Okabe needs to renovate the Future Gadget Laboratory after he tried doing some crazy experiments! The lab is represented as an *n* by *n* square grid of integers. A good lab is defined as a lab in whi...
610
Title: Pair Of Lines Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* points on Cartesian plane. Every point is a lattice point (i.<=e. both of its coordinates are integers), and all points are distinct. You may draw two straight lines (not necessarily distinct). Is it po...
611
Title: Fafa and Ancient Alphabet Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ancient Egyptians are known to have used a large set of symbols to write on the walls of the temples. Fafa and Fifa went to one of the temples and found two non-empty words *S*1 and *S*2 of equal lengths on t...
612
Title: April Fools' Problem (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The marmots need to prepare *k* problems for HC2 over *n* days. Each problem, once prepared, also has to be printed. The preparation of a problem on day *i* (at most one per day) costs *a**i* CHF, and the...
613
Title: Birds Time Limit: None seconds Memory Limit: None megabytes Problem Description: Apart from plush toys, Imp is a huge fan of little yellow birds! To summon birds, Imp needs strong magic. There are *n* trees in a row on an alley in a park, there is a nest on each of the trees. In the *i*-th nest there are *c*...
614
Title: Limak and Shooting Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bearland is a dangerous place. Limak can’t travel on foot. Instead, he has *k* magic teleportation stones. Each stone can be used at most once. The *i*-th stone allows to teleport to a point (*ax**i*,<=*ay**i*...
615
Title: Mr. Kitayuta's Technology Time Limit: None seconds Memory Limit: None megabytes Problem Description: Shuseki Kingdom is the world's leading nation for innovation and technology. There are *n* cities in the kingdom, numbered from 1 to *n*. Thanks to Mr. Kitayuta's research, it has finally become possible to c...
616
Title: Painting Eggs Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Bitlandians are quite weird people. They have very peculiar customs. As is customary, Uncle J. wants to have *n* eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work. The kids...
617
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has a sequence of cubes and exactly one integer is written on each cube. Vasya exhibited all his cubes in a row. So the sequence of numbers written on the cubes in the order from the left to the right equals to *a*1,<=*a*2,<...
618
Title: Anton and Classes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anton likes to play chess. Also he likes to do programming. No wonder that he decided to attend chess classes and programming classes. Anton has *n* variants when he will attend chess classes, *i*-th variant is given...
619
Title: Mirror Room Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine an *n*<=×<=*m* grid with some blocked cells. The top left cell in the grid has coordinates (1,<=1) and the bottom right cell has coordinates (*n*,<=*m*). There are *k* blocked cells in the grid and others are empty....
620
Title: T-primes Time Limit: None seconds Memory Limit: None megabytes Problem Description: We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer *t* Т-prime, if *t* has exactly three distinct positive divisors. You are given an ar...
621
Title: Parallelogram is Back Time Limit: None seconds Memory Limit: None megabytes Problem Description: Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate ...
622
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;*m*] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn't exist an integ...
623
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: It can be shown that any positive integer *x* can be uniquely represented as *x*<==<=1<=+<=2<=+<=4<=+<=...<=+<=2*k*<=-<=1<=+<=*r*, where *k* and *r* are integers, *k*<=≥<=0, 0<=&lt;<=*r*<=≤<=2*k*. Let's call that representation pr...
624
Title: none 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 sequence their greatest c...
625
Title: Dima and Hares Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima liked the present he got from Inna very much. He liked the present he got from Seryozha even more. Dima felt so grateful to Inna about the present that he decided to buy her *n* hares. Inna was very happy. She lin...
626
Title: Bear and Raspberry Time Limit: None seconds Memory Limit: None megabytes Problem Description: The bear decided to store some raspberry for the winter. He cunningly found out the price for a barrel of honey in kilos of raspberry for each of the following *n* days. According to the bear's data, on the *i*-th (1...
627
Title: Circling Round Treasures Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a map as a rectangle table. Each cell of the table is either an obstacle, or a treasure with a certain price, or a bomb, or an empty cell. Your initial position is also given to you. You can go from o...
628
Title: Making Genome in Berland Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has noting in common with the genome that we've used to: it can...
629
Title: Edge coloring of bipartite graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an undirected bipartite graph without multiple edges. You should paint the edges of graph to minimal number of colours, so that no two adjacent edges have the same colour. Input Specifica...
630
Title: Bracket Sequences Concatenation Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting ...
631
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya and Kolya play a game with a string, using the following rules. Initially, Kolya creates a string *s*, consisting of small English letters, and uniformly at random chooses an integer *k* from a segment [0,<=*len*(*s*)<=-<=1]...
632
Title: Knights of a Polygonal Table Time Limit: None seconds Memory Limit: None megabytes Problem Description: Unlike Knights of a Round Table, Knights of a Polygonal Table deprived of nobility and happy to kill each other. But each knight has some power and a knight can kill another knight if and only if his power ...
633
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a* with *n* distinct integers. Construct an array *b* by permuting *a* such that for every non-empty subset of indices *S*<==<={*x*1,<=*x*2,<=...,<=*x**k*} (1<=≤<=*x**i*<=≤<=*n*, 0<=&lt;<=*k*<=&lt;<=*n*) th...
634
Title: Escape Through Leaf Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tree with *n* nodes (numbered from 1 to *n*) rooted at node 1. Also, each node has two values associated with it. The values for *i*-th node are *a**i* and *b**i*. You can jump from a node to any no...
635
Title: Nikita and Order Statistics Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nikita likes tasks on order statistics, for example, he can easily find the $k$-th number in increasing order on a segment of an array. But now Nikita wonders how many segments of an array there are such tha...
636
Title: Break Up Time Limit: None seconds Memory Limit: None megabytes Problem Description: Again, there are hard times in Berland! Many towns have such tensions that even civil war is possible. There are *n* towns in Reberland, some pairs of which connected by two-way roads. It is not guaranteed that it is possibl...
637
Title: Given Length and Sum of Digits... Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a positive integer *m* and a non-negative integer *s*. Your task is to find the smallest and the largest of the numbers that have length *m* and sum of digits *s*. The required numbers should ...
638
Title: PLEASE Time Limit: None seconds Memory Limit: None megabytes Problem Description: As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney'...
639
Title: Tricky Password Time Limit: None seconds Memory Limit: None megabytes Problem Description: In order to ensure confidentiality, the access to the "Russian Code Cup" problems is password protected during the problem development process. To select a password, the jury can generate a special table that contains ...
640
Title: Sail Time Limit: None seconds Memory Limit: None megabytes Problem Description: The polar bears are going fishing. They plan to sail from (*s**x*,<=*s**y*) to (*e**x*,<=*e**y*). However, the boat can only sail by wind. At each second, the wind blows in one of these directions: east, south, west or north. Assu...
641
Title: Kingdom and its Cities Time Limit: None seconds Memory Limit: None megabytes Problem Description: Meanwhile, the kingdom of K is getting ready for the marriage of the King's daughter. However, in order not to lose face in front of the relatives, the King should first finish reforms in his kingdom. As the King...
642
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Innokenty is a president of a new football league in Byteland. The first task he should do is to assign short names to all clubs to be shown on TV next to the score. Of course, the short names should be distinct, and Innokenty wan...
643
Title: Berland collider Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Recently the construction of Berland collider has been completed. Collider can be represented as a long narrow tunnel that contains *n* particles. We associate with collider 1-dimensional coordinate system, going from left...
644
Title: Dense Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *s*, consisting of lowercase English letters, and the integer *m*. One should choose some symbols from the given string so that any contiguous subsegment of length *m* has at least one selected...
645
Title: Alyona and Triangles Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* points with integer coordinates on the plane. Points are given in a way such that there is no triangle, formed by any three of these *n* points, which area exceeds *S*. Alyona tried to construct ...
646
Title: Maximum Control (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Resistance is trying to take control over all planets in a particular solar system. This solar system is shaped like a tree. More precisely, some planets are connected by bidirectional hyperspace tunnels in s...
647
Title: Demonstration Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize...
648
Title: Fake News (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Thanks to your help, Heidi is confident that no one can fool her. She has now decided to post some fake news on the HC2 Facebook page. However, she wants to be able to communicate to the HC2 committee that the post i...
649
Title: Adding Digits Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has got two number: *a* and *b*. However, Vasya finds number *a* too short. So he decided to repeat the operation of lengthening number *a* *n* times. One operation of lengthening a number means adding exactly one ...
650
Title: Checkpoints Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya takes part in the orienteering competition. There are *n* checkpoints located along the line at coordinates *x*1,<=*x*2,<=...,<=*x**n*. Vasya starts at the point with coordinate *a*. His goal is to visit at least *n*<...
651
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Levko loves strings of length *n*, consisting of lowercase English letters, very much. He has one such string *s*. For each string *t* of length *n*, Levko defines its beauty relative to *s* as the number of pairs of indexes *i*, ...
652
Title: Berland Traffic Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland traffic is very different from traffic in other countries. The capital of Berland consists of *n* junctions and *m* roads. Each road connects a pair of junctions. There can be multiple roads between a pair of ju...
653
Title: Chloe and pleasant prizes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Generous sponsors of the olympiad in which Chloe and Vladik took part allowed all the participants to choose a prize for them on their own. Christmas is coming, so sponsors decided to decorate the Christmas tr...
654
Title: Broken robot Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: You received as a gift a very clever robot walking on a rectangular board. Unfortunately, you understood that it is broken and behaves rather strangely (randomly). The board consists of *N* rows and *M* columns of cells. The r...
655
Title: Queue Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are *n* people in the queue. For each person we know time *t**i* needed to serve him. A person will be disappointed if the time...
656
Title: Phillip and Trains Time Limit: None seconds Memory Limit: None megabytes Problem Description: The mobile application store has a new game called "Subway Roller". The protagonist of the game Philip is located in one end of the tunnel and wants to get out of the other one. The tunnel is a rectangular field con...
657
Title: Hacker, pack your bags! Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha. So the hacker began to work hard in order to get rid of boredom. It means that Leha beg...
658
Title: Spongebob and Squares Time Limit: None seconds Memory Limit: None megabytes Problem Description: Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly *x* distinct squares in the table consisting of *n* ...
659
Title: Прокат велосипедов Time Limit: None seconds Memory Limit: None megabytes Problem Description: Как известно, в теплую погоду многие жители крупных городов пользуются сервисами городского велопроката. Вот и Аркадий сегодня будет добираться от школы до дома, используя городские велосипеды. Школа и дом находятся...
660
Title: Product Sum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Blake is the boss of Kris, however, this doesn't spoil their friendship. They often gather at the bar to talk about intriguing problems about maximising some values. This time the problem is really special. You are given a...
661
Title: Policeman and a Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tree (a connected non-oriented graph without cycles) with vertices numbered from 1 to *n*, and the length of the *i*-th edge is *w**i*. In the vertex *s* there is a policeman, in the vertices *x*1,<...
662
Title: Predict Outcome of the Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* games in a football tournament. Three teams are participating in it. Currently *k* games had already been played. You are an avid football fan, but recently you missed the whole *k* games. Fo...
663
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Suppose you have two polynomials and . Then polynomial can be uniquely represented in the following way: This can be done using [long division](https://en.wikipedia.org/wiki/Polynomial_long_division). Here, denotes the degree ...
664
Title: Bug in Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the *n* ...
665
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: DZY loves Fast Fourier Transformation, and he enjoys using it. Fast Fourier Transformation is an algorithm used to calculate convolution. Specifically, if *a*, *b* and *c* are sequences with length *n*, which are indexed from 0 t...
666
Title: Wizards and Bets Time Limit: None seconds Memory Limit: None megabytes Problem Description: In some country live wizards. They like to make weird bets. Two wizards draw an acyclic directed graph with *n* vertices and *m* edges (the graph's vertices are numbered from 1 to *n*). A source is a vertex with no in...
667
Title: Dasha and cyclic table Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dasha is fond of challenging puzzles: Rubik's Cube 3<=×<=3<=×<=3, 4<=×<=4<=×<=4, 5<=×<=5<=×<=5 and so on. This time she has a cyclic table of size *n*<=×<=*m*, and each cell of the table contains a lowercase Engl...
668
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: On the way home, Karen decided to stop by the supermarket to buy some groceries. She needs to buy a lot of goods, but since she is a student her budget is still quite limited. In fact, she can only spend up to *b* dollars. The s...
669
Title: Felicity's Big Secret Revealed Time Limit: None seconds Memory Limit: None megabytes Problem Description: The gym leaders were fascinated by the evolutions which took place at Felicity camp. So, they were curious to know about the secret behind evolving Pokemon. The organizers of the camp gave the gym leade...
670
Title: Clique in the Divisibility Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you must know, the maximum clique problem in an arbitrary graph is *NP*-hard. Nevertheless, for some graphs of specific kinds it can be solved effectively. Just in case, let us remind you that a cli...
671
Title: Game Outcome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sherlock Holmes and Dr. Watson played some game on a checkered board *n*<=×<=*n* in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each s...
672
Title: Equidistant String Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Susie loves strings. Today she calculates distances between them. As Susie is a small girl after all, her strings contain only digits zero and one. She uses the definition of Hamming distance: We will define ...
673
Title: Graph Reconstruction Time Limit: None seconds Memory Limit: None megabytes Problem Description: I have an undirected graph consisting of *n* nodes, numbered 1 through *n*. Each node has at most two incident edges. For each pair of nodes, there is at most an edge connecting them. No edge connects a node to its...
674
Title: Three Arrays Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are three arrays *a*, *b* and *c*. Each of them consists of *n* integers. SmallY wants to find three integers *u*, *v*, *w* (0<=≤<=*u*,<=*v*,<=*w*<=≤<=*n*) such that the following condition holds: each number that ap...
675
Title: Fingerprints Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are locked in a room with a door that has a keypad with 10 keys corresponding to digits from 0 to 9. To escape from the room, you need to enter a correct code. You also have a sequence of digits. Some keys on the keyp...
676
Title: Valera and Tubes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valera has got a rectangle table consisting of *n* rows and *m* columns. Valera numbered the table rows starting from one, from top to bottom and the columns – starting from one, from left to right. We will represent ...
677
Title: Mahmoud and a Message Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mahmoud wrote a message *s* of length *n*. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disappeared wh...
678
Title: Petr and Book Time Limit: None seconds Memory Limit: None megabytes Problem Description: One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly *n* pages. Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight s...
679
Title: Mini Metro Time Limit: None seconds Memory Limit: None megabytes Problem Description: In a simplified version of a "Mini Metro" game, there is only one subway line, and all the trains go in the same direction. There are $n$ stations on the line, $a_i$ people are waiting for the train at the $i$-th station at ...
680
Title: Replicating Processes Time Limit: None seconds Memory Limit: None megabytes Problem Description: A Large Software Company develops its own social network. Analysts have found that during the holidays, major sporting events and other significant events users begin to enter the network more frequently, resultin...
681
Title: Cut the pie Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady reached the *n*-th level in Township game, so Masha decided to bake a pie for him! Of course, the pie has a shape of convex *n*-gon, i.e. a polygon with *n* vertices. Arkady decided to cut the pie in two equal in ar...
682
Title: Wilbur and Swimming Pool Time Limit: None seconds Memory Limit: None megabytes Problem Description: After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the shape of a rectangle in his backyard. He has set up coordinate axes, and he wants the sides of the rectangle to be parall...
683
Title: Case of the Zeros and Ones Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrewid the Android is a galaxy-famous detective. In his free time he likes to think about strings containing zeros and ones. Once he thought about a string of length *n* consisting of zeroes and ones. Cons...
684
Title: Table Decorations Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have *r* red, *g* green and *b* blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to some table shouldn't have the same color. What maximum number *...
685
Title: System Administrator Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Bob got a job as a system administrator in X corporation. His first task was to connect *n* servers with the help of *m* two-way direct connection so that it becomes possible to transmit data from one server to any oth...
686
Title: Sloth Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sloth is bad, mkay? So we decided to prepare a problem to punish lazy guys. You are given a tree, you should count the number of ways to remove an edge from it and then add an edge to it such that the final graph is a tree and h...
687
Title: Warrior and Archer Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current gi...
688
Title: Coins Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In Berland a money reform is being prepared. New coins are being introduced. After long economic calculations was decided that the most expensive coin should possess the denomination of exactly *n* Berland dollars. Also the following...
689
Title: Tournament Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The tournament «Sleepyhead-2010» in the rapid falling asleep has just finished in Berland. *n* best participants from the country have participated in it. The tournament consists of games, each of them is a match between two par...
690
Title: Party Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: *n* people came to a party. Then those, who had no friends among people at the party, left. Then those, who had exactly 1 friend among those who stayed, left as well. Then those, who had exactly 2,<=3,<=...,<=*n*<=-<=1 friends among ...
691
Title: Imbalance Value of a Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tree *T* consisting of *n* vertices. A number is written on each vertex; the number written on vertex *i* is *a**i*. Let's denote the function *I*(*x*,<=*y*) as the difference between maximum a...
692
Title: Minimum Diameter Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* points on the plane. You need to delete exactly *k* of them (*k*<=&lt;<=*n*) so that the diameter of the set of the remaining *n*<=-<=*k* points were as small as possible. The diameter of a set of poi...
693
Title: Holidays Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: School holidays come in Berland. The holidays are going to continue for *n* days. The students of school №*N* are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the ...
694
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today Pari and Arya are playing a game called Remainders. Pari chooses two positive integer *x* and *k*, and tells Arya *k* but not *x*. Arya have to find the value . There are *n* ancient numbers *c*1,<=*c*2,<=...,<=*c**n* and P...
695
Title: Winnie-the-Pooh and honey Time Limit: None seconds Memory Limit: None megabytes Problem Description: As we all know, Winnie-the-Pooh just adores honey. Ones he and the Piglet found out that the Rabbit has recently gotten hold of an impressive amount of this sweet and healthy snack. As you may guess, Winnie an...
696
Title: Platforms Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: In one one-dimensional world there are *n* platforms. Platform with index *k* (platforms are numbered from 1) is a segment with coordinates [(*k*<=-<=1)*m*,<=(*k*<=-<=1)*m*<=+<=*l*], and *l*<=&lt;<=*m*. Grasshopper Bob starts to j...
697
Title: Well-known Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Numbers *k*-bonacci (*k* is integer, *k*<=&gt;<=1) are a generalization of Fibonacci numbers and are determined as follows: - *F*(*k*,<=*n*)<==<=0, for integer *n*, 1<=≤<=*n*<=&lt;<=*k*; - *F*(*k*,<=*k*)<==<=1; - ...
698
Title: Average Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*. Find all such indices *i*, that the *i*-th element equals the arithmetic mean of all other elements (that is all elements except for this one). ...
699