task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Smart Cheater Time Limit: None seconds Memory Limit: None megabytes Problem Description: I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatically. The route of bus 62 has exactly *n* stops (stop 1 goes first on i...
3,900
Title: Molly's Chemicals Time Limit: None seconds Memory Limit: None megabytes Problem Description: Molly Hooper has *n* different kinds of chemicals arranged in a line. Each of the chemicals has an affection value, The *i*-th of them has affection value *a**i*. Molly wants Sherlock to fall in love with her. She in...
3,901
Title: Kyoya and Colored Balls Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kyoya Ootori has a bag with *n* colored balls that are colored with *k* different colors. The colors are labeled from 1 to *k*. Balls of the same color are indistinguishable. He draws balls from the bag one by o...
3,902
Title: An impassioned circulation of affection Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nadeko's birthday is approaching! As she decorated the room for the party, a long garland of Dianthus-shaped paper pieces was placed on a prominent part of the wall. Brother Koyomi will like it! ...
3,903
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Overall there are *m* actors in Berland. Each actor has a personal identifier β€” an integer from 1 to *m* (distinct actors have distinct identifiers). Vasya likes to watch Berland movies with Berland actors, and he has *k* favorite...
3,904
Title: Treasure Island Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Our brave travelers reached an island where pirates had buried treasure. However as the ship was about to moor, the captain found out that some rat ate a piece of the treasure map. The treasure map can be represented as a ...
3,905
Title: Ilya and Escalator Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that *n* people stand in the queue for the escalator. At...
3,906
Title: Building Forest Time Limit: None seconds Memory Limit: None megabytes Problem Description: An oriented weighted forest is an acyclic weighted digraph in which from each vertex at most one edge goes. The root of vertex *v* of an oriented weighted forest is a vertex from which no edge goes and which can be rea...
3,907
Title: Combination Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ilya plays a card game by the following rules. A player has several cards. Each card contains two non-negative integers inscribed, one at the top of the card and one at the bottom. At the beginning of the round the player ...
3,908
Title: Single-use Stones Time Limit: None seconds Memory Limit: None megabytes Problem Description: A lot of frogs want to cross a river. A river is $w$ units width, but frogs can only jump $l$ units long, where $l < w$. Frogs can also jump on lengths shorter than $l$. but can't jump longer. Hopefully, there are ...
3,909
Title: World of Darkraft Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently Roma has become the happy owner of a new game World of Darkraft. This game combines elements of virtually all known genres, and on one of the later stages of the game Roma faced difficulties solving a puzzle....
3,910
Title: Dead Ends Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: Life in Bertown has become hard. The city has too many roads and the government spends too much to maintain them. There are *n* junctions and *m* two way roads, at which one can get from each junction to any other one. The mayor ...
3,911
Title: Treeland Tour Time Limit: None seconds Memory Limit: None megabytes Problem Description: The "Road Accident" band is planning an unprecedented tour around Treeland. The RA fans are looking forward to the event and making bets on how many concerts their favorite group will have. Treeland consists of *n* citie...
3,912
Title: Tennis Rackets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Professional sport is more than hard work. It also is the equipment, designed by top engineers. As an example, let's take tennis. Not only should you be in great shape, you also need an excellent racket! In this problem ...
3,913
Title: The Meeting Place Cannot Be Changed Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petr is a detective in Braginsk. Somebody stole a huge amount of money from a bank and Petr is to catch him. Somebody told Petr that some luxurious car moves along the roads without stopping. Petr k...
3,914
Title: Game with Coins Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two pirates Polycarpus and Vasily play a very interesting game. They have *n* chests with coins, the chests are numbered with integers from 1 to *n*. Chest number *i* has *a**i* coins. Polycarpus and Vasily move in tu...
3,915
Title: DZY Loves Colors Time Limit: None seconds Memory Limit: None megabytes Problem Description: DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of *n* units (they are numbered from 1 to *n* from left to right). The color of the *i*-th unit of the ribbon is ...
3,916
Title: The Wall (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: "The zombies are lurking outside. Waiting. Moaning. And when they come..." "When they come?" "I hope the Wall is high enough." Zombie attacks have hit the Wall, our line of defense in the North. Its protection is fai...
3,917
Title: Email address Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Sometimes one has to spell email addresses over the phone. Then one usually pronounces a dot as dot, an at sign as at. As a result, we get something like vasyaatgmaildotcom. Your task is to transform it into a proper email ad...
3,918
Title: Photographs (I) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Human-Cow Confederation (*HC*2), led by Heidi, has built a base where people and cows can hide, guarded from zombie attacks. The entrance to the base is protected by an automated gate which performs a kind of a Turi...
3,919
Title: A Lot of Games Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrew, Fedor and Alex are inventive guys. Now they invent the game with strings for two players. Given a group of *n* non-empty strings. During the game two players build the word together, initially the word is empty....
3,920
Title: Pig and Palindromes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Peppa the Pig was walking and walked into the forest. What a strange coincidence! The forest has the shape of a rectangle, consisting of *n* rows and *m* columns. We enumerate the rows of the rectangle from top to b...
3,921
Title: New Year and Arbitrary Arrangement Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given three integers *k*, *p**a* and *p**b*. You will construct a sequence with the following algorithm: Initially, start with the empty sequence. Each second, you do the following. With prob...
3,922
Title: Football Championship Time Limit: None seconds Memory Limit: None megabytes Problem Description: Any resemblance to any real championship and sport is accidental. The Berland National team takes part in the local Football championship which now has a group stage. Let's describe the formal rules of the local ...
3,923
Title: Maximum path Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangular table 3<=Γ—<=*n*. Each cell contains an integer. You can move from one cell to another if they share a side. Find such path from the upper left cell to the bottom right cell of the table that do...
3,924
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A ski base is planned to be built in Walrusland. Recently, however, the project is still in the constructing phase. A large land lot was chosen for the construction. It contains *n* ski junctions, numbered from 1 to *n*. Initially...
3,925
Title: Max History Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a* of length *n*. We define *f**a* the following way: - Initially *f**a*<==<=0, *M*<==<=1; - for every 2<=≀<=*i*<=≀<=*n* if *a**M*<=&lt;<=*a**i* then we set *f**a*<==<=*f**a*<=+<=*a**M* and then s...
3,926
Title: New Year and Rating Time Limit: None seconds Memory Limit: None megabytes Problem Description: Every Codeforces user has rating, described with one integer, possibly negative or zero. Users are divided into two divisions. The first division is for users with rating 1900 or higher. Those with rating 1899 or lo...
3,927
Title: Student's Camp Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alex studied well and won the trip to student camp Alushta, located on the seashore. Unfortunately, it's the period of the strong winds now and there is a chance the camp will be destroyed! Camp building can be represe...
3,928
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* workers in a company, each of them has a unique id from 1 to *n*. Exaclty one of them is a chief, his id is *s*. Each worker except the chief has exactly one immediate superior. There was a request to each of the wo...
3,929
Title: End of Exams Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Students love to celebrate their holidays. Especially if the holiday is the day of the end of exams! Despite the fact that Igor K., unlike his groupmates, failed to pass a programming test, he decided to invite them to go to ...
3,930
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: While creating high loaded systems one should pay a special attention to caching. This problem will be about one of the most popular caching algorithms called LRU (Least Recently Used). Suppose the cache may store no more than *k...
3,931
Title: Row Time Limit: None seconds Memory Limit: None megabytes Problem Description: You're given a row with $n$ chairs. We call a seating of people "maximal" if the two following conditions hold: 1. There are no neighbors adjacent to anyone seated. 1. It's impossible to seat one more person without violating th...
3,932
Title: Send the Fool Further! (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Heidi's friend Jenny is asking Heidi to deliver an important letter to one of their common friends. Since Jenny is Irish, Heidi thinks that this might be a prank. More precisely, she suspects that the mess...
3,933
Title: Build String Time Limit: None seconds Memory Limit: None megabytes Problem Description: You desperately need to build some string *t*. For that you've got *n* more strings *s*1,<=*s*2,<=...,<=*s**n*. To build string *t*, you are allowed to perform exactly |*t*| (|*t*| is the length of string *t*) operations o...
3,934
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja loves number sequences very much. That's why he decided to make himself a new one following a certain algorithm. Sereja takes a blank piece of paper. Then he starts writing out the sequence in *m* stages. Each time he eith...
3,935
Title: Inna and Binary Logic Time Limit: None seconds Memory Limit: None megabytes Problem Description: Inna is fed up with jokes about female logic. So she started using binary logic instead. Inna has an array of *n* elements *a*1[1],<=*a*1[2],<=...,<=*a*1[*n*]. Girl likes to train in her binary logic, so she does...
3,936
Title: k-Multiple Free Set Time Limit: None seconds Memory Limit: None megabytes Problem Description: A *k*-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by *k*. That is, there are no two integers *x* and *y* (*x*<=&lt;<=*y*) from the set, ...
3,937
Title: Alternating Current Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it...
3,938
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this task Anna and Maria play the following game. Initially they have a checkered piece of paper with a painted *n*<=Γ—<=*m* rectangle (only the border, no filling). Anna and Maria move in turns and Anna starts. During each move...
3,939
Title: Transmigration Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In Disgaea as in most role-playing games, characters have skills that determine the character's ability to use certain weapons or spells. If the character does not have the necessary skill, he cannot use it. The skill level ...
3,940
Title: Protect Sheep Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected. The pasture is ...
3,941
Title: Do you want a date? Time Limit: None seconds Memory Limit: None megabytes Problem Description: Leha decided to move to a quiet town Vičkopolis, because he was tired by living in Bankopolis. Upon arrival he immediately began to expand his network of hacked computers. During the week Leha managed to get access ...
3,942
Title: Yaroslav and Time Time Limit: None seconds Memory Limit: None megabytes Problem Description: Yaroslav is playing a game called "Time". The game has a timer showing the lifespan he's got left. As soon as the timer shows 0, Yaroslav's character dies and the game ends. Also, the game has *n* clock stations, stat...
3,943
Title: Sum of Medians Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: In one well-known algorithm of finding the *k*-th order statistics we should divide all elements into groups of five consecutive elements and find the median of each five. A median is called the middle element of a sorted ar...
3,944
Title: Cableway Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A group of university students wants to get to the top of a mountain to have a picnic there. For that they decided to use a cableway. A cableway is represented by some cablecars, hanged onto some cable stations by a cable. A cabl...
3,945
Title: Broken BST Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let *T* be arbitrary binary tree β€” tree, every vertex of which has no more than two children. Given tree is rooted, so there exists only one vertex which doesn't have a parent β€” it's the root of a tree. Every vertex has an i...
3,946
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after *k* minutes after turning on. During cooking, Julia goes to the kitchen every *d* minutes an...
3,947
Title: Another Sith Tournament Time Limit: None seconds Memory Limit: None megabytes Problem Description: The rules of Sith Tournament are well known to everyone. *n* Sith take part in the Tournament. The Tournament starts with the random choice of two Sith who will fight in the first battle. As one of them loses, h...
3,948
Title: Mahmoud and Ehab and the message Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mahmoud wants to send a message to his friend Ehab. Their language consists of *n* words numbered from 1 to *n*. Some words have the same meaning so there are *k* groups of words such that all the words...
3,949
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A very unusual citizen lives in a far away kingdom β€” Dwarf Gracula. However, his unusual name is not the weirdest thing (besides, everyone long ago got used to calling him simply Dwarf Greg). What is special about Dwarf Greg β€” he'...
3,950
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maxim loves to fill in a matrix in a special manner. Here is a pseudocode of filling in a matrix of size (*m*<=+<=1)<=Γ—<=(*m*<=+<=1): Maxim asks you to count, how many numbers *m* (1<=≀<=*m*<=≀<=*n*) are there, such that the su...
3,951
Title: Marks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got his hands on a group's gradebook. Overall the group has *n* students. They received marks for *m* subjects. Each student ...
3,952
Title: none 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...
3,953
Title: Quirky Quantifiers Time Limit: None seconds Memory Limit: None megabytes Problem Description: The input contains a single integer *a* (10<=≀<=*a*<=≀<=999). Output 0 or 1. Input Specification: The input contains a single integer *a* (10<=≀<=*a*<=≀<=999). Output Specification: Output 0 or 1. Demo Input: ['1...
3,954
Title: Case of Matryoshkas Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrewid the Android is a galaxy-famous detective. He is now investigating the case of vandalism at the exhibition of contemporary art. The main exhibit is a construction of *n* matryoshka dolls that can be nested ...
3,955
Title: Once Again... Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array of positive integers *a*1,<=*a*2,<=...,<=*a**n*<=Γ—<=*T* of length *n*<=Γ—<=*T*. We know that for any *i*<=&gt;<=*n* it is true that *a**i*<==<=*a**i*<=-<=*n*. Find the length of the longest non-decre...
3,956
Title: Bindian Signalizing Time Limit: 4 seconds Memory Limit: 256 megabytes Problem Description: Everyone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by *n* hills, forming a circle. On each hill there was a watchman, who watched the neighbourh...
3,957
Title: New Bus Route Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities situated along the main road of Berland. Cities are represented by their coordinates β€” integer numbers *a*1,<=*a*2,<=...,<=*a**n*. All coordinates are pairwise distinct. It is possible to get from on...
3,958
Title: Pathwalks Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a directed graph with *n* nodes and *m* edges, with all edges having a certain weight. There might be multiple edges and self loops, and the graph can also be disconnected. You need to choose a path (possibl...
3,959
Title: Lust Time Limit: None seconds Memory Limit: None megabytes Problem Description: A false witness that speaketh lies! You are given a sequence containing *n* integers. There is a variable *res* that is equal to 0 initially. The following process repeats *k* times. Choose an index from 1 to *n* uniformly at ra...
3,960
Title: Wrong Subtraction Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm: - if the last digit ...
3,961
Title: Obsession with Robots Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: The whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to walk the shortest path fr...
3,962
Title: k-Maximum Subsequence Sum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Consider integer sequence *a*1,<=*a*2,<=...,<=*a**n*. You should run queries of two types: - The query format is "0 *i* *val*". In reply to this query you should make the following assignment: *a**i*<==<=*va...
3,963
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Petya very much likes playing with little Masha. Recently he has received a game called "Zero-One" as a gift from his mother. Petya immediately offered Masha to play the game with him. Before the very beginning of the game...
3,964
Title: Chamber of Secrets Time Limit: None seconds Memory Limit: None megabytes Problem Description: "The Chamber of Secrets has been opened again" β€” this news has spread all around Hogwarts and some of the students have been petrified due to seeing the basilisk. Dumbledore got fired and now Harry is trying to enter...
3,965
Title: Unsolvable Time Limit: None seconds Memory Limit: None megabytes Problem Description: Consider the following equation: Let's find all integer *z* (*z*<=&gt;<=0), for which this equation is unsolvable in positive integers. The phrase "unsolvable in positive integers" means that there are no such positive int...
3,966
Title: String Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be pretty hard for her, because she is too young. Therefore, her brother Sergey always helps her. Sergey gi...
3,967
Title: R3D3’s Summer Adventure Time Limit: None seconds Memory Limit: None megabytes Problem Description: R3D3 spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of p...
3,968
Title: Replacement Time Limit: None seconds Memory Limit: None megabytes Problem Description: Daniel has a string *s*, consisting of lowercase English letters and period signs (characters '.'). Let's define the operation of replacement as the following sequence of steps: find a substring ".." (two consecutive period...
3,969
Title: Pasha and Pipe Time Limit: None seconds Memory Limit: None megabytes Problem Description: On a certain meeting of a ruling party "A" minister Pavel suggested to improve the sewer system and to create a new pipe in the city. The city is an *n*<=Γ—<=*m* rectangular squared field. Each square of the field is eit...
3,970
Title: Treasure Hunt Time Limit: None seconds Memory Limit: None megabytes Problem Description: After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play with her. The three friend...
3,971
Title: Rap God Time Limit: None seconds Memory Limit: None megabytes Problem Description: Rick is in love with Unity. But Mr. Meeseeks also love Unity, so Rick and Mr. Meeseeks are "love rivals". Unity loves rap, so it decided that they have to compete in a rap game (battle) in order to choose the best. Rick is to...
3,972
Title: Raising Bacteria Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are a lover of bacteria. You want to raise some bacteria in a box. Initially, the box is empty. Each morning, you can put any number of bacteria into the box. And each night, every bacterium in the box will split...
3,973
Title: Counting Rhombi Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have two positive integers *w* and *h*. Your task is to count the number of rhombi which have the following properties: - Have positive area. - With vertices at integer points. - All vertices of the rhombi are ...
3,974
Title: Lucky Country Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Petya loves lucky numbers. Everybody knows that positive integers are lucky if their decimal representation doesn't contain digits other than 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. One nig...
3,975
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: We've got a rectangular *n*<=Γ—<=*m*-cell maze. Each cell is either passable, or is a wall (impassable). A little boy found the maze and cyclically tiled a plane with it so that the plane became an infinite maze. Now on this plane ...
3,976
Title: Kyoya and Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's define the permutation of length *n* as an array *p*<==<=[*p*1,<=*p*2,<=...,<=*p**n*] consisting of *n* distinct integers from range from 1 to *n*. We say that this permutation maps value 1 into the value *p...
3,977
Title: Jzzhu and Squares Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jzzhu has two integers, *n* and *m*. He calls an integer point (*x*,<=*y*) of a plane special if 0<=≀<=*x*<=≀<=*n* and 0<=≀<=*y*<=≀<=*m*. Jzzhu defines a unit square as a square with corners at points (*x*,<=*y*), (*x...
3,978
Title: Running Student Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: And again a misfortune fell on Poor Student. He is being late for an exam. Having rushed to a bus stop that is in point (0,<=0), he got on a minibus and they drove along a straight line, parallel to axis *OX*, in the direct...
3,979
Title: Nearest vectors Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the minimal non-oriented angle between them. Non-oriented angle is non-negative value, min...
3,980
Title: Anton and School - 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist of round brackets (char...
3,981
Title: Reading Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is going to the Olympics in the city Ntown by train. The boy wants to read the textbook to prepare for the Olympics. He counted that he needed *k* hours for this. He also found that the light in the train changes every ho...
3,982
Title: Points and Powers of Two Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are $n$ distinct points on a coordinate line, the coordinate of $i$-th point equals to $x_i$. Choose a subset of the given set of points such that the distance between each pair of points in a subset is a...
3,983
Title: Game Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In one school with Vasya there is a student Kostya. Kostya does not like physics, he likes different online games. Every day, having come home, Kostya throws his bag in the farthest corner and sits down at his beloved computer. Kostya...
3,984
Title: Boom Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's consider the famous game called Boom (aka Hat) with simplified rules. There are *n* teams playing the game. Each team has two players. The purpose of the game is to explain the words to the teammate without using any words ...
3,985
Title: Cunning Gena 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 f...
3,986
Title: Hot Days Time Limit: None seconds Memory Limit: None megabytes Problem Description: The official capital and the cultural capital of Berland are connected by a single road running through *n* regions. Each region has a unique climate, so the *i*-th (1<=≀<=*i*<=≀<=*n*) region has a stable temperature of *t**i*...
3,987
Title: Scarborough Fair Time Limit: None seconds Memory Limit: None megabytes Problem Description: Parsley, sage, rosemary and thyme. Remember me to one who lives there. He once was the true love of mine. Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get ...
3,988
Title: Startup Funding Time Limit: None seconds Memory Limit: None megabytes Problem Description: An e-commerce startup pitches to the investors to get funding. They have been functional for *n* weeks now and also have a website! For each week they know the number of unique visitors during this week *v**i* and the ...
3,989
Title: Not simply beatiful strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's call a string adorable if its letters can be realigned in such a way that they form two consequent groups of equal symbols (note that different groups must contain different symbols). For example, abab...
3,990
Title: Taxi Time Limit: None seconds Memory Limit: None megabytes Problem Description: After the lessons *n* groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the *i*-th group consists of *s**i* friends (1<=≀<=*s**i*<=≀<=4), and they want to go to Polycarpu...
3,991
Title: What Has Dirichlet Got to Do with That? Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: You all know the Dirichlet principle, the point of which is that if *n* boxes have no less than *n*<=+<=1 items, that leads to the existence of a box in which there are at least two items. Having hea...
3,992
Title: Mages and Monsters Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vova plays a computer game known as Mages and Monsters. Vova's character is a mage. Though as he has just started, his character knows no spells. Vova's character can learn new spells during the game. Every spell is...
3,993
Title: Pudding Monsters Time Limit: None seconds Memory Limit: None megabytes Problem Description: Have you ever played Pudding Monsters? In this task, a simplified one-dimensional model of this game is used. Imagine an infinite checkered stripe, the cells of which are numbered sequentially with integers. Some cell...
3,994
Title: Berland National Library Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room. Today was the...
3,995
Title: Alice, Bob, Two Teams Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alice and Bob are playing a game. The game involves splitting up game pieces into two teams. There are *n* pieces, and the *i*-th piece has a strength *p**i*. The way to split up game pieces is split into several...
3,996
Title: Sereja and Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja adores trees. Today he came up with a revolutionary new type of binary root trees. His new tree consists of *n* levels, each vertex is indexed by two integers: the number of the level and the number of the verte...
3,997
Title: Iahub and Permutations Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub is so happy about inventing bubble sort graphs that he's staying all day long at the office and writing permutations. Iahubina is angry that she is no more important for Iahub. When Iahub goes away, Iahubin...
3,998
Title: HQ Time Limit: None seconds Memory Limit: None megabytes Problem Description: The famous joke programming language HQ9+ has only 4 commands. In this problem we will explore its subset β€” a language called HQ... Input Specification: The only line of the input is a string between 1 and 106 characters long. Out...
3,999