task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Mafia Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day *n* friends gathered together to play "Mafia". During each round of the game some player must be the supervisor and other *n*<=-<=1 people take part in the game. For each person we know in how many rounds he wants to be a...
800
Title: Banners Time Limit: None seconds Memory Limit: None megabytes Problem Description: All modern mobile applications are divided into free and paid. Even a single application developers often release two versions: a paid version without ads and a free version with ads. Suppose that a paid version of the app cos...
801
Title: Lara Croft and the New Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil...
802
Title: Dreamoon and Sets 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 ...
803
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Karafs is some kind of vegetable in shape of an 1<=Γ—<=*h* rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs. Each Karafs has a positive integer height. ...
804
Title: Little Pony and Summer Sun Celebration Time Limit: None seconds Memory Limit: None megabytes Problem Description: Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Prin...
805
Title: Number With The Given Amount Of Divisors Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Given the number *n*, find the smallest positive integer which has exactly *n* divisors. It is guaranteed that for the given *n* the answer will not exceed 1018. Input Specification: The first line...
806
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequence of ABCDEF. A subs...
807
Title: Choosing Subtree is Fun Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a tree consisting of *n* vertices. The vertices are numbered from 1 to *n*. Let's define the length of an interval [*l*,<=*r*] as the value *r*<=-<=*l*<=+<=1. The score of a subtree of this tree is the...
808
Title: Test Data Generation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Test data generation is not an easy task! Often, generating big random test cases is not enough to ensure thorough testing of solutions for correctness. For example, consider a problem from an old Codeforces round...
809
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to *n* (*n*<=β‰₯<=2) burles and the amount of tax he has to pay is calculated as the maximum divisor of *n* (not e...
810
Title: Palindrome pairs Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a non-empty string *s* consisting of lowercase letters. Find the number of pairs of non-overlapping palindromic substrings of this string. In a more formal way, you have to find the quantity of tuples (*...
811
Title: Wallpaper Time Limit: None seconds Memory Limit: None megabytes Problem Description: Having bought his own apartment, Boris decided to paper the walls in every room. Boris's flat has *n* rooms, each of which has the form of a rectangular parallelepiped. For every room we known its length, width and height of ...
812
Title: Help Shrek and Donkey 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Having learned (not without some help from the Codeforces participants) to play the card game from the previous round optimally, Shrek and Donkey (as you may remember, they too live now in the Kingdom of Far Far...
813
Title: Send the Fool Further! (hard) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Heidi is terrified by your estimate and she found it unrealistic that her friends would collaborate to drive her into debt. She expects that, actually, each person will just pick a random friend to send He...
814
Title: Little Brother Time Limit: None seconds Memory Limit: None megabytes Problem Description: Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister. Masha has just returned from geometry lesson so she instantly noticed some interesting fac...
815
Title: Counting Kangaroos is Fun Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* kangaroos with pockets. Each kangaroo has a size (integer number). A kangaroo can go into another kangaroo's pocket if and only if the size of kangaroo who hold the kangaroo is at least twice as ...
816
Title: Polo the Penguin and Lucky Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Everybody knows that lucky numbers are positive integers that contain only lucky digits 4 and 7 in their decimal representation. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Polo...
817
Title: Swaps Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* players sitting at a round table. All of them have *s* cards of *n* colors in total. Besides, initially the first person had cards of only the first color, the second one had cards of only the second color and so on...
818
Title: Facetook Priority Wall Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Facetook is a well known social network website, and it will launch a new feature called Facetook Priority Wall. This feature will sort all posts from your friends according to the priority factor (it will be describ...
819
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nephren is playing a game with little leprechauns. She gives them an infinite array of strings, *f*0... ∞. *f*0 is "What are you doing at the end of the world? Are you busy? Will you save us?". She wants to let more people kn...
820
Title: Roads in Berland Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There are *n* cities numbered from 1 to *n* in Berland. Some of them are connected by two-way roads. Each road has its own length β€” an integer number from 1 to 1000. It is known that from each city it is possible to get to...
821
Title: Regular Bracket Sequence Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: A bracket sequence is called regular if it is possible to obtain correct arithmetic expression by inserting characters Β«+Β» and Β«1Β» into this sequence. For example, sequences Β«(())()Β», Β«()Β» and Β«(()(()))Β» are regula...
822
Title: You're Given a String... Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: You're given a string of lower-case Latin letters. Your task is to find the length of its longest substring that can be met in the string at least twice. These occurrences can overlap (see sample test 2). Input Sp...
823
Title: Santa Claus and a Place in a Class Time Limit: None seconds Memory Limit: None megabytes Problem Description: Santa Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are *n* lanes of *m* desks each, and there are two work...
824
Title: Contest Balloons Time Limit: None seconds Memory Limit: None megabytes Problem Description: One tradition of ACM-ICPC contests is that a team gets a balloon for every solved problem. We assume that the submission time doesn't matter and teams are sorted only by the number of balloons they have. It means that ...
825
Title: Binary Key Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's assume that *p* and *q* are strings of positive length, called the container and the key correspondingly, string *q* only consists of characters 0 and 1. Let's take a look at a simple algorithm that extracts message *s...
826
Title: TorCoder Time Limit: None seconds Memory Limit: None megabytes Problem Description: A boy named Leo doesn't miss a single TorCoder contest round. On the last TorCoder round number 100666 Leo stumbled over the following problem. He was given a string *s*, consisting of *n* lowercase English letters, and *m* qu...
827
Title: Bulbo Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bananistan is a beautiful banana republic. Beautiful women in beautiful dresses. Beautiful statues of beautiful warlords. Beautiful stars in beautiful nights. In Bananistan people play this crazy game – Bulbo. There’s an array o...
828
Title: Binary Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a matrix of size *n*<=Γ—<=*m*. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a co...
829
Title: Rock-paper-scissors Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Uncle Fyodor, Matroskin the Cat and Sharic the Dog live their simple but happy lives in Prostokvashino. Sometimes they receive parcels from Uncle Fyodor’s parents and sometimes from anonymous benefactors, in which case ...
830
Title: Sonya and Ice Cream Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sonya likes ice cream very much. She eats it even during programming competitions. That is why the girl decided that she wants to open her own ice cream shops. Sonya lives in a city with $n$ junctions and $n-1$ str...
831
Title: Complete the Word Time Limit: None seconds Memory Limit: None megabytes Problem Description: ZS the Coder loves to read the dictionary. He thinks that a word is nice if there exists a substring (contiguous segment of letters) of it of length 26 where each letter of English alphabet appears exactly once. In pa...
832
Title: Tiling with Hexagons Time Limit: None seconds Memory Limit: None megabytes Problem Description: Several ages ago Berland was a kingdom. The King of Berland adored math. That's why, when he first visited one of his many palaces, he first of all paid attention to the floor in one hall. The floor was tiled with ...
833
Title: Bear and Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: The bear has a string *s*<==<=*s*1*s*2... *s*|*s*| (record |*s*| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices *i*,<=*j* (1<=≀<=*i*<=≀<=*j...
834
Title: XOR-pyramid Time Limit: None seconds Memory Limit: None megabytes Problem Description: For an array $b$ of length $m$ we define the function $f$ as where $\oplus$ is [bitwise exclusive OR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR). For example, $f(1,2,4,8)=f(1\oplus2,2\oplus4,4\oplus8)=f(3,6,12)...
835
Title: Sonya and Exhibition Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition. There are $n$ flowers in a row in the ...
836
Title: Gerald and Giant Chess Time Limit: None seconds Memory Limit: None megabytes Problem Description: Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we'll just say that the game takes place on an *h*<=Γ—<=*w* field, and it is painted in two colors, but not like in chess. Al...
837
Title: Double Knapsack Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two multisets *A* and *B*. Each multiset has exactly *n* integers each between 1 and *n* inclusive. Multisets may contain multiple copies of the same number. You would like to find a nonempty subset of *A...
838
Title: Randomizer Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerald got tired of playing board games with the usual six-sided die, and he bought a toy called Randomizer. It functions as follows. A Randomizer has its own coordinate plane on which a strictly convex polygon is painted, ...
839
Title: Pashmak and Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pashmak's homework is a problem about graphs. Although he always tries to do his homework completely, he can't solve this problem. As you know, he's really weak at graph theory; so try to help him in solving the probl...
840
Title: Island Puzzle Time Limit: None seconds Memory Limit: None megabytes Problem Description: A remote island chain contains *n* islands, labeled 1 through *n*. Bidirectional bridges connect the islands to form a simple cycleΒ β€” a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridg...
841
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) an...
842
Title: Snacktower Time Limit: None seconds Memory Limit: None megabytes Problem Description: According to an old legeng, a long time ago Ankh-Morpork residents did something wrong to miss Fortune, and she cursed them. She said that at some time *n* snacks of distinct sizes will fall on the city, and the residents sh...
843
Title: Stones on the Table Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row ...
844
Title: Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vitaly has an array of *n* distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: 1. The product of all numbers in the first set is less than zero (<=&lt;<=0). 1. T...
845
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* points on a straight line, and the *i*-th point among them is located at *x**i*. All these coordinates are distinct. Determine the number *m* β€” the smallest number of points you should add on the line to make the di...
846
Title: Beautiful Paintings Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* pictures delivered for the new exhibition. The *i*-th painting has beauty *a**i*. We know that a visitor becomes happy every time he passes from a painting to a more beautiful one. We are allowed to a...
847
Title: Tree Requests Time Limit: None seconds Memory Limit: None megabytes Problem Description: Roman planted a tree consisting of *n* vertices. Each vertex contains a lowercase English letter. Vertex 1 is the root of the tree, each of the *n*<=-<=1 remaining vertices has a parent in the tree. Vertex is connected wi...
848
Title: Sets Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose *n* non-empty sets in such a way, that no two of them have common elements. One day he wanted to show his ...
849
Title: none 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 integ...
850
Title: Champions' League Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the autumn of this year, two Russian teams came into the group stage of the most prestigious football club competition in the world β€” the UEFA Champions League. Now, these teams have already started to play in the ...
851
Title: Andryusha and Colored Balloons Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andryusha goes through a park each day. The squares and paths between them look boring to Andryusha, so he decided to decorate them. The park consists of *n* squares connected with (*n*<=-<=1) bidirectio...
852
Title: Expression Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One day Vasya was solving arithmetical problems. He wrote down an expression *a*<=+<=*b*<==<=*c* in his notebook. When the teacher checked Vasya's work it turned out that Vasya had solved the problem incorrectly. Now Vasya tries...
853
Title: Adam and Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: When Adam gets a rooted tree (connected non-directed graph without cycles), he immediately starts coloring it. More formally, he assigns a color to each edge of the tree so that it meets the following two conditions: - ...
854
Title: Fancy Fence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot. He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can...
855
Title: Vanya and Balloons Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vanya plays a game of balloons on the field of size *n*<=Γ—<=*n*, where each cell contains a balloon with one of the values 0, 1, 2 or 3. The goal is to destroy a cross, such that the product of all values of balloons...
856
Title: Plus and xor Time Limit: 0 seconds Memory Limit: 256 megabytes Problem Description: Bitwise exclusive OR (or bitwise addition modulo two) is a binary operation which is equivalent to applying logical exclusive OR to every pair of bits located on the same positions in binary notation of operands. In other word...
857
Title: Try and Catch Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is developing his own programming language VPL (Vasya Programming Language). Right now he is busy making the system of exceptions. He thinks that the system of exceptions must function like that. The exceptions are...
858
Title: Growing Mushrooms Time Limit: None seconds Memory Limit: None megabytes Problem Description: Each year in the castle of Dwarven King there is a competition in growing mushrooms among the dwarves. The competition is one of the most prestigious ones, and the winner gets a wooden salad bowl. This year's event br...
859
Title: Next Test Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Β«PolygonΒ» is a system which allows to create programming tasks in a simple and professional way. When you add a test to the problem, the corresponding form asks you for the test index. As in most cases it is clear which index the...
860
Title: Vasya and Basketball Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya follows a basketball game and marks the distances from which each team makes a throw. He knows that each successful throw has value of either 2 or 3 points. A throw is worth 2 points if the distance it was ma...
861
Title: Restoring Increasing Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Peter wrote on the board a strictly increasing sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*. Then Vasil replaced some digits in the numbers of this sequence by question marks. Thus, each questi...
862
Title: Beavermuncher-0xFF Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: "Eat a beaver, save a tree!" β€” That will be the motto of ecologists' urgent meeting in Beaverley Hills. And the whole point is that the population of beavers on the Earth has reached incredible sizes! Each day their num...
863
Title: Oleg and chess Time Limit: None seconds Memory Limit: None megabytes Problem Description: Oleg the bank client solves an interesting chess problem: place on *n*<=Γ—<=*n* chessboard the maximum number of rooks so that they don't beat each other. Of course, no two rooks can share the same cell. Remind that a ro...
864
Title: Least Cost Bracket Sequence Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: This is yet another problem on regular bracket sequences. A bracket sequence is called regular, if by inserting "+" and "1" into it we get a correct mathematical expression. For example, sequences "(())()", "()"...
865
Title: Apple Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rooted tree with *n* vertices. In each leaf vertex there's a single integer β€” the number of apples in this vertex. The weight of a subtree is the sum of all numbers in this subtree leaves. For instance, the...
866
Title: Candy Bags Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerald has *n* younger brothers and their number happens to be even. One day he bought *n*2 candy bags. One bag has one candy, one bag has two candies, one bag has three candies and so on. In fact, for each integer *k* from ...
867
Title: Diversity Time Limit: None seconds Memory Limit: None megabytes Problem Description: Calculate the minimum number of characters you need to change in the string *s*, so that it contains at least *k* different letters, or print that it is impossible. String *s* consists only of lowercase Latin letters, and it...
868
Title: Soroban Time Limit: None seconds Memory Limit: None megabytes Problem Description: You know that Japan is the country with almost the largest 'electronic devices per person' ratio. So you might be quite surprised to find out that the primary school in Japan teaches to count using a Soroban β€” an abacus develop...
869
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: ZS the Coder has drawn an undirected graph of *n* vertices numbered from 0 to *n*<=-<=1 and *m* edges between them. Each edge of the graph is weighted, each weight is a positive integer. The next day, ZS the Coder realized that s...
870
Title: Mr. Kitayuta's Colorful Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Kitayuta has just bought an undirected graph with *n* vertices and *m* edges. The vertices of the graph are numbered from 1 to *n*. Each edge, namely edge *i*, has a color *c**i*, connecting vertex *a*...
871
Title: Matchmaker Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has *n* markers and *m* marker caps. Each marker is described by two numbers: *x**i* is the color and *y**i* is the diameter. Correspondingly, each cap is described by two numbers: *a**j* is the color and *b**j* i...
872
Title: Toy Army Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The hero of our story, Valera, and his best friend Arcady are still in school, and therefore they spend all the free time playing turn-based strategy "GAGA: Go And Go Again". The gameplay is as follows. There are two armies on t...
873
Title: Edo and Magnets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Edo has got a collection of *n* refrigerator magnets! He decided to buy a refrigerator and hang the magnets on the door. The shop can make the refrigerator with any size of the door that meets the following restriction...
874
Title: Gravity Flip Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity. There are *n* columns of toy cubes in the bo...
875
Title: Candies Time Limit: None seconds Memory Limit: None megabytes Problem Description: After passing a test, Vasya got himself a box of $n$ candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for hi...
876
Title: Vasya the Architect Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Once Vasya played bricks. All the bricks in the set had regular cubical shape. Vasya vas a talented architect, however the tower he built kept falling apart. Let us consider the building process. Vasya takes a brick an...
877
Title: Beads Time Limit: 5 seconds Memory Limit: 64 megabytes Problem Description: One Martian boy called Zorg wants to present a string of beads to his friend from the Earth β€” Masha. He knows that Masha likes two colours: blue and red, β€” and right in the shop where he has come, there is a variety of adornments with...
878
Title: Pythagorean Triples Time Limit: None seconds Memory Limit: None megabytes Problem Description: Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right triangle with segm...
879
Title: Frogs and mosquitoes Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* frogs sitting on the coordinate axis *Ox*. For each frog two values *x**i*,<=*t**i* are known β€” the position and the initial length of the tongue of the *i*-th frog (it is guaranteed that all position...
880
Title: Subtractions Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got two numbers. As long as they are both larger than zero, they go through the same operation: subtract the lesser number from the larger one. If they equal substract one number from the another. For example, one o...
881
Title: Imbalanced Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a* consisting of *n* elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array ...
882
Title: Minesweeper Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved world from bombs planted by...
883
Title: Block Towers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Students in a class are making towers of blocks. Each student makes a (non-zero) tower by stacking pieces lengthwise on top of each other. *n* of the students use pieces made of two blocks and *m* of the students use piece...
884
Title: Drazil and Park Time Limit: None seconds Memory Limit: None megabytes Problem Description: Drazil is a monkey. He lives in a circular park. There are *n* trees around the park. The distance between the *i*-th tree and (*i*<=+<=1)-st trees is *d**i*, the distance between the *n*-th tree and the first tree is *...
885
Title: Kefa and Dishes Time Limit: None seconds Memory Limit: None megabytes Problem Description: When Kefa came to the restaurant and sat at a table, the waiter immediately brought him the menu. There were *n* dishes. Kefa knows that he needs exactly *m* dishes. But at that, he doesn't want to order the same dish t...
886
Title: Sagheer and Kindergarten Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sagheer is working at a kindergarten. There are *n* children and *m* different toys. These children use well-defined protocols for playing with the toys: - Each child has a lovely set of toys that he loves to...
887
Title: Sagheer, the Hausmeister Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some people leave the lights at their workplaces on when they leave that is a waste of resources. As a hausmeister of DHBW, Sagheer waits till all students and professors leave the university building, then goe...
888
Title: Polycarp's Picture Gallery Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display *n* photos with the scroll option. At each moment of t...
889
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A company has *n* employees numbered from 1 to *n*. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employee *A* is said to be the superior of ano...
890
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Permutation *p* is an ordered set of integers *p*1,<=<=<=*p*2,<=<=<=...,<=<=<=*p**n*, consisting of *n* distinct positive integers not larger than *n*. We'll denote as *n* the length of permutation *p*1,<=<=<=*p*2,<=<=<=...,<=<=<=...
891
Title: Beautiful Sets of Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: Manao has invented a new mathematical term β€” a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions: 1. The coordinates of each point in the set are inte...
892
Title: Jeff and Digits Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jeff's got *n* cards, each card contains either digit 0, or digit 5. Jeff can choose several cards and put them in a line so that he gets some number. What is the largest possible number divisible by 90 Jeff can make fr...
893
Title: Cactusophobia Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tree is a connected undirected graph that has no cycles. Edge cactus is a connected undirected graph without loops and parallel edges, such that each edge belongs to at most one cycle. Vasya has an edge cactus, each edge...
894
Title: Eugeny and Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Eugeny has array *a*<==<=*a*1,<=*a*2,<=...,<=*a**n*, consisting of *n* integers. Each integer *a**i* equals to -1, or to 1. Also, he has *m* queries: - Query number *i* is given as a pair of integers *l**i*, *r**i* (...
895
Title: Mystic Carvings Time Limit: None seconds Memory Limit: None megabytes Problem Description: The polar bears have discovered a gigantic circular piece of floating ice with some mystic carvings on it. There are *n* lines carved on the ice. Each line connects two points on the boundary of the ice (we call these p...
896
Title: Idempotent functions Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some time ago Leonid have known about idempotent functions. Idempotent function defined on a set {1,<=2,<=...,<=*n*} is such function , that for any the formula *g*(*g*(*x*))<==<=*g*(*x*) holds. Let's denote as *...
897
Title: Appleman and Card Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Appleman has *n* cards. Each card has an uppercase letter written on it. Toastman must choose *k* cards from Appleman's cards. Then Appleman should give Toastman some coins depending on the chosen cards. Formally...
898
Title: Generous Kefa Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Kefa found *n* baloons. For convenience, we denote color of *i*-th baloon as *s**i* β€” lowercase letter of the Latin alphabet. Also Kefa has *k* friends. Friend will be upset, If he get two baloons of the same colo...
899