task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Alex and broken contest Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Alex was creating a contest about his friends, but accidentally deleted it. Fortunately, all the problems were saved, but now he needs to find them among other problems. But there are too many problems,...
900
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: It is known that there are *k* fish species in the polar ocean, numbered from 1 to *k*. They are sorted by non-decreasing order of their weight, which is a positive number. Let the weight of the *i*-th type of fish be *w**i*, then...
901
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Levko has an array that consists of integers: *a*1,<=*a*2,<=... ,<=*a**n*. But he doesn’t like this array at all. Levko thinks that the beauty of the array *a* directly depends on value *c*(*a*), which can be calculated by the fo...
902
Title: Parking Lot Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Nowadays it is becoming increasingly difficult to park a car in cities successfully. Let's imagine a segment of a street as long as *L* meters along which a parking lot is located. Drivers should park their cars strictly parall...
903
Title: Eevee Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are solving the crossword problem K from IPSC 2014. You solved all the clues except for one: who does Eevee evolve into? You are not very into pokemons, but quick googling helped you find out, that Eevee can evolve into eight...
904
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rooted tree with *n* vertices. In each leaf vertex there's a single integer — the number of apples in this vertex. The weight of a subtree is the sum of all numbers in this subtree leaves. For instance, the weigh...
905
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix *a* with *n* lines and *m* columns. Let number *a*[*i*][*j*] represents the calories bur...
906
Title: LCIS Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: This problem differs from one which was on the online contest. The sequence *a*1,<=*a*2,<=...,<=*a**n* is called increasing, if *a**i*<=&lt;<=*a**i*<=+<=1 for *i*<=&lt;<=*n*. The sequence *s*1,<=*s*2,<=...,<=*s**k* is called the sub...
907
Title: Maxim and Matrix 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...
908
Title: Convenient For Everybody Time Limit: None seconds Memory Limit: None megabytes Problem Description: In distant future on Earth day lasts for *n* hours and that's why there are *n* timezones. Local times in adjacent timezones differ by one hour. For describing local time, hours numbers from 1 to *n* are used, ...
909
Title: Visiting a Friend Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pig is visiting a friend. Pig's house is located at point 0, and his friend's house is located at point *m* on an axis. Pig can use teleports to move along the axis. To use a teleport, Pig should come to a certain ...
910
Title: Bicycle Race Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maria participates in a bicycle race. The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, east ...
911
Title: Inna and New Matrix of Candies Time Limit: None seconds Memory Limit: None megabytes Problem Description: Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Candy Matrix 2: Reload". The field for the new game is a rectangle table of size *n*<=×<=*m*. Each line of th...
912
Title: Falling Anvils Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: For some reason in many American cartoons anvils fall from time to time onto heroes' heads. Of course, safes, wardrobes, cruisers, planes fall sometimes too... But anvils do so most of all. Anvils come in different sizes an...
913
Title: What is for dinner? Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In one little known, but very beautiful country called Waterland, lives a lovely shark Valerie. Like all the sharks, she has several rows of teeth, and feeds on crucians. One of Valerie's distinguishing features is that...
914
Title: Binary Blocks Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an image, that can be represented with a 2-d *n* by *m* grid of pixels. Each pixel of the image is either on or off, denoted by the characters "0" or "1", respectively. You would like to compress this image....
915
Title: Code Parsing Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Vitaly loves different algorithms. Today he has invented a new algorithm just for you. Vitaly's algorithm works with string *s*, consisting of characters "x" and "y", and uses two following operations at runtime: 1...
916
Title: Binary String Constructing Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given three integers $a$, $b$ and $x$. Your task is to construct a binary string $s$ of length $n = a + b$ such that there are exactly $a$ zeroes, exactly $b$ ones and exactly $x$ indices $i$ (where $...
917
Title: Ping-Pong Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem at each moment you have a set of intervals. You can move from interval (*a*,<=*b*) from our set to interval (*c*,<=*d*) from our set if and only if *c*<=&lt;<=*a*<=&lt;<=*d* or *c*<=&lt;<=*b*<=&lt;<=*d*. Also ...
918
Title: Bearish Fanpages Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a social website with *n* fanpages, numbered 1 through *n*. There are also *n* companies, and the *i*-th company owns the *i*-th fanpage. Recently, the website created a feature called following. Each fanpage...
919
Title: Minimum Modular Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have been given *n* distinct integers *a*1,<=*a*2,<=...,<=*a**n*. You can remove at most *k* of them. Find the minimum modular *m* (*m*<=&gt;<=0), so that for every pair of the remaining integers (*a**i*,<=*a**j*), ...
920
Title: Erasing Substrings Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *s*, initially consisting of *n* lowercase Latin letters. After that, you perform *k* operations with it, where . During *i*-th operation you must erase some substring of length exactly 2*i*<=-...
921
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has *n* cities connected by *n*<=-<=1 undirected roads, and for any two cities there always exists a path between them. Fox Ciel needs to assign an off...
922
Title: Anastasia and pebbles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anastasia loves going for a walk in Central Uzhlyandian Park. But she became uninterested in simple walking, so she began to collect Uzhlyandian pebbles. At first, she decided to collect all the pebbles she could ...
923
Title: Hobbits' Party Time Limit: None seconds Memory Limit: None megabytes Problem Description: Everyone knows that hobbits love to organize all sorts of parties and celebrations. There are *n* hobbits living in the Shire. They decided to organize the Greatest Party (GP) that would last for several days. Next day t...
924
Title: Teodor is not a liar! Time Limit: None seconds Memory Limit: None megabytes Problem Description: Young Teodor enjoys drawing. His favourite hobby is drawing segments with integer borders inside his huge [1;*m*] segment. One day Teodor noticed that picture he just drawn has one interesting feature: there doesn...
925
Title: Spyke Chatting Time Limit: None seconds Memory Limit: None megabytes Problem Description: The R2 company has *n* employees working for it. The work involves constant exchange of ideas, sharing the stories of success and upcoming challenging. For that, R2 uses a famous instant messaging program Spyke. R2 has ...
926
Title: Kalila and Dimna in the Logging Industry Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle a...
927
Title: Jury Size Time Limit: None seconds Memory Limit: None megabytes Problem Description: In 2013, the writers of Berland State University should prepare problems for *n* Olympiads. We will assume that the Olympiads are numbered with consecutive integers from 1 to *n*. For each Olympiad we know how many members of...
928
Title: Tractor College Time Limit: None seconds Memory Limit: None megabytes Problem Description: While most students still sit their exams, the tractor college has completed the summer exam session. In fact, students study only one subject at this college — the Art of Operating a Tractor. Therefore, at the end of a...
929
Title: Sign on Fence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bizon the Champion has recently finished painting his wood fence. The fence consists of a sequence of *n* panels of 1 meter width and of arbitrary height. The *i*-th panel's height is *h**i* meters. The adjacent planks fo...
930
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Again, there are hard times in Berland! Many towns have such tensions that even civil war is possible. There are *n* towns in Reberland, some pairs of which connected by two-way roads. It is not guaranteed that it is possible to...
931
Title: Missile Silos Time Limit: None seconds Memory Limit: None megabytes Problem Description: A country called Berland consists of *n* cities, numbered with integer numbers from 1 to *n*. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to any other one b...
932
Title: Marlin Time Limit: None seconds Memory Limit: None megabytes Problem Description: The city of Fishtopia can be imagined as a grid of $4$ rows and an odd number of columns. It has two main villages; the first is located at the top-left cell $(1,1)$, people who stay there love fishing at the Tuna pond at the bo...
933
Title: Buying Sets Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The Hexadecimal virus loves playing with number sets — intersecting them, uniting them. One beautiful day she was surprised to find out that Scuzzy, her spherical pet cat, united all sets in one and ate the result! Something ha...
934
Title: Comments Time Limit: None seconds Memory Limit: None megabytes Problem Description: A rare article in the Internet is posted without a possibility to comment it. On a Polycarp's website each article has comments feed. Each comment on Polycarp's website is a non-empty string consisting of uppercase and lowerc...
935
Title: Flag 2 Time Limit: 2 seconds Memory Limit: 128 megabytes Problem Description: According to a new ISO standard, a flag of every country should have, strangely enough, a chequered field *n*<=×<=*m*, each square should be wholly painted one of 26 colours. The following restrictions are set: - In each row at m...
936
Title: On Changing Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rooted tree consisting of *n* vertices numbered from 1 to *n*. The root of the tree is a vertex number 1. Initially all vertices contain number 0. Then come *q* queries, each query has one of the two t...
937
Title: Interview with Oleg Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string *s* consisting of *n* lowercase English letters. There is a fi...
938
Title: Balance Time Limit: None seconds Memory Limit: None megabytes Problem Description: A system of *n* vessels with water is given. Several pairs of vessels are connected by tubes with transfusion mechanisms. One may transfer an integer amount of liters of water between two vessels connected by such tube (tube wo...
939
Title: Win or Freeze Time Limit: None seconds Memory Limit: None megabytes Problem Description: You can't possibly imagine how cold our friends are this winter in Nvodsk! Two of them play the following game to warm up: initially a piece of paper has an integer *q*. During a move a player should write any integer num...
940
Title: none 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, station number *i...
941
Title: Co-prime Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array of *n* elements, you must make it a co-prime array in as few moves as possible. In each move you can insert any positive integral number you want not greater than 109 in any place in the array. A...
942
Title: Mahmoud and Ehab and the even-odd game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mahmoud and Ehab play a game called the even-odd game. Ehab chooses his favorite integer *n* and then they take turns, starting from Mahmoud. In each player's turn, he has to choose an integer *a*...
943
Title: Santa Claus and a Palindrome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Santa Claus likes palindromes very much. There was his birthday recently. *k* of his friends came to him to congratulate him, and each of them presented to him a string *s**i* having the same length *n*. We...
944
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with *n* rows and *m* columns. Each cell originally contains the number 0. One move consis...
945
Title: String Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day in the IT lesson Anna and Maria learned about the lexicographic order. String *x* is lexicographically less than string *y*, if either *x* is a prefix of *y* (and *x*<=≠<=*y*), or there exists such *i* (1<=≤<=*i*<=≤<=*m...
946
Title: Homework Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Once when Gerald studied in the first year at school, his teacher gave the class the following homework. She offered the students a string consisting of *n* small Latin letters; the task was to learn the way the letters that the s...
947
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly *n* exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Besides...
948
Title: Polycarp and Hay Time Limit: None seconds Memory Limit: None megabytes Problem Description: The farmer Polycarp has a warehouse with hay, which can be represented as an *n*<=×<=*m* rectangular table, where *n* is the number of rows, and *m* is the number of columns in the table. Each cell of the table contain...
949
Title: Pride Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have an array *a* with length *n*, you can perform operations. Each operation is like this: choose two adjacent elements from *a*, say *x* and *y*, and replace one of them with *gcd*(*x*,<=*y*), where *gcd* denotes the [great...
950
Title: Trees in a Row Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Queen of England has *n* trees growing in a row in her garden. At that, the *i*-th (1<=≤<=*i*<=≤<=*n*) tree from the left has height *a**i* meters. Today the Queen decided to update the scenery of her garden. She wan...
951
Title: Reducing Fractions Time Limit: None seconds Memory Limit: None megabytes Problem Description: To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, ...
952
Title: Spit Problem Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In a Berland's zoo there is an enclosure with camels. It is known that camels like to spit. Bob watched these interesting animals for the whole day and registered in his notepad where each animal spitted. Now he wants to know ...
953
Title: Martian Food Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Have you ever tasted Martian food? Well, you should. Their signature dish is served on a completely black plate with the radius of *R*, flat as a pancake. First, they put a perfectly circular portion of the Golden Honduras o...
954
Title: Party Lemonade Time Limit: None seconds Memory Limit: None megabytes Problem Description: A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity. Your favorite store sells lemonade in bottles of *n* d...
955
Title: MUH and Cube Walls Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of ...
956
Title: Minimum Sum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya has *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*. His friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' a...
957
Title: Pillars Time Limit: None seconds Memory Limit: None megabytes Problem Description: Marmot found a row with *n* pillars. The *i*-th pillar has the height of *h**i* meters. Starting from one pillar *i*1, Marmot wants to jump on the pillars *i*2, ..., *i**k*. (1<=≤<=*i*1<=&lt;<=*i*2<=&lt;<=...<=&lt;<=*i**k*<=≤<=...
958
Title: Writing Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: Programmers working on a large project have just received a task to write exactly *m* lines of code. There are *n* programmers working on a project, the *i*-th of them makes exactly *a**i* bugs in every line of code that h...
959
Title: Square Table Time Limit: None seconds Memory Limit: None megabytes Problem Description: While resting on the ship after the "Russian Code Cup" a boy named Misha invented an interesting game. He promised to give his quadrocopter to whoever will be the first one to make a rectangular table of size *n*<=×<=*m*, ...
960
Title: Dima and Figure Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima loves making pictures on a piece of squared paper. And yet more than that Dima loves the pictures that depict one of his favorite figures. A piece of squared paper of size *n*<=×<=*m* is represented by a table, c...
961
Title: Buy Low Sell High Time Limit: None seconds Memory Limit: None megabytes Problem Description: You can perfectly predict the price of a certain stock for the next *N* days. You would like to profit on this knowledge, but only want to transact one share of stock per day. That is, each day you will either buy one...
962
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kalila and Dimna are two jackals living in a huge jungle. One day they decided to join a logging factory in order to make money. The manager of logging factory wants them to go to the jungle and cut *n* trees with heights *a*1,<...
963
Title: Display Size Time Limit: None seconds Memory Limit: None megabytes Problem Description: A big company decided to launch a new series of rectangular displays, and decided that the display must have exactly *n* pixels. Your task is to determine the size of the rectangular display — the number of lines (rows) ...
964
Title: The Monster Time Limit: None seconds Memory Limit: None megabytes Problem Description: A monster is chasing after Rick and Morty on another planet. They're so frightened that sometimes they scream. More accurately, Rick screams at times *b*,<=*b*<=+<=*a*,<=*b*<=+<=2*a*,<=*b*<=+<=3*a*,<=... and Morty screams a...
965
Title: Queries on a String Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *s* and should process *m* queries. Each query is described by two 1-based indices *l**i*, *r**i* and integer *k**i*. It means that you should cyclically shift the substring *s*[*l**i*... *r**...
966
Title: Secret Combination Time Limit: None seconds Memory Limit: None megabytes Problem Description: You got a box with a combination lock. The lock has a display showing *n* digits. There are two buttons on the box, each button changes digits on the display. You have quickly discovered that the first button adds 1 ...
967
Title: Kojiro and Furrari Time Limit: None seconds Memory Limit: None megabytes Problem Description: Motorist Kojiro spent 10 years saving up for his favorite car brand, Furrari. Finally Kojiro's dream came true! Kojiro now wants to get to his girlfriend Johanna to show off his car to her. Kojiro wants to get to hi...
968
Title: George and Interesting Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: George loves graphs. Most of all, he loves interesting graphs. We will assume that a directed graph is interesting, if it meets the following criteria: - The graph doesn't contain any multiple arcs; - T...
969
Title: Help Shrek and Donkey Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Shrek and the Donkey (as you can guess, they also live in the far away kingdom) decided to play a card game called YAGame. The rules are very simple: initially Shrek holds *m* cards and the Donkey holds *n* cards (the...
970
Title: Dima and Trap Graph Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima and Inna love spending time together. The problem is, Seryozha isn't too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal... Dima cons...
971
Title: Grandfather Dovlet’s calculator Time Limit: None seconds Memory Limit: None megabytes Problem Description: Once Max found an electronic calculator from his grandfather Dovlet's chest. He noticed that the numbers were written with seven-segment indicators ([https://en.wikipedia.org/wiki/Seven-segment_display](...
972
Title: Reflection Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: For each positive integer *n* consider the integer ψ(*n*) which is obtained from *n* by replacing every digit *a* in the decimal notation of *n* with the digit (9<=<=-<=<=*a*). We say that ψ(*n*) is the reflection of *n*. For ex...
973
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sergey attends lessons of the *N*-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the *N*-ish language. Sentences of the *N*-ish language can be represented as strings consisti...
974
Title: Worms Time Limit: None seconds Memory Limit: None megabytes Problem Description: It is lunch time for Mole. His friend, Marmot, prepared him a nice game for lunch. Marmot brought Mole *n* ordered piles of worms such that *i*-th pile contains *a**i* worms. He labeled all these worms with consecutive integers:...
975
Title: XOR on Segment Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got an array *a*, consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. You are allowed to perform two operations on this array: 1. Calculate the sum of current array elements on the segment [*l*,<=*r*], that i...
976
Title: Art Union Time Limit: None seconds Memory Limit: None megabytes Problem Description: A well-known art union called "Kalevich is Alive!" manufactures objects d'art (pictures). The union consists of *n* painters who decided to organize their work as follows. Each painter uses only the color that was assigned t...
977
Title: Soldier and Cards Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two bored soldiers are playing card war. Their card deck consists of exactly *n* cards, numbered from 1 to *n*, all values are different. They divide cards between them in some manner, it's possible that they have dif...
978
Title: Insomnia cure Time Limit: None seconds Memory Limit: None megabytes Problem Description: «One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine. However, just counting dragons was boring as well, so she entert...
979
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you know, the most intelligent beings on the Earth are, of course, cows. This conclusion was reached long ago by the Martian aliens, as well as a number of other intelligent civilizations from outer space. Sometimes cows gath...
980
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Nikita has a stack. A stack in this problem is a data structure that supports two operations. Operation push(x) puts an integer *x* on the top of the stack, and operation pop() deletes the top integer from the stack, i. e. the las...
981
Title: First Digit Law Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In the probability theory the following paradox called Benford's law is known: "In many lists of random numbers taken from real sources, numbers starting with digit 1 occur much more often than numbers starting with any oth...
982
Title: Возможно, вы знаете этих людей? Time Limit: None seconds Memory Limit: None megabytes Problem Description: Основой любой социальной сети является отношение дружбы между двумя пользователями в том или ином смысле. В одной известной социальной сети дружба симметрична, то есть если *a* является другом *b*, то *b...
983
Title: T-shirts Distribution Time Limit: None seconds Memory Limit: None megabytes Problem Description: The organizers of a programming contest have decided to present t-shirts to participants. There are six different t-shirts sizes in this problem: S, M, L, XL, XXL, XXXL (sizes are listed in increasing order). The ...
984
Title: Cross Sum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Genos has been given *n* distinct lines on the Cartesian plane. Let be a list of intersection points of these lines. A single point might appear multiple times in this list if it is the intersection of multiple pairs of line...
985
Title: Makes And The Product Time Limit: None seconds Memory Limit: None megabytes Problem Description: After returning from the army Makes received a gift — an array *a* consisting of *n* positive integer numbers. He hadn't been solving problems for a long time, so he became interested to answer a particular questi...
986
Title: A and B and Lecture Rooms Time Limit: None seconds Memory Limit: None megabytes Problem Description: A and B are preparing themselves for programming contests. The University where A and B study is a set of rooms connected by corridors. Overall, the University has *n* rooms connected by *n*<=-<=1 corridors s...
987
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Each New Year Timofey and his friends cut down a tree of *n* vertices and bring it home. After that they paint all the *n* its vertices, so that the *i*-th vertex gets color *c**i*. Now it's time for Timofey birthday, and his mot...
988
Title: Berland Bingo Time Limit: None seconds Memory Limit: None megabytes Problem Description: Lately, a national version of a bingo game has become very popular in Berland. There are *n* players playing the game, each player has a card with numbers. The numbers on each card are distinct, but distinct cards can hav...
989
Title: Choosing Ads Time Limit: None seconds Memory Limit: None megabytes Problem Description: One social network developer recently suggested a new algorithm of choosing ads for users. There are *n* slots which advertisers can buy. It is possible to buy a segment of consecutive slots at once. The more slots you ow...
990
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A lot of people associate Logo programming language with turtle graphics. In this case the turtle moves along the straight line and accepts commands "T" ("turn around") and "F" ("move 1 unit forward"). You are given a list of com...
991
Title: World Cup Time Limit: None seconds Memory Limit: None megabytes Problem Description: Allen wants to enter a fan zone that occupies a round square and has $n$ entrances. There already is a queue of $a_i$ people in front of the $i$-th entrance. Each entrance allows one person from its queue to enter the fan zo...
992
Title: Shaass and Bookshelf Time Limit: None seconds Memory Limit: None megabytes Problem Description: Shaass has *n* books. He wants to make a bookshelf for all his books. He wants the bookshelf's dimensions to be as small as possible. The thickness of the *i*-th book is *t**i* and its pages' width is equal to *w**...
993
Title: On a plane Time Limit: None seconds Memory Limit: None megabytes Problem Description: The first line contains a single integer *n* (1<=≤<=*n*<=≤<=1000) — the number of points on a plane. Each of the next *n* lines contains two real coordinates *x**i* and *y**i* of the point, specified with exactly 2 fractio...
994
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The evil Bumbershoot corporation produces clones for gruesome experiments in a vast underground lab. On one occasion, the corp cloned a boy Andryusha who was smarter than his comrades. Immediately Andryusha understood that somethi...
995
Title: Schedule Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: At the beginning of the new semester there is new schedule in the Berland State University. According to this schedule, *n* groups have lessons at the room 31. For each group the starting time of the lesson and the finishing time ...
996
Title: Shower Line Time Limit: None seconds Memory Limit: None megabytes Problem Description: Many students live in a dormitory. A dormitory is a whole new world of funny amusements and possibilities but it does have its drawbacks. There is only one shower and there are multiple students who wish to have a shower ...
997
Title: Lever Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a description of a lever as string *s*. We'll represent the string length as record |*s*|, then the lever looks as a horizontal bar with weights of length |*s*|<=-<=1 with exactly one pivot. We will assume that the bar i...
998
Title: Don't fear, DravDe is kind Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A motorcade of *n* trucks, driving from city «Z» to city «З», has approached a tunnel, known as Tunnel of Horror. Among truck drivers there were rumours about monster DravDe, who hunts for drivers in that tunnel....
999