task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: We'll call a set of positive integers *a* beautiful if the following condition fulfills: for any prime *p*, if , then . In other words, if one number from the set is divisible by prime *p*, then at least half of numbers from the s...
2,400
Title: Defragmentation Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem you have to implement an algorithm to defragment your hard disk. The hard disk consists of a sequence of clusters, numbered by integers from 1 to *n*. The disk has *m* recorded files, the *i*-th file occ...
2,401
Title: George and Round Time Limit: None seconds Memory Limit: None megabytes Problem Description: George decided to prepare a Codesecrof round, so he has prepared *m* problems for the round. Let's number the problems with integers 1 through *m*. George estimates the *i*-th problem's complexity by integer *b**i*. T...
2,402
Title: Lucky Conversion 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 no...
2,403
Title: Commentary Boxes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Berland Football Cup starts really soon! Commentators from all over the world come to the event. Organizers have already built $n$ commentary boxes. $m$ regional delegations will come to the Cup. Every delegation shou...
2,404
Title: Hexadecimal's Numbers Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of *n* different natural ...
2,405
Title: Preparing for Merge Sort Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan has an array consisting of *n* different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing sequence...
2,406
Title: Queue Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the Main Berland Bank *n* people stand in a queue at the cashier, everyone knows his/her height *h**i*, and the heights of the other people in the queue. Each of them keeps in mind number *a**i* β€” how many people who are talle...
2,407
Title: XOR Equation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two positive integers *a* and *b* have a sum of *s* and a bitwise XOR of *x*. How many possible values are there for the ordered pair (*a*,<=*b*)? Input Specification: The first line of the input contains two integers *s*...
2,408
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Luyi has *n* circles on the plane. The *i*-th circle is centered at (*x**i*,<=*y**i*). At the time zero circles start to grow simultaneously. In other words, the radius of each circle at time *t* (*t*<=&gt;<=0) is equal to *t*. Th...
2,409
Title: Left-handers, Right-handers and Ambidexters Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are at a water bowling training. There are *l* people who play with their left hand, *r* people, who play with their right hand, and *a* ambidexters, who can play with left or right hand....
2,410
Title: Game of chess unfinished Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Once Volodya was at the museum and saw a regular chessboard as a museum piece. And there were only four chess pieces on it: two white rooks, a white king and a black king. "Aha, blacks certainly didn't win!", β€” Vol...
2,411
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Stepan is a very experienced olympiad participant. He has *n* cups for Physics olympiads and *m* cups for Informatics olympiads. Each cup is characterized by two parameters β€” its significance *c**i* and width *w**i*. Stepan decid...
2,412
Title: Pasha and Pixels Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pasha loves his phone and also putting his hair up... But the hair is now irrelevant. Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consisting of *n* row ...
2,413
Title: Bus to Udayland Time Limit: None seconds Memory Limit: None megabytes Problem Description: ZS the Coder and Chris the Baboon are travelling to Udayland! To get there, they have to get on the special IOI bus. The IOI bus has *n* rows of seats. There are 4 seats in each row, and the seats are separated into pai...
2,414
Title: Party Time Limit: None seconds Memory Limit: None megabytes Problem Description: To celebrate the second ABBYY Cup tournament, the Smart Beaver decided to throw a party. The Beaver has a lot of acquaintances, some of them are friends with each other, and some of them dislike each other. To make party successf...
2,415
Title: Goods transportation Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities located along the one-way road. Cities are numbered from 1 to *n* in the direction of the road. The *i*-th city had produced *p**i* units of goods. No more than *s**i* units of goods can be so...
2,416
Title: Unambiguous Arithmetic Expression Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's define an unambiguous arithmetic expression (UAE) as follows. - All non-negative integers are UAE's. Integers may have leading zeroes (for example, 0000 and 0010 are considered valid integers)...
2,417
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Given an *n*<=Γ—<=*n* table *T* consisting of lowercase English letters. We'll consider some string *s* good if the table contains a correct path corresponding to the given string. In other words, good strings are all strings we ca...
2,418
Title: Yet Another Task with Queens Time Limit: None seconds Memory Limit: None megabytes Problem Description: A queen is the strongest chess piece. In modern chess the queen can move any number of squares in any horizontal, vertical or diagonal direction (considering that there're no other pieces on its way). The q...
2,419
Title: Symmetric and Transitive Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Johnny has recently learned about set theory. Now he is studying binary relations. You've probably heard the term "equivalence relation". These relations are very important in many areas of mathematics. ...
2,420
Title: Variable, or There and Back Again Time Limit: None seconds Memory Limit: None megabytes Problem Description: Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. In each ...
2,421
Title: Maximum Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a* consisting of *n* integers, and additionally an integer *m*. You have to choose some sequence of indices *b*1,<=*b*2,<=...,<=*b**k* (1<=≀<=*b*1<=&lt;<=*b*2<=&lt;<=...<=&lt;<=*b**k*<=≀<=*n*...
2,422
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: PMP is getting a warrior. He is practicing a lot, but the results are not acceptable yet. This time instead of programming contests, he decided to compete in a car racing to increase the spirit of victory. He decides to choose a c...
2,423
Title: Darts Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: The night after the graduation ceremony graduate students of German University in Cairo (GUC) are playing darts. As there's no real dart board available, the photographs of members of the GUC upper management are being used. So, *n*...
2,424
Title: Difference Row Time Limit: None seconds Memory Limit: None megabytes Problem Description: You want to arrange *n* integers *a*1,<=*a*2,<=...,<=*a**n* in some order in a row. Let's define the value of an arrangement as the sum of differences between all pairs of adjacent integers. More formally, let's denote ...
2,425
Title: Convex Countour Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an strictly convex polygon with *n* vertices. It is guaranteed that no three points are collinear. You would like to take a maximum non intersecting path on the polygon vertices that visits each point at m...
2,426
Title: Amr and Pins Time Limit: None seconds Memory Limit: None megabytes Problem Description: Amr loves Geometry. One day he came up with a very interesting problem. Amr has a circle of radius *r* and center in point (*x*,<=*y*). He wants the circle center to be in new position (*x*',<=*y*'). In one step Amr can ...
2,427
Title: Toda 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: A group of *n* friends enjoys playing popular video game Toda 2. There is a rating system describing skill level of each player, initially the rating of the *i*-th friend is *r**i*. The friends decided to take part in the champ...
2,428
Title: Sequence Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Little Petya likes to play very much. And most of all he likes to play the following game: He is given a sequence of *N* integer numbers. At each step it is allowed to increase the value of any number by 1 or to decrease it by 1. ...
2,429
Title: Winner Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes...
2,430
Title: Wardrobe Time Limit: None seconds Memory Limit: None megabytes Problem Description: Olya wants to buy a custom wardrobe. It should have *n* boxes with heights *a*1,<=*a*2,<=...,<=*a**n*, stacked one on another in some order. In other words, we can represent each box as a vertical segment of length *a**i*, and...
2,431
Title: Super Agent Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparin...
2,432
Title: Turtles Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got a table of size *n*<=Γ—<=*m*. We'll consider the table rows numbered from top to bottom 1 through *n*, and the columns numbered from left to right 1 through *m*. Then we'll denote the cell in row *x* and column *y* as...
2,433
Title: Guest From the Past Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kolya Gerasimov loves kefir very much. He lives in year 1984 and knows all the details of buying this delicious drink. One day, as you probably know, he found himself in year 2084, and buying kefir there is much mor...
2,434
Title: Codecraft III Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Today Vasya visited a widely known site and learned that the continuation of his favourite game Codecraft II will appear after exactly *k* months. He looked at the calendar and learned that at the moment is the month number *...
2,435
Title: Stock Trading Time Limit: None seconds Memory Limit: None megabytes Problem Description: This problem consists of three subproblems: for solving subproblem F1 you will receive 8 points, for solving subproblem F2 you will receive 15 points, and for solving subproblem F3 you will receive 10 points. Manao has d...
2,436
Title: Chip 'n Dale Rescue Rangers Time Limit: None seconds Memory Limit: None megabytes Problem Description: A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they were ready, and the dirigible of the rescue chipmunks hit the road...
2,437
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Old MacDonald has a farm and a large potato field, (1010<=+<=1)<=Γ—<=(1010<=+<=1) square meters in size. The field is divided into square garden beds, each bed takes up one square meter. Old McDonald knows that the Colorado potato...
2,438
Title: Elephant Time Limit: None seconds Memory Limit: None megabytes Problem Description: An elephant decided to visit his friend. It turned out that the elephant's house is located at point 0 and his friend's house is located at point *x*(*x*<=&gt;<=0) of the coordinate line. In one step the elephant can move 1, 2...
2,439
Title: 2 + 2 != 4 Time Limit: None seconds Memory Limit: None megabytes Problem Description: One very experienced problem writer decided to prepare a problem for April Fools Day contest. The task was very simple - given an arithmetic expression, return the result of evaluating this expression. However, looks like th...
2,440
Title: Special Grid Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an *n*<=Γ—<=*m* grid, some of its nodes are black, the others are white. Moreover, it's not an ordinary grid β€” each unit square of the grid has painted diagonals. The figure below is an example of such grid o...
2,441
Title: Sad powers Time Limit: None seconds Memory Limit: None megabytes Problem Description: You're given *Q* queries of the form (*L*,<=*R*). For each query you have to find the number of such *x* that *L*<=≀<=*x*<=≀<=*R* and there exist integer numbers *a*<=&gt;<=0, *p*<=&gt;<=1 such that *x*<==<=*a**p*. Input ...
2,442
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an undirected graph that consists of *n* vertices and *m* edges. Initially, each edge is colored either red or blue. Each turn a player picks a single vertex and switches the color of all edges incident to it. That i...
2,443
Title: Berzerk Time Limit: None seconds Memory Limit: None megabytes Problem Description: Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer. In this game there are *n* objects numbered fro...
2,444
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a polyline going through points (0,<=0)<=–<=(*x*,<=*x*)<=–<=(2*x*,<=0)<=–<=(3*x*,<=*x*)<=–<=(4*x*,<=0)<=–<=...<=-<=(2*kx*,<=0)<=–<=(2*kx*<=+<=*x*,<=*x*)<=–<=.... We know that the polyline passes through the point (*a*,<...
2,445
Title: Recover the String Time Limit: None seconds Memory Limit: None megabytes Problem Description: For each string *s* consisting of characters '0' and '1' one can define four integers *a*00, *a*01, *a*10 and *a*11, where *a**xy* is the number of subsequences of length 2 of the string *s* equal to the sequence {*x...
2,446
Title: Code For 1 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jon fought bravely to rescue the wildlings who were attacked by the white-walkers at Hardhome. On his arrival, Sam tells him that he wants to go to Oldtown to train at the Citadel to become a maester, so he can return and ta...
2,447
Title: Surrounded Time Limit: None seconds Memory Limit: None megabytes Problem Description: So, the Berland is at war with its eternal enemy Flatland again, and Vasya, an accountant, was assigned to fulfil his duty to the nation. Right now the situation in Berland is dismal β€” their both cities are surrounded! The...
2,448
Title: Removing Columns Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an *n*<=Γ—<=*m* rectangular table consisting of lower case English letters. In one operation you can completely remove one column from the table. The remaining parts are combined forming a new table. For e...
2,449
Title: Sum of Remainders Time Limit: None seconds Memory Limit: None megabytes Problem Description: Calculate the value of the sum: *n* mod 1 + *n* mod 2 + *n* mod 3 + ... + *n* mod *m*. As the result can be very large, you should print the value modulo 109<=+<=7 (the remainder when divided by 109<=+<=7). The modul...
2,450
Title: Almost Increasing Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: We call an array almost increasing if we can erase not more than one element from it so that the array becomes strictly increasing (that is, every element is striclty greater than every element before it). You ...
2,451
Title: Photographer Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of peopl...
2,452
Title: Guess a number! Time Limit: None seconds Memory Limit: None megabytes Problem Description: A TV show called "Guess a number!" is gathering popularity. The whole Berland, the old and the young, are watching the show. The rules are simple. The host thinks of an integer *y* and the participants guess it by aski...
2,453
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is an interactive problem. In the output section below you will see the information about flushing the output. Bear Limak thinks of some hidden numberΒ β€” an integer from interval [2,<=100]. Your task is to say if the hidden n...
2,454
Title: Mike and Shortcuts Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city. City consists of *n* intersections numbered from 1 to *n*. Mike starts walkin...
2,455
Title: Lipshitz Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: A function is called Lipschitz continuous if there is a real constant *K* such that the inequality |*f*(*x*)<=-<=*f*(*y*)|<=≀<=*K*Β·|*x*<=-<=*y*| holds for all . We'll deal with a more... discrete version of this term...
2,456
Title: Drivers Dissatisfaction Time Limit: None seconds Memory Limit: None megabytes Problem Description: In one kingdom there are *n* cities and *m* two-way roads. Each road connects a pair of cities, and for each road we know the level of drivers dissatisfactionΒ β€” the value *w**i*. For each road we know the value...
2,457
Title: Maximum splitting Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given several queries. In the *i*-th query you are given a single positive integer *n**i*. You are to represent *n**i* as a sum of maximum possible number of composite summands and print this maximum number, o...
2,458
Title: Elections Time Limit: None seconds Memory Limit: None megabytes Problem Description: The country of Byalechinsk is running elections involving *n* candidates. The country consists of *m* cities. We know how many people in each city voted for each candidate. The electoral system in the country is pretty unusu...
2,459
Title: Maximum Value Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a sequence *a* consisting of *n* integers. Find the maximum possible value of (integer remainder of *a**i* divided by *a**j*), where 1<=≀<=*i*,<=*j*<=≀<=*n* and *a**i*<=β‰₯<=*a**j*. Input Specification: The ...
2,460
Title: Toy Cars Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. There are *n* toy cars. Each pair coll...
2,461
Title: Prime Swaps Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have an array *a*[1],<=*a*[2],<=...,<=*a*[*n*], containing distinct integers from 1 to *n*. Your task is to sort this array in increasing order with the following operation (you may need to apply it multiple times): - ...
2,462
Title: Decoding Genome Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently a top secret mission to Mars has taken place. As a result, scientists managed to obtain some information about the Martian DNA. Now we know that any Martian DNA contains at most *m* different nucleotides, numbe...
2,463
Title: Testing Robots Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will ...
2,464
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches. First, as they know that kingdom police is bad at math, ro...
2,465
Title: Jamie and Alarm Snooze Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jamie loves sleeping. One day, he decides that he needs to wake up at exactly *hh*:<=*mm*. However, he hates waking up, so he wants to make waking up less painful by setting the alarm at a lucky time. He will the...
2,466
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are *n* applications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the number of unread notifications ge...
2,467
Title: Draw Brackets! Time Limit: None seconds Memory Limit: None megabytes Problem Description: A sequence of square brackets is regular if by inserting symbols "+" and "1" into it, you can get a regular mathematical expression from it. For example, sequences "[[]][]", "[]" and "[[][[]]]" β€” are regular, at the same...
2,468
Title: Drazil and His Happy Friends Time Limit: None seconds Memory Limit: None megabytes Problem Description: Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan. There are *n* boys and *m* girls among hi...
2,469
Title: Vladik and fractions Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer *n* he can represent fraction as a sum of three distinct positive fractions in form . Help Vladik ...
2,470
Title: Tower of Hanoi Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Tower of Hanoi is a well-known mathematical puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending orde...
2,471
Title: Shooting Gallery Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: Berland amusement park shooting gallery is rightly acknowledged as one of the best in the world. Every day the country's best shooters master their skills there and the many visitors compete in clay pigeon shooting to win ...
2,472
Title: Dreamoon and Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dreamoon has a string *s* and a pattern string *p*. He first removes exactly *x* characters from *s* obtaining string *s*' as a result. Then he calculates that is defined as the maximal number of non-overlapping s...
2,473
Title: Dot Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: Anton and Dasha like to play different games during breaks on checkered paper. By the 11th grade they managed to play all the games of this type and asked Vova the programmer to come up with a new game. Vova suggested to them to play a...
2,474
Title: Rectangle Puzzle II Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangle grid. That grid's size is *n*<=Γ—<=*m*. Let's denote the coordinate system on the grid. So, each point on the grid will have coordinates β€” a pair of integers (*x*,<=*y*) (0<=≀<=*x*<=≀<=*n*,<...
2,475
Title: Petya and Java Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Little Petya has recently started attending a programming club. Naturally he is facing the problem of choosing a programming language. After long considerations he realized that Java is the best choice. The main argument in ...
2,476
Title: Pair of Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Simon has an array *a*1,<=*a*2,<=...,<=*a**n*, consisting of *n* positive integers. Today Simon asked you to find a pair of integers *l*,<=*r* (1<=≀<=*l*<=≀<=*r*<=≀<=*n*), such that the following conditions hold: 1. t...
2,477
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little penguin Polo loves his home village. The village has *n* houses, indexed by integers from 1 to *n*. Each house has a plaque containing an integer, the *i*-th house has a plaque containing integer *p**i* (1<=≀<=*p**i*<=≀<=*n...
2,478
Title: Emperor's Problem Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: It happened at the times of the Great Berland Empire. Once the Emperor dreamt that the Messenger from the gods ordered to build a temple whose base would be a convex polygon with *n* angles. Next morning the Emperor gave ...
2,479
Title: Minimum Difficulty Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mike is trying rock climbing but he is awful at it. There are *n* holds on the wall, *i*-th hold is at height *a**i* off the ground. Besides, let the sequence *a**i* increase, that is, *a**i*<=&lt;<=*a**i*<=+<=1 fo...
2,480
Title: Design Tutorial: Change the Goal Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are some tasks which have the following structure: you are given a model, and you can do some operations, you should use these operations to achive the goal. One way to create a new task is to use...
2,481
Title: Wilbur and Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Wilbur the pig now wants to play with strings. He has found an *n* by *m* table consisting only of the digits from 0 to 9 where the rows are numbered 1 to *n* and the columns are numbered 1 to *m*. Wilbur starts at s...
2,482
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. In each state, Vasya can either be us...
2,483
Title: Careful Maneuvering Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are two small spaceship, surrounded by two groups of enemy larger spaceships. The space is a two-dimensional plane, and one group of the enemy spaceships is positioned in such a way that they all have integer ...
2,484
Title: Timofey and a tree 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 birthda...
2,485
Title: Dima and Staircase Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dima's got a staircase that consists of *n* stairs. The first stair is at height *a*1, the second one is at *a*2, the last one is at *a**n* (1<=≀<=*a*1<=≀<=*a*2<=≀<=...<=≀<=*a**n*). Dima decided to play with the st...
2,486
Title: Game with Tokens Time Limit: None seconds Memory Limit: None megabytes Problem Description: Consider the following game for two players. There is one white token and some number of black tokens. Each token is placed on a plane in a point with integer coordinates *x* and *y*. The players take turn making move...
2,487
Title: none 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 its way an...
2,488
Title: Cyclic Components Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an undirected graph consisting of $n$ vertices and $m$ edges. Your task is to find the number of connected components which are cycles. Here are some definitions of graph theory. An undirected graph co...
2,489
Title: Gargari and Bishops Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gargari is jealous that his friend Caisa won the game from the previous problem. He wants to prove that he is a genius. He has a *n*<=Γ—<=*n* chessboard. Each cell of the chessboard has a number written on it. Garga...
2,490
Title: Autocompletion Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (includ...
2,491
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bear Limak prepares problems for a programming competition. Of course, it would be unprofessional to mention the sponsor name in the statement. Limak takes it seriously and he is going to change some words. To make it still possib...
2,492
Title: Mister B and Book Reading Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mister B once received a gift: it was a book about aliens, which he started read immediately. This book had *c* pages. At first day Mister B read *v*0 pages, but after that he started to speed up. Every day, ...
2,493
Title: Verse Pattern Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a text consisting of *n* lines. Each line contains some space-separated words, consisting of lowercase English letters. We define a syllable as a string that contains exactly one vowel and any arbitrary num...
2,494
Title: DZY Loves Hash Time Limit: None seconds Memory Limit: None megabytes Problem Description: DZY has a hash table with *p* buckets, numbered from 0 to *p*<=-<=1. He wants to insert *n* numbers, in the order they are given, into the hash table. For the *i*-th number *x**i*, DZY will put it into the bucket numbere...
2,495
Title: Almost Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently Ivan noticed an array *a* while debugging his code. Now Ivan can't remember this array, but the bug he was trying to fix didn't go away, so Ivan thinks that the data from this array might help him to reprodu...
2,496
Title: Martian Luck Time Limit: None seconds Memory Limit: None megabytes Problem Description: You know that the Martians use a number system with base *k*. Digit *b* (0<=≀<=*b*<=&lt;<=*k*) is considered lucky, as the first contact between the Martians and the Earthlings occurred in year *b* (by Martian chronology)....
2,497
Title: Calendar Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: BerOilGasDiamondBank has branches in *n* cities, at that *n* is an even number. The bank management wants to publish a calendar with the names of all those cities written in two columns: the calendar should consist of exactly *n*<...
2,498
Title: Arpa and a research in Mexican wave Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arpa is researching the Mexican wave. There are *n* spectators in the stadium, labeled from 1 to *n*. They start the Mexican wave at time 0. - At time 1, the first spectator stands. - At time 2,...
2,499