task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Big Segment Time Limit: None seconds Memory Limit: None megabytes Problem Description: A coordinate line has *n* segments, the *i*-th segment starts at the position *l**i* and ends at the position *r**i*. We will denote such a segment as [*l**i*,<=*r**i*]. You have suggested that one of the defined segments ...
3,500
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this player sco...
3,501
Title: Sanatorium Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in th...
3,502
Title: Invariance of Tree 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 fo...
3,503
Title: none 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 studies the seque...
3,504
Title: Dancing Lessons Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There are *n* people taking dancing lessons. Every person is characterized by his/her dancing skill *a**i*. At the beginning of the lesson they line up from left to right. While there is at least one couple of a boy and a g...
3,505
Title: Again Twenty Five! Time Limit: None seconds Memory Limit: None megabytes Problem Description: The HR manager was disappointed again. The last applicant failed the interview the same way as 24 previous ones. "Do I give such a hard task?" β€” the HR manager thought. "Just raise number 5 to the power of *n* and ge...
3,506
Title: Beautiful fountains rows Time Limit: None seconds Memory Limit: None megabytes Problem Description: Butler Ostin wants to show Arkady that rows of odd number of fountains are beautiful, while rows of even number of fountains are not. The butler wants to show Arkady *n* gardens. Each garden is a row of *m* ce...
3,507
Title: e-Government Time Limit: None seconds Memory Limit: None megabytes Problem Description: The best programmers of Embezzland compete to develop a part of the project called "e-Government" β€” the system of automated statistic collecting and press analysis. We know that any of the *k* citizens can become a member...
3,508
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You already know that Valery's favorite sport is biathlon. Due to your help, he learned to shoot without missing, and his skills are unmatched at the shooting range. But now a smaller task is to be performed, he should learn to co...
3,509
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tree with *n* vertexes and *n* points on a plane, no three points lie on one straight line. Your task is to paint the given tree on a plane, using the given points as vertexes. That is, you should correspond eac...
3,510
Title: Jerry's Protest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andrew and Jerry draw randomly without replacement from a jar containing *n* balls, each labeled with ...
3,511
Title: Equator Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp has created his own training plan to prepare for the programming contests. He will train for $n$ days, all days are numbered from $1$ to $n$, beginning from the first. On the $i$-th day Polycarp will necessarily solve...
3,512
Title: Vicious Keyboard Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string *s* with only these two letters. He really likes it when the string "VK" appears, so he wishes to change at most one letter i...
3,513
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tree is a connected acyclic graph. Suppose you are given a tree consisting of *n* vertices. The vertex of this tree is called centroid if the size of each connected component that appears if this vertex is removed from the tree do...
3,514
Title: Karen and Neighborhood Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's been long after the events of the previous problems, and Karen has now moved on from student life and is looking to relocate to a new neighborhood. The neighborhood consists of *n* houses in a straight line...
3,515
Title: Find Marble Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya and Vasya are playing a game. Petya's got *n* non-transparent glasses, standing in a row. The glasses' positions are indexed with integers from 1 to *n* from left to right. Note that the positions are indexed but the ...
3,516
Title: A Twisty Movement Time Limit: None seconds Memory Limit: None megabytes Problem Description: A dragon symbolizes wisdom, power and wealth. On Lunar New Year's Day, people model a dragon with bamboo strips and clothes, raise them with rods, and hold the rods high and low to resemble a flying dragon. A perform...
3,517
Title: Lucky Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are n...
3,518
Title: April Fools' Problem (hard) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The plans for HC2 are rather far-fetched: we are just over 500 000 days away from HC2 3387, for example, and accordingly we are planning to have a couple hundred thousand problems in that edition (we hope th...
3,519
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given three sticks with positive integer lengths of *a*,<=*b*, and *c* centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by a different l...
3,520
Title: Fools and Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: They say that Berland has exactly two problems, fools and roads. Besides, Berland has *n* cities, populated by the fools and connected by the roads. All Berland roads are bidirectional. As there are many fools in Berlan...
3,521
Title: Kolya and Tanya Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle. More formally, there are 3*n* gnomes sitting in a ...
3,522
Title: Puzzle Lover Time Limit: None seconds Memory Limit: None megabytes Problem Description: Oleg Petrov loves crossword puzzles and every Thursday he buys his favorite magazine with crosswords and other word puzzles. In the last magazine Oleg found a curious puzzle, and the magazine promised a valuable prize for ...
3,523
Title: Destroying Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array consisting of *n* non-negative integers *a*1,<=*a*2,<=...,<=*a**n*. You are going to destroy integers in the array one by one. Thus, you are given the permutation of integers from 1 to *n* defin...
3,524
Title: Place Your Ad Here Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan Anatolyevich's agency is starting to become famous in the town. They have already ordered and made *n* TV commercial videos. Each video is made in a special way: the colors and the soundtrack are adjusted to t...
3,525
Title: Pentagon Time Limit: 10 seconds Memory Limit: 256 megabytes Problem Description: According to the last order issued by the president of Berland every city of the country must have its own Ministry Defense building (their own Pentagon). A megapolis Berbourg was not an exception. This city has *n* junctions, so...
3,526
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's consider one interesting word game. In this game you should transform one word into another through special operations. Let's say we have word *w*, let's split this word into two non-empty parts *x* and *y* so, that *w*<==...
3,527
Title: Shell Game Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Today the Β«ZΒ» city residents enjoy a shell game competition. The residents are gathered on the main square to watch the breath-taking performance. The performer puts 3 non-transparent cups upside down in a row. Then he openly put...
3,528
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Little Elephant loves the LCM (least common multiple) operation of a non-empty set of positive integers. The result of the LCM operation of *k* positive integers *x*1,<=*x*2,<=...,<=*x**k* is the minimum positive integer that ...
3,529
Title: Bear and String Distance Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little polar bear. He likes nice strings β€” strings of length *n*, consisting of lowercase English letters only. The distance between two letters is defined as the difference between their positions ...
3,530
Title: Vladik and cards Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vladik was bored on his way home and decided to play the following game. He took *n* cards and put them in a row in front of himself. Every card has a positive integer number not exceeding 8 written on it. He decided t...
3,531
Title: Dubstep Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya works as a DJ in the best Berland nightclub, and he often uses dubstep music in his performance. Recently, he has decided to take a couple of old songs and make dubstep remixes from them. Let's assume that a song consist...
3,532
Title: Amr and Chemistry Time Limit: None seconds Memory Limit: None megabytes Problem Description: Amr loves Chemistry, and specially doing experiments. He is preparing for a new interesting experiment. Amr has *n* different types of chemicals. Each chemical *i* has an initial volume of *a**i* liters. For this exp...
3,533
Title: Amr and The Large Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Amr has got a large array of size *n*. Amr doesn't like large arrays so he intends to make it smaller. Amr doesn't care about anything in the array except the beauty of it. The beauty of the array is defined to...
3,534
Title: Pasha and String Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pasha got a very beautiful string *s* for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |*s*| from left to right, where |*s*| is the length of the given ...
3,535
Title: Physical Education Lessons Time Limit: None seconds Memory Limit: None megabytes Problem Description: This year Alex has finished school, and now he is a first-year student of Berland State University. For him it was a total surprise that even though he studies programming, he still has to attend physical edu...
3,536
Title: Sum Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya studies positional numeral systems. Unfortunately, he often forgets to write the base of notation in which the expression is written. Once he saw a note in his notebook saying *a*<=+<=*b*<==<=?, and that the base of the positiona...
3,537
Title: Bank Hacking Time Limit: None seconds Memory Limit: None megabytes Problem Description: Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of which he sadly has none. To deal with the problem, he has decided to hack the ba...
3,538
Title: Collective Mindsets (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Way to go! Heidi now knows how many brains there must be for her to get one. But throwing herself in the midst of a clutch of hungry zombies is quite a risky endeavor. Hence Heidi wonders: what is the small...
3,539
Title: Little Pigs and Wolves Time Limit: None seconds Memory Limit: None megabytes Problem Description: Once upon a time there were several little pigs and several wolves on a two-dimensional grid of size *n*<=Γ—<=*m*. Each cell in this grid was either empty, containing one little pig, or containing one wolf. A lit...
3,540
Title: Bank Robbery Time Limit: None seconds Memory Limit: None megabytes Problem Description: A robber has attempted to rob a bank but failed to complete his task. However, he had managed to open all the safes. Oleg the bank client loves money (who doesn't), and decides to take advantage of this failed robbery and...
3,541
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya ha...
3,542
Title: Block Tower Time Limit: None seconds Memory Limit: None megabytes Problem Description: After too much playing on paper, Iahub has switched to computer games. The game he plays is called "Block Towers". It is played in a rectangular grid with *n* rows and *m* columns (it contains *n*<=Γ—<=*m* cells). The goal o...
3,543
Title: Diverging Directions Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a directed weighted graph with *n* nodes and 2*n*<=-<=2 edges. The nodes are labeled from 1 to *n*, while the edges are labeled from 1 to 2*n*<=-<=2. The graph's edges can be split into two parts. - ...
3,544
Title: Broken Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a tree that has *n* vertices, which are numbered from 1 to *n*, where the vertex number one is the root. Each edge has weight *w**i* and strength *p**i*. Botanist Innokentiy, who is the only member of the jur...
3,545
Title: Arkady and a Nobody-men Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady words in a large company. There are *n* employees working in a system of a strict hierarchy. Namely, each employee, with an exception of the CEO, has exactly one immediate manager. The CEO is a manager (t...
3,546
Title: Guess the Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bob has a permutation of integers from 1 to *n*. Denote this permutation as *p*. The *i*-th element of *p* will be denoted as *p**i*. For all pairs of distinct integers *i*,<=*j* between 1 and *n*, he wrote the nu...
3,547
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Little Elephant very much loves sums on intervals. This time he has a pair of integers *l* and *r* (*l*<=≀<=*r*). The Little Elephant has to find the number of such integers *x* (*l*<=≀<=*x*<=≀<=*r*), that the first digit of ...
3,548
Title: Shifts Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a table consisting of *n* rows and *m* columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or one ...
3,549
Title: MST Company Time Limit: None seconds Memory Limit: None megabytes Problem Description: The MST (Meaningless State Team) company won another tender for an important state reform in Berland. There are *n* cities in Berland, some pairs of the cities are connected by roads. Each road has its price. One can move ...
3,550
Title: Valera and Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valera is a coder. Recently he wrote a funny program. The pseudo code for this program is given below: Now Valera wonders: given the values *x*, *k* and *p*, what is the expected value of the resulting number *s*? I...
3,551
Title: String Transformation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let *s* be a string whose length equals *n*. Its characters are numbered from 0 to *n*<=-<=1, *i* and *j* are integers, 0<=≀<=*i*<=&lt;<=*j*<=&lt;<=*n*. Let's define function *f* as follows: *f*(*s*,<=*i*,<=*j*)<...
3,552
Title: Jzzhu and Children Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to *n*. The *i*-th child wants to get at least *a**i* candies. Jzzhu asks children to line ...
3,553
Title: Shooting Gallery Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One warm and sunny day king Copa decided to visit the shooting gallery, located at the Central Park, and try to win the main prize β€” big pink plush panda. The king is not good at shooting, so he invited you to help him. T...
3,554
Title: Sharti Time Limit: None seconds Memory Limit: None megabytes Problem Description: During the last 24 hours Hamed and Malek spent all their time playing "Sharti". Now they are too exhausted to finish the last round. So they asked you for help to determine the winner of this round. "Sharti" is played on a *n*...
3,555
Title: System of Equations Time Limit: None seconds Memory Limit: None megabytes Problem Description: Furik loves math lessons very much, so he doesn't attend them, unlike Rubik. But now Furik wants to get a good mark for math. For that Ms. Ivanova, his math teacher, gave him a new task. Furik solved the task immedi...
3,556
Title: Bachgold Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bachgold problem is very easy to formulate. Given a positive integer *n* represent it as a sum of maximum possible number of prime numbers. One can prove that such representation exists for any integer greater than 1. ...
3,557
Title: Data Recovery Time Limit: None seconds Memory Limit: None megabytes Problem Description: Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors. The testing goes in *n* steps, at each ...
3,558
Title: Digits of Number Pi Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasily has recently learned about the amazing properties of number Ο€. In one of the articles it has been hypothesized that, whatever the sequence of numbers we have, in some position, this sequence is found among th...
3,559
Title: New Year Letter Time Limit: None seconds Memory Limit: None megabytes Problem Description: Many countries have such a New Year or Christmas tradition as writing a letter to Santa including a wish list for presents. Vasya is an ordinary programmer boy. Like all ordinary boys, he is going to write the letter to...
3,560
Title: Lucky Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Pet...
3,561
Title: Widget Library Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya writes his own library for building graphical user interface. Vasya called his creation VTK (VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other. A widget is some el...
3,562
Title: Load Balancing Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the school computer room there are *n* servers which are responsible for processing several computing tasks. You know the number of scheduled tasks for each server: there are *m**i* tasks assigned to the *i*-th server...
3,563
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Genos recently installed the game Zuma on his phone. In Zuma there exists a line of *n* gemstones, the *i*-th of which has color *c**i*. The goal of the game is to destroy all the gemstones in the line as quickly as possible. In ...
3,564
Title: Longest Increasing Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Note that the memory limit in this problem is less than usual. Let's consider an array consisting of positive integers, some positions of which contain gaps. We have a collection of numbers that can be ...
3,565
Title: Jzzhu and Apples Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jzzhu has picked *n* apples from his big apple tree. All the apples are numbered from 1 to *n*. Now he wants to sell them to an apple store. Jzzhu will pack his apples into groups and then sell them. Each group must ...
3,566
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy. The toy consists of *n* parts and *m* ropes. Each rope links two parts, but every pair of p...
3,567
Title: Polo the Penguin and XOR operation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to *n*, inclusive. For permutation *p*<==<=*p*0,<=*p*1,<=...,<=*p**n*, Polo has defined its beauty β€” n...
3,568
Title: The Game Of Parity Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities in Westeros. The *i*-th city is inhabited by *a**i* people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain town and burns it to the ground. Thus all ...
3,569
Title: New Year Contest Time Limit: None seconds Memory Limit: None megabytes Problem Description: As Gerald sets the table, Alexander sends the greeting cards, and Sergey and his twins create an army of clone snowmen, Gennady writes a New Year contest. The New Year contest begins at 18:00 (6.00 P.M.) on December 3...
3,570
Title: Inna and Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima's spent much time thinking what present to give to Inna and gave her an empty sequence *w*. Now they want to fill sequence *w* with numbers zero and one. For that, they decided to play an amusing game. Before ...
3,571
Title: Population Size Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus develops an interesting theory about the interrelation of arithmetic progressions with just everything in the world. His current idea is that the population of the capital of Berland changes over time like an...
3,572
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Timofey likes integers a lot. Unfortunately, he is very young and can't work with very big integers, so he does all the operations modulo his favorite prime *m*. Also, Timofey likes to look for arithmetical progressions eve...
3,573
Title: Colliders Time Limit: None seconds Memory Limit: None megabytes Problem Description: By 2312 there were *n* Large Hadron Colliders in the inhabited part of the universe. Each of them corresponded to a single natural number from 1 to *n*. However, scientists did not know what activating several colliders simul...
3,574
Title: The Same Calendar Time Limit: None seconds Memory Limit: None megabytes Problem Description: The girl Taylor has a beautiful calendar for the year *y*. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday. The calendar is so beautiful t...
3,575
Title: Financiers Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: This problem has unusual memory constraint. At evening, Igor and Zhenya the financiers became boring, so they decided to play a game. They prepared *n* papers with the income of some company for some time periods. Note...
3,576
Title: Ordering T-Shirts Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's another Start[c]up, and that means there are T-shirts to order. In order to make sure T-shirts are shipped as soon as possible, we've decided that this year we're going to order all of the necessary T-shirts befo...
3,577
Title: Princess and Her Shadow Time Limit: None seconds Memory Limit: None megabytes Problem Description: Princess Vlada enjoys springing in the meadows and walking in the forest. One day β€” wonderful, sunny day β€” during her walk Princess found out with astonishment that her shadow was missing! "Blimey!", β€” she thoug...
3,578
Title: Number Transformation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Petya likes positive integers a lot. Recently his mom has presented him a positive integer *a*. There's only one thing Petya likes more than numbers: playing with little Masha. It turned out that Masha alre...
3,579
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sereja has a sequence that consists of *n* positive integers, *a*1,<=*a*2,<=...,<=*a**n*. First Sereja took a piece of squared paper and wrote all distinct non-empty non-decreasing subsequences of sequence *a*. Then for each seq...
3,580
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: For his computer science class, Jacob builds a model tree with sticks and balls containing *n* nodes in the shape of a tree. Jacob has spent *a**i* minutes building the *i*-th ball in the tree. Jacob's teacher will evaluate his m...
3,581
Title: Counter Attack Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland has managed to repel the flatlanders' attack and is now starting the counter attack. Flatland has *n* cities, numbered from 1 to *n*, and some pairs of them are connected by bidirectional roads. The Flatlandian ...
3,582
Title: Pizza Separation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order a pizza. In this problem pizza is a circle of some radius. The pizza was delivered already cut in...
3,583
Title: Diverse Permutation 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,<...
3,584
Title: Yaroslav and Two Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Yaroslav thinks that two strings *s* and *w*, consisting of digits and having length *n* are non-comparable if there are two numbers, *i* and *j* (1<=≀<=*i*,<=*j*<=≀<=*n*), such that *s**i*<=&gt;<=*w**i* and *s...
3,585
Title: Vasya and Football Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya has started watching football games. He has learned that for some fouls the players receive yellow cards, and for some fouls they receive red cards. A player who receives the second yellow card automatically re...
3,586
Title: Mushroom Gnomes - 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Natalia was walking in the woods when she met a little mushroom gnome. The gnome told her the following story: Everybody knows that the mushroom gnomes' power lies in the magic mushrooms that grow in the na...
3,587
Title: Arpa’s overnight party and Mehrdad’s silent entering Time Limit: None seconds Memory Limit: None megabytes Problem Description: Note that girls in Arpa’s land are really attractive. Arpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw *n* pairs of friends sitt...
3,588
Title: Helga Hufflepuff's Cup Time Limit: None seconds Memory Limit: None megabytes Problem Description: Harry, Ron and Hermione have figured out that Helga Hufflepuff's cup is a horcrux. Through her encounter with Bellatrix Lestrange, Hermione came to know that the cup is present in Bellatrix's family vault in Grin...
3,589
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andryusha is an orderly boy and likes to keep things in their place. Today he faced a problem to put his socks in the wardrobe. He has *n* distinct pairs of socks which are initially in a bag. The pairs are numbered from 1 to *n*...
3,590
Title: Duff as a Queen Time Limit: None seconds Memory Limit: None megabytes Problem Description: Duff is the queen of her country, Andarz Gu. She's a competitive programming fan. That's why, when he saw her minister, Malek, free, she gave her a sequence consisting of *n* non-negative integers, *a*1,<=*a*2,<=...,<=*...
3,591
Title: Misha and Forest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's define a forest as a non-directed acyclic graph (also without loops and parallel edges). One day Misha played with the forest consisting of *n* vertices. For each vertex *v* from 0 to *n*<=-<=1 he wrote down two ...
3,592
Title: Multiplication Table Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bizon the Champion isn't just charming, he also is very smart. While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted an *n*<=Γ—<=*m* multi...
3,593
Title: Olya and Energy Drinks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Olya loves energy drinks. She loves them so much that her room is full of empty cans from energy drinks. Formally, her room can be represented as a field of *n*<=Γ—<=*m* cells, each cell of which is empty or litt...
3,594
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is the modification of the problem used during the official round. Unfortunately, author's solution of the original problem appeared wrong, so the problem was changed specially for the archive. Once upon a time in a far away...
3,595
Title: Exposition Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-fiction writer. It was decided...
3,596
Title: Points on Line Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Petya likes points a lot. Recently his mom has presented him *n* points lying on the line *OX*. Now Petya is wondering in how many ways he can choose three distinct points so that the distance between the two fart...
3,597
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fox Ciel has a robot on a 2D plane. Initially it is located in (0, 0). Fox Ciel code a command to it. The command was represented by string *s*. Each character of *s* is one move operation. There are four move operations at all: ...
3,598
Title: Equation Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: You are given an equation: Your task is to find the number of distinct roots of the equation and print all of them in ascending order. Input Specification: The first line contains three integer numbers *A*,<=*B* and *C* (<=-<=1...
3,599