task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Little Elephant and Elections Time Limit: None seconds Memory Limit: None megabytes Problem Description: There have recently been elections in the zoo. Overall there were 7 main political parties: one of them is the Little Elephant Political Party, 6 other parties have less catchy names. Political parties fi...
1,700
Title: Gnomes of Might and Magic Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya plays a popular game the Gnomes of Might and Magic. In this game Vasya manages the kingdom of gnomes, consisting of several castles, connected by bidirectional roads. The kingdom road network has a spec...
1,701
Title: Cube Snake Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got an *n*<=Γ—<=*n*<=Γ—<=*n* cube, split into unit cubes. Your task is to number all unit cubes in this cube with positive integers from 1 to *n*3 so that: - each number was used as a cube's number exactly once; - f...
1,702
Title: Rock-Paper-Scissors Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nikephoros and Polycarpus play rock-paper-scissors. The loser gets pinched (not too severely!). Let us remind you the rules of this game. Rock-paper-scissors is played by two players. In each round the players choo...
1,703
Title: Square Tiling Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have an *n*<=Γ—<=*m* rectangle table, its cells are not initially painted. Your task is to paint all cells of the table. The resulting picture should be a tiling of the table with squares. More formally: - each cell ...
1,704
Title: Inquisition Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: In Medieval times existed the tradition of burning witches at steaks together with their pets, black cats. By the end of the 15-th century the population of black cats ceased to exist. The difficulty of the situation led to cre...
1,705
Title: Young Table Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got table *a*, consisting of *n* rows, numbered from 1 to *n*. The *i*-th line of table *a* contains *c**i* cells, at that for all *i* (1<=&lt;<=*i*<=≀<=*n*) holds *c**i*<=≀<=*c**i*<=-<=1. Let's denote *s* as the t...
1,706
Title: Cycle in Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got a undirected graph *G*, consisting of *n* nodes. We will consider the nodes of the graph indexed by integers from 1 to *n*. We know that each node of graph *G* is connected by edges with at least *k* other nod...
1,707
Title: Pages Time Limit: None seconds Memory Limit: None megabytes Problem Description: User ainta is making a web site. This time he is going to make a navigation of the pages. In his site, there are *n* pages numbered by integers from 1 to *n*. Assume that somebody is on the *p*-th page now. The navigation will lo...
1,708
Title: Five Dimensional Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given set of *n* points in 5-dimensional space. The points are labeled from 1 to *n*. No two points coincide. We will call point *a* bad if there are different points *b* and *c*, not equal to *a*, from...
1,709
Title: Superset Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A set of points on a plane is called good, if for any two points at least one of the three conditions is true: - those two points lie on same horizontal line; - those two points lie on same vertical line; - the rectangle, with ...
1,710
Title: New Year and Original Order Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let *S*(*n*) denote the number that represents the digits of *n* in sorted order. For example, *S*(1)<==<=1,<=*S*(5)<==<=5,<=*S*(50394)<==<=3459,<=*S*(353535)<==<=333555. Given a number *X*, compute modulo...
1,711
Title: El Toll Caves Time Limit: None seconds Memory Limit: None megabytes Problem Description: The prehistoric caves of El Toll are located in MoiΓ  (Barcelona). You have heard that there is a treasure hidden in one of *n* possible spots in the caves. You assume that each of the spots has probability 1<=/<=*n* to co...
1,712
Title: Group Photo 2 (online mirror version) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Many years have passed, and *n* friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for one of the friend...
1,713
Title: Candies Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has got *n* candies and *m* friends (*n*<=β‰₯<=*m*). He wants to make a New Year present with candies to each friend. Polycarpus is planning to present all candies and he wants to do this in the fairest (that is, most ...
1,714
Title: Elevator Time Limit: None seconds Memory Limit: None megabytes Problem Description: A sky scraper with 1000 floors has been built in the city of N. It has modern superfast elevators to help to travel from one floor to another. Each elevator has two doors, the front one and the back one. If one goes in through...
1,715
Title: Cycle Time Limit: None seconds Memory Limit: None megabytes Problem Description: A tournament is a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexes *u* and *v* (*u*<=β‰ <=*v*) exists either an edge going from *u* to *v*, o...
1,716
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A tree of size *n* is an undirected connected graph consisting of *n* vertices without cycles. Consider some tree with *n* vertices. We call a tree invariant relative to permutation *p*<==<=*p*1*p*2... *p**n*, if for any two vert...
1,717
Title: Old Peykan Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities in the country where the Old Peykan lives. These cities are located on a straight line, we'll denote them from left to right as *c*1,<=*c*2,<=...,<=*c**n*. The Old Peykan wants to travel from city *c*1 t...
1,718
Title: Piet Time Limit: None seconds Memory Limit: None megabytes Problem Description: Piet is one of the most known visual esoteric programming languages. The programs in Piet are constructed from colorful blocks of pixels and interpreted using pretty complicated rules. In this problem we will use a subset of Piet ...
1,719
Title: PolandBall and Many Other Balls Time Limit: None seconds Memory Limit: None megabytes Problem Description: PolandBall is standing in a row with Many Other Balls. More precisely, there are exactly *n* Balls. Balls are proud of their home landΒ β€” and they want to prove that it's strong. The Balls decided to sta...
1,720
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The German University in Cairo (GUC) dorm houses are numbered from 1 to *n*. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa), and di...
1,721
Title: k-Interesting Pairs Of Integers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has the sequence consisting of *n* integers. Vasya consider the pair of integers *x* and *y* k-interesting, if their binary representation differs from each other exactly in *k* bits. For example, ...
1,722
Title: Lucky Sum of Digits Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. ...
1,723
Title: The Wall Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. Iahub ...
1,724
Title: Xor-matic Number of the Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an undirected graph, constisting of *n* vertices and *m* edges. Each edge of the graph has some non-negative integer written on it. Let's call a triple (*u*,<=*v*,<=*s*) interesting, if 1<=≀...
1,725
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Artem is a very smart programmer. He knows many different difficult algorithms. Recently he has mastered in 2-SAT one. In computer science, 2-satisfiability (abbreviated as 2-SAT) is the special case of the problem of dete...
1,726
Title: Diplomas and Certificates Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* students who have taken part in an olympiad. Now it's time to award the students. Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with...
1,727
Title: Fuzzy Search Time Limit: None seconds Memory Limit: None megabytes Problem Description: Leonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A', 'T', 'G' and 'C'. ...
1,728
Title: Bar Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw *n* people sitting there. For every one of them Vasya h...
1,729
Title: Compute Power Time Limit: None seconds Memory Limit: None megabytes Problem Description: You need to execute several tasks, each associated with number of processors it needs, and the compute power it will consume. You have sufficient number of analog computers, each with enough processors for any task. Each...
1,730
Title: More Queries to Array... Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got an array, consisting of *n* integers: *a*1,<=*a*2,<=...,<=*a**n*. Your task is to quickly run the queries of two types: 1. Assign value *x* to all elements from *l* to *r* inclusive. After such quer...
1,731
Title: SUM and REPLACE Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let *D*(*x*) be the number of positive divisors of a positive integer *x*. For example, *D*(2)<==<=2 (2 is divisible by 1 and 2), *D*(6)<==<=4 (6 is divisible by 1, 2, 3 and 6). You are given an array *a* of *n* intege...
1,732
Title: Counterexample Time Limit: None seconds Memory Limit: None megabytes Problem Description: Your friend has recently learned about coprime numbers. A pair of numbers {*a*,<=*b*} is called coprime if the maximum number that divides both *a* and *b* is equal to one. Your friend often comes up with different st...
1,733
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Filya just learned new geometry objectΒ β€” rectangle. He is given a field consisting of *n*<=Γ—<=*n* unit cells. Rows are numbered from bottom to top with integer from 1 to *n*. Columns are numbered from left to right with integers f...
1,734
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least *p* experience points, and a desired flat in Moscow costs *q* dollars. Mikhail is...
1,735
Title: Alternative Reality Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the year of 3000 travelling around parallel realities became a routine thing. However one has to take into consideration that travelling like that is highly dangerous as you never know beforehand where you're gon...
1,736
Title: Ksenia and Combinatorics Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ksenia has her winter exams. Today she is learning combinatorics. Here's one of the problems she needs to learn to solve. How many distinct trees are there consisting of *n* vertices, each with the following p...
1,737
Title: Guard Duty (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Rebel fleet is afraid that the Empire might want to strike back again. Princess Heidi needs to know if it is possible to assign *R* Rebel spaceships to guard *B* bases so that every base has exactly one guardian a...
1,738
Title: Efim and Strange Grade Time Limit: None seconds Memory Limit: None megabytes Problem Description: Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappointed, as he expected a way more pleasant result. Th...
1,739
Title: Messages Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* incoming messages for Vasya. The *i*-th message is going to be received after *t**i* minutes. Each message has a cost, which equals to *A* initially. After being received, the cost of a message decreases by *B* e...
1,740
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing ...
1,741
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Elephant loves Furik and Rubik, who he met in a small city Kremenchug. The Little Elephant has two strings of equal length *a* and *b*, consisting only of uppercase English letters. The Little Elephant selects a pair of su...
1,742
Title: Dima and Continuous Line Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework. The teacher g...
1,743
Title: Road Problem Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: The Berland capital (as you very well know) contains *n* junctions, some pairs of which are connected by two-way roads. Unfortunately, the number of traffic jams in the capital has increased dramatically, that's why it was dec...
1,744
Title: Phone Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has *n* friends in Tarasov city. Polycarpus knows phone numbers of all his friends: they are strings *s*1,<=*s*2,<=...,<=*s**n*. All these strings consist only of digits and have the same length. Once Polycarpus...
1,745
Title: Vulnerable Kerbals Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an integer *m*, and a list of *n* distinct integers between 0 and *m*<=-<=1. You would like to construct a sequence satisfying the properties: - Each element is an integer between 0 and *m*<=-<=1, in...
1,746
Title: Two Subsequences Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: On an IT lesson Valera studied data compression. The teacher told about a new method, which we shall now describe to you. Let {*a*1,<=*a*2,<=...,<=*a**n*} be the given sequence of lines needed to be compressed. Here and b...
1,747
Title: Road Map Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There are *n* cities in Berland. Each city has its index β€” an integer number from 1 to *n*. The capital has index *r*1. All the roads in Berland are two-way. The road system is such that there is exactly one path from the capital ...
1,748
Title: Sereja ans Anagrams Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja has two sequences *a* and *b* and number *p*. Sequence *a* consists of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Similarly, sequence *b* consists of *m* integers *b*1,<=*b*2,<=...,<=*b**m*. As usual, Sereja st...
1,749
Title: Kuro and Topological Parity Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kuro has recently won the "Most intelligent cat ever" contest. The three friends then decided to go to Katie's home to celebrate Kuro's winning. After a big meal, they took a small break then started playing...
1,750
Title: Cron Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sometime the classic solution are not powerful enough and we have to design our own. For the purpose of this problem you have to implement the part of the system of task scheduling. Each task should be executed at some particular...
1,751
Title: Cave Painting Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imp is watching a documentary about cave painting. Some numbers, carved in chaotic order, immediately attracted his attention. Imp rapidly proposed a guess that they are the remainders of division of a number *n* by all ...
1,752
Title: Wet Shark and Bishops Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today, Wet Shark is given *n* bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from 1 to 1000. Rows are numbered from top to bottom, while columns are numbered from left to right. We...
1,753
Title: Cup Trick Time Limit: None seconds Memory Limit: None megabytes Problem Description: The employees of the F company have lots of ways to entertain themselves. Today they invited a famous magician who shows a trick with plastic cups and a marble. The point is to trick the spectator's attention. Initially, the...
1,754
Title: Queue Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: On a cold winter evening our hero Vasya stood in a railway queue to buy a ticket for Codeforces championship final. As it usually happens, the cashier said he was going to be away for 5 minutes and left for an hour. Then Vasya, not t...
1,755
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady the air traffic controller is now working with *n* planes in the air. All planes move along a straight coordinate axis with Arkady's station being at point 0 on it. The *i*-th plane, small enough to be represented by a poin...
1,756
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: β€” Willem... β€” What's the matter? β€” It seems that there's something wrong with Seniorious... β€” I'll have a look... Seniorious is made by linking special talismans in particular order. After over 500 years, the carillon is no...
1,757
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja has a bracket sequence *s*1,<=*s*2,<=...,<=*s**n*, or, in other words, a string *s* of length *n*, consisting of characters "(" and ")". Sereja needs to answer *m* queries, each of them is described by two integers *l**i*,...
1,758
Title: Jumping on Walls Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya plays a computer game with ninjas. At this stage Vasya's ninja should get out of a deep canyon. The canyon consists of two vertical parallel walls, their height is *n* meters. Let's imagine that we split these w...
1,759
Title: Clockwork Bomb Time Limit: None seconds Memory Limit: None megabytes Problem Description: My name is James diGriz, I'm the most clever robber and treasure hunter in the whole galaxy. There are books written about my adventures and songs about my operations, though you were able to catch me up in a pretty awkw...
1,760
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A boy named Gena really wants to get to the "Russian Code Cup" finals, or at least get a t-shirt. But the offered problems are too complex, so he made an arrangement with his *n* friends that they will solve the problems for him. ...
1,761
Title: Roma and Lucky Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Roma (a popular Russian name that means 'Roman') loves the Little Lvov Elephant's lucky numbers. Let us remind you that lucky numbers are positive integers whose decimal representation only contains lucky digits...
1,762
Title: Petr and a calendar Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspond to weekdays, and cells...
1,763
Title: Giga Tower Time Limit: None seconds Memory Limit: None megabytes Problem Description: Giga Tower is the tallest and deepest building in Cyberland. There are 17<=777<=777<=777 floors, numbered from <=-<=8<=888<=888<=888 to 8<=888<=888<=888. In particular, there is floor 0 between floor <=-<=1 and floor 1. Ever...
1,764
Title: Santa's Gift Time Limit: None seconds Memory Limit: None megabytes Problem Description: Santa has an infinite number of candies for each of $m$ flavours. You are given a rooted tree with $n$ vertices. The root of the tree is the vertex $1$. Each vertex contains exactly one candy. The $i$-th vertex has a candy...
1,765
Title: Packmen Time Limit: None seconds Memory Limit: None megabytes Problem Description: A game field is a strip of 1<=Γ—<=*n* square cells. In some cells there are Packmen, in some cellsΒ β€” asterisks, other cells are empty. Packman can move to neighboring cell in 1 time unit. If there is an asterisk in the target c...
1,766
Title: Presents in Bankopolis Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bankopolis is an incredible city in which all the *n* crossroads are located on a straight line and numbered from 1 to *n* along it. On each crossroad there is a bank office. The crossroads are connected with *m...
1,767
Title: Igor and Interesting Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Igor likes hexadecimal notation and considers positive integer in the hexadecimal notation interesting if each digit and each letter in it appears no more than *t* times. For example, if *t*<==<=3, then int...
1,768
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how...
1,769
Title: Ksenia and Pawns Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ksenia has a chessboard of size *n*<=Γ—<=*m*. Each cell of the chessboard contains one of the characters: "&lt;", "&gt;", "^", "v", "#". The cells that contain character "#" are blocked. We know that all chessboard cell...
1,770
Title: Spyke Talks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus is the director of a large corporation. There are *n* secretaries working for the corporation, each of them corresponds via the famous Spyke VoIP system during the day. We know that when two people call each othe...
1,771
Title: Solitaire Time Limit: None seconds Memory Limit: None megabytes Problem Description: A boy named Vasya wants to play an old Russian solitaire called "Accordion". In this solitaire, the player must observe the following rules: - A deck of *n* cards is carefully shuffled, then all *n* cards are put on the tab...
1,772
Title: Working routine Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of *n* rows and *m* columns and *q* tasks. Each task is to swap two submatrices of the given matri...
1,773
Title: Mysterious numbers - 1 Time Limit: None seconds Memory Limit: None megabytes Problem Description: The input contains two integers *a*1,<=*a*2 (0<=≀<=*a**i*<=≀<=109), separated by a single space. Output a single integer. Input Specification: The input contains two integers *a*1,<=*a*2 (0<=≀<=*a**i*<=≀<=109),...
1,774
Title: Calendar Reform Time Limit: None seconds Memory Limit: None megabytes Problem Description: Reforms have started in Berland again! At this time, the Parliament is discussing the reform of the calendar. To make the lives of citizens of Berland more varied, it was decided to change the calendar. As more and more...
1,775
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are *n* inflorescences, numbered from 1 to *n*. Inflorescence number 1 is situated near b...
1,776
Title: Lucky Number Representation Time Limit: None seconds Memory Limit: None megabytes Problem Description: We know that lucky digits are digits 4 and 7, however Vasya's got another favorite digit 0 and he assumes it also is lucky! Lucky numbers are such non-negative integers whose decimal record only contains luc...
1,777
Title: Labyrinth-11 Time Limit: None seconds Memory Limit: None megabytes Problem Description: See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01). Input Specification: none Output Specification: none Note: none
1,778
Title: Brackets Time Limit: None seconds Memory Limit: None megabytes Problem Description: A two dimensional array is called a bracket array if each grid contains one of the two possible brackets β€” "(" or ")". A path through the two dimensional array cells is called monotonous if any two consecutive cells in the pat...
1,779
Title: Jeff and Rounding Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jeff got 2*n* real numbers *a*1,<=*a*2,<=...,<=*a*2*n* as a birthday present. The boy hates non-integer numbers, so he decided to slightly "adjust" the numbers he's got. Namely, Jeff consecutively executes *n* operati...
1,780
Title: Distance in Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: A tree is a connected graph that doesn't contain any cycles. The distance between two vertices of a tree is the length (in edges) of the shortest path between these vertices. You are given a tree with *n* vertices an...
1,781
Title: Game With Sticks Time Limit: None seconds Memory Limit: None megabytes Problem Description: After winning gold and silver in IOI 2014, Akshat and Malvika want to have some fun. Now they are playing a game on a grid made of *n* horizontal and *m* vertical sticks. An intersection point is any point on the grid...
1,782
Title: Max and Min Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two kittens, Max and Min, play with a pair of non-negative integers *x* and *y*. As you can guess from their names, kitten Max loves to maximize and kitten Min loves to minimize. As part of this game Min wants to make sure ...
1,783
Title: Watto and Mechanism Time Limit: None seconds Memory Limit: None megabytes Problem Description: Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with *n* strings. Then the mechanism sh...
1,784
Title: Almost Arithmetical Progression Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gena loves sequences of numbers. Recently, he has discovered a new type of sequences which he called an almost arithmetical progression. A sequence is an almost arithmetical progression, if its elements ...
1,785
Title: Mike and palindrome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mike has a string *s* consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome. A palindrome is a string that reads the same ...
1,786
Title: Expected Earnings Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are playing a game with a bag of red and black balls. Initially, you are told that the bag has *n* balls total. In addition, you are also told that the bag has probability *p**i*<=/<=106 of containing exactly *i* ...
1,787
Title: Bicycle Chain Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya's bicycle chain drive consists of two parts: *n* stars are attached to the pedal axle, *m* stars are attached to the rear wheel axle. The chain helps to rotate the rear wheel by transmitting the pedal rotation. We ...
1,788
Title: Divisibility by 25 Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an integer $n$ from $1$ to $10^{18}$ without leading zeroes. In one move you can swap any two adjacent digits in the given number in such a way that the resulting number will not contain leading zeroes...
1,789
Title: Chat room Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Vasya has recently learned to type and log on to the Internet. He immediately entered a chat room and decided to say hello to everybody. Vasya typed the word *s*. It is considered that Vasya managed to say hello if several letter...
1,790
Title: Puzzles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Barney lives in country USC (United States of Charzeh). USC has *n* cities numbered from 1 through *n* and *n*<=-<=1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of t...
1,791
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" and "1")...
1,792
Title: ACM ICPC Time Limit: None seconds Memory Limit: None megabytes Problem Description: In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as possible, but since there were only 6 students who wished to participate, the decision was to build ...
1,793
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* piles of stones of sizes *a*1,<=*a*2,<=...,<=*a**n* lying on the table in front of you. During one move you can take one pile and add it to the other. As you add pile *i* to pile *j*, the size of pile *j* increases ...
1,794
Title: Mushroom Strife Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Pasha and Akim were making a forest map β€” the lawns were the graph's vertexes and the roads joining the lawns were its edges. They decided to encode the number of laughy mushrooms on every lawn in the following way: on ever...
1,795
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his *k* cows have decided to stay at the luxurious Grand Moo...
1,796
Title: Om Nom and Candies Time Limit: None seconds Memory Limit: None megabytes Problem Description: A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with the same task i...
1,797
Title: Ann and Half-Palindrome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tomorrow Ann takes the hardest exam of programming where she should get an excellent mark. On the last theoretical class the teacher introduced the notion of a half-palindrome. String *t* is a half-palindrom...
1,798
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: As usual, Sereja has array *a*, its elements are integers: *a*[1],<=*a*[2],<=...,<=*a*[*n*]. Let's introduce notation: A swap operation is the following sequence of actions: - choose two indexes *i*,<=*j* (*i*<=β‰ <=*j*); - perf...
1,799