task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Tourists Time Limit: None seconds Memory Limit: None megabytes Problem Description: A double tourist path, located at a park in Ultima Thule, is working by the following principle: - We introduce the Cartesian coordinate system. - At some points of time there are two tourists going (for a walk) from points...
3,400
Title: Choosing Symbol Pairs Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There is a given string *S* consisting of *N* symbols. Your task is to find the number of ordered pairs of integers *i* and *j* such that 1. 1<=≤<=*i*,<=*j*<=≤<=*N* 2. *S*[*i*]<==<=*S*[*j*], that is the *i*-th symbo...
3,401
Title: k-substrings Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *s* consisting of *n* lowercase Latin letters. Let's denote *k*-substring of *s* as a string *subs**k*<==<=*s**k**s**k*<=+<=1..*s**n*<=+<=1<=-<=*k*. Obviously, *subs*1<==<=*s*, and there are exactly...
3,402
Title: Uncowed Forces Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challengin...
3,403
Title: Letter Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with *n* rows and *m* columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brothe...
3,404
Title: Lucky Substring 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. ...
3,405
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a reporter, Bessie needs to know about programming competition results as quickly as possible. ...
3,406
Title: IQ Test Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the city of Ultima Thule job applicants are often offered an IQ test. The test is as follows: the person gets a piece of squared paper with a 4<=×<=4 square painted on it. Some of the square's cells are painted black and o...
3,407
Title: Paint Tree 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 correspo...
3,408
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anton came to a chocolate factory. There he found a working conveyor and decided to run on it from the beginning to the end. The conveyor is a looped belt with a total length of 2*l* meters, of which *l* meters are located on the...
3,409
Title: Sonya and Queries Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her *t* queries, each of one of the following type: 1. <=+<= *a...
3,410
Title: E-mail Addresses Time Limit: None seconds Memory Limit: None megabytes Problem Description: One of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day. Today, the online news thundered with terrible information. The R...
3,411
Title: Square Earth? Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Meg the Rabbit decided to do something nice, specifically — to determine the shortest distance between two points on the surface of our planet. But Meg... what can you say, she wants everything simple. So, she already regards...
3,412
Title: Super M Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ari the monster is not an ordinary monster. She is the hidden identity of Super M, the Byteforces’ superhero. Byteforces is a country that consists of *n* cities, connected by *n*<=-<=1 bidirectional roads. Every road connects ...
3,413
Title: Police Station Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Berland road network consists of *n* cities and of *m* bidirectional roads. The cities are numbered from 1 to *n*, where the main capital city has number *n*, and the culture capital — number 1. The road network is s...
3,414
Title: Pashmak and Garden Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pashmak has fallen in love with an attractive girl called Parmida since one year ago... Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is...
3,415
Title: Binary Protocol Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm: - Each digit is represented with number of '1' charact...
3,416
Title: Spiders Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day mum asked Petya to sort his toys and get rid of some of them. Petya found a whole box of toy spiders. They were quite dear to him and the boy didn't want to throw them away. Petya conjured a cunning plan: he will glue a...
3,417
Title: Coloring Trees Time Limit: None seconds Memory Limit: None megabytes Problem Description: ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where *n* trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with integers from 1 to *n* from...
3,418
Title: Error Correct System Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ford Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process, he needs to write ...
3,419
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a sequence of positive integers *a*1,<=*a*2,<=...,<=*a**n*. While possible, you perform the following operation: find a pair of equal consecutive elements. If there are more than one such pair, find the leftmost (w...
3,420
Title: Greedy Change Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Billy investigates the question of applying greedy algorithm to different spheres of life. At the moment he is studying the application of greedy algorithm to the problem about change. There is an amount of *n* coins of diffe...
3,421
Title: Number of Binominal Coefficients Time Limit: None seconds Memory Limit: None megabytes Problem Description: For a given prime integer *p* and integers α,<=*A* calculate the number of pairs of integers (*n*,<=*k*), such that 0<=≤<=*k*<=≤<=*n*<=≤<=*A* and is divisible by *p*α. As the answer can be rather lar...
3,422
Title: President's Path Time Limit: None seconds Memory Limit: None megabytes Problem Description: Good old Berland has *n* cities and *m* roads. Each road connects a pair of distinct cities and is bidirectional. Between any pair of cities, there is at most one road. For each road, we know its length. We also know ...
3,423
Title: Lizard Era: Beginning Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana and Worrigan. Overall the game has *n* mandatory quests. To perform each of them, you need to take exactly two com...
3,424
Title: Beautiful Function Time Limit: None seconds Memory Limit: None megabytes Problem Description: Every day Ruslan tried to count sheep to fall asleep, but this didn't help. Now he has found a more interesting thing to do. First, he thinks of some set of circles on a plane, and then tries to choose a beautiful se...
3,425
Title: Subordinates Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* workers in a company, each of them has a unique id from 1 to *n*. Exaclty one of them is a chief, his id is *s*. Each worker except the chief has exactly one immediate superior. There was a request to each o...
3,426
Title: Different is Good Time Limit: None seconds Memory Limit: None megabytes Problem Description: A wise man told Kerem "Different is good" once, so Kerem wants all things in his life to be different. Kerem recently got a string *s* consisting of lowercase English letters. Since Kerem likes it when things are di...
3,427
Title: Two permutations Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two permutations *p* and *q*, consisting of *n* elements, and *m* queries of the form: *l*1,<=*r*1,<=*l*2,<=*r*2 (*l*1<=≤<=*r*1; *l*2<=≤<=*r*2). The response for the query is the number of such integers f...
3,428
Title: Flatland Fencing Time Limit: None seconds Memory Limit: None megabytes Problem Description: The King of Flatland will organize a knights' tournament! The winner will get half the kingdom and the favor of the princess of legendary beauty and wisdom. The final test of the applicants' courage and strength will b...
3,429
Title: Enemy is weak Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: "A lion is never afraid of a hundred sheep". Nevertheless Shapur has to find weaknesses in the Roma...
3,430
Title: Polycarpus the Safecracker Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has *t* safes. The password for each safe is a square matrix consisting of decimal digits '0' ... '9' (the sizes of passwords to the safes may vary). Alas, Polycarpus has forgotten all passwords, s...
3,431
Title: Squats Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pasha has many hamsters and he makes them work out. Today, *n* hamsters (*n* is even) came to work out. The hamsters lined up and each hamster either sat down or stood up. For another exercise, Pasha needs exactly hamsters to ...
3,432
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imagine you have an infinite 2D plane with Cartesian coordinate system. Some of the integral points are blocked, and others are not. Two integral points *A* and *B* on the plane are 4-connected if and only if: - the Euclidean di...
3,433
Title: Math Show Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp takes part in a math show. He is given *n* tasks, each consists of *k* subtasks, numbered 1 through *k*. It takes him *t**j* minutes to solve the *j*-th subtask of any task. Thus, time required to solve a subtask dep...
3,434
Title: Caisa and Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Caisa is now at home and his son has a simple task for him. Given a rooted tree with *n* vertices, numbered from 1 to *n* (vertex 1 is the root). Each vertex of the tree has a value. You should answer *q* queries. Each ...
3,435
Title: Taxes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Funt now lives in a country with a very specific tax laws. The total income of mr. Funt during this year is equal to *n* (*n*<=≥<=2) burles and the amount of tax he has to pay is calculated as the maximum divisor of *n* (not ...
3,436
Title: none 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 $y$-coordinates...
3,437
Title: Divisibility Time Limit: None seconds Memory Limit: None megabytes Problem Description: Imp is really pleased that you helped him. But it you solve the last problem, his gladness would raise even more. - *a* is strictly less than *b*; - *a* divides *b* without a remainder. You are to find such a set , whi...
3,438
Title: Inversions After Shuffle Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a permutation of integers from 1 to *n*. Exactly once you apply the following operation to this permutation: pick a random segment and shuffle its elements. Formally: 1. Pick a random segment (c...
3,439
Title: Bear and Five Cards Time Limit: None seconds Memory Limit: None megabytes Problem Description: A little bear Limak plays a game. He has five cards. There is one number written on each card. Each number is a positive integer. Limak can discard (throw out) some cards. His goal is to minimize the sum of numbers...
3,440
Title: Bear and Reverse Radewoosh Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order. There will be *n* problems. The *i*-...
3,441
Title: Bug in Code Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently a serious bug has been found in the FOS code. The head of the F company wants to find the culprit and punish him. For that, he set up an organizational meeting, the issue is: who's bugged the code? Each of the *n* ...
3,442
Title: Constrained Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You need to find a binary tree of size *n* that satisfies a given set of *c* constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For the *i*-th constr...
3,443
Title: Graph Coloring 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 ...
3,444
Title: Case of a Top Secret Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrewid the Android is a galaxy-famous detective. Now he is busy with a top secret case, the details of which are not subject to disclosure. However, he needs help conducting one of the investigative experiment. ...
3,445
Title: Two Semiknights Meet Time Limit: None seconds Memory Limit: None megabytes Problem Description: A boy Petya loves chess very much. He even came up with a chess piece of his own, a semiknight. The semiknight can move in any of these four directions: 2 squares forward and 2 squares to the right, 2 squares forwa...
3,446
Title: Devu and Partitioning of the Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Devu being a small kid, likes to play a lot, but he only likes to play with arrays. While playing he came up with an interesting question which he could not solve, can you please solve it for him? Gi...
3,447
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Xenia is an amateur programmer. Today on the IT lesson she learned about the Hamming distance. The Hamming distance between two strings *s*<==<=*s*1*s*2... *s**n* and *t*<==<=*t*1*t*2... *t**n* of equal length *n* is value . Reco...
3,448
Title: Tesla Time Limit: None seconds Memory Limit: None megabytes Problem Description: Allen dreams of one day owning a enormous fleet of electric cars, the car of the future! He knows that this will give him a big status boost. As Allen is planning out all of the different types of cars he will own and how he will...
3,449
Title: The Union of k-Segments Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given *n* segments on the coordinate axis Ox and the number *k*. The point is satisfied if it belongs to at least *k* segments. Find the smallest (by the number of segments) set of segments on the coordi...
3,450
Title: Andrey and Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrey needs one more problem to conduct a programming contest. He has *n* friends who are always willing to help. He can ask some of them to come up with a contest problem. Andrey knows one value for each of his fie...
3,451
Title: Remove Extra One Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a permutation *p* of length *n*. Remove one element from permutation to make the number of records the maximum possible. We remind that in a sequence of numbers *a*1,<=*a*2,<=...,<=*a**k* the element *a*...
3,452
Title: Copying Data Time Limit: None seconds Memory Limit: None megabytes Problem Description: We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number array into another one,...
3,453
Title: Bribes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ruritania is a country with a very badly maintained road network, which is not exactly good news for lorry drivers that constantly have to do deliveries. In fact, when roads are maintained, they become one-way. It turns out that...
3,454
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an undirected graph with *n* vertices. There are no edge-simple cycles with the even length in it. In other words, there are no cycles of even length that pass each edge at most once. Let's enumerate vertices from 1 ...
3,455
Title: Ciel and Dancing Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fox Ciel and her friends are in a dancing room. There are *n* boys and *m* girls here, and they never danced before. There will be some songs, during each song, there must be exactly one boy and one girl are dancing. B...
3,456
Title: Meeting of Old Friends Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today an outstanding event is going to happen in the forest — hedgehog Filya will come to his old fried Sonya! Sonya is an owl and she sleeps during the day and stay awake from minute *l*1 to minute *r*1 inclusi...
3,457
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Welcome to another task about breaking the code lock! Explorers Whitfield and Martin came across an unusual safe, inside of which, according to rumors, there are untold riches, among which one can find the solution of the problem ...
3,458
Title: Well played! Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them: Max owns *n* creatures, *i*-th o...
3,459
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pieguy and Piegirl are playing a game. They have a rooted binary tree, that has a property that each node is either a leaf or has exactly two children. Each leaf has a number associated with it. On his/her turn a player can choos...
3,460
Title: Coin Troubles Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the Isle of Guernsey there are *n* different types of coins. For each *i* (1<=≤<=*i*<=≤<=*n*), coin of type *i* is worth *a**i* cents. It is possible that *a**i*<==<=*a**j* for some *i* and *j* (*i*<=≠<=*j*). Bessie ...
3,461
Title: Students' Revenge Time Limit: None seconds Memory Limit: None megabytes Problem Description: A student's life is fraught with complications. Some Berland University students know this only too well. Having studied for two years, they contracted strong antipathy towards the chairperson of some department. Inde...
3,462
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the game Lizard Era: Beginning the protagonist will travel with three companions: Lynn, Meliana and Worrigan. Overall the game has *n* mandatory quests. To perform each of them, you need to take exactly two companions. The att...
3,463
Title: Bash and a Tough Math Puzzle Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bash likes playing with arrays. He has an array *a*1,<=*a*2,<=... *a**n* of *n* integers. He likes to guess the greatest common divisor (gcd) of different segments of the array. Of course, sometimes the gue...
3,464
Title: Wavy numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: A wavy number is such positive integer that for any digit of its decimal representation except for the first one and the last one following condition holds: the digit is either strictly larger than both its adjacent digits...
3,465
Title: Lightbulb for Minister Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Minister for education is coming! Naturally, nobody wants to perform poorly in front of such a honored guest. However, two hours before the arrival it turned out that one of the classes has a malfunctioning l...
3,466
Title: STL Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya used to be an accountant before the war began and he is one of the few who knows how to operate a computer, so he was assigned as the programmer. We all know that programs often store sets of integers. For example, if we hav...
3,467
Title: Counting Sticks Time Limit: None seconds Memory Limit: None megabytes Problem Description: When new students come to the Specialized Educational and Scientific Centre (SESC) they need to start many things from the beginning. Sometimes the teachers say (not always unfairly) that we cannot even count. So our te...
3,468
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring. You are given a set of strings. A string (not necessarily from this set) is c...
3,469
Title: Card Game Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: There is a card game called "Durak", which means "Fool" in Russian. The game is quite popular in the countries that used to form USSR. The problem does not state all the game's rules explicitly — you can find them later yourselve...
3,470
Title: Dragons Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kirito is stuck on a level of the MMORPG he is playing now. To move on in the game, he's got to defeat all *n* dragons that live on this level. Kirito and the dragons have strength, which is represented by an integer. In the du...
3,471
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the official contest this problem has a different statement, for which jury's solution was working incorrectly, and for this reason it was excluded from the contest. This mistake have been fixed and the current given problem st...
3,472
Title: none 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 he writes...
3,473
Title: Characteristics of Rectangles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerald found a table consisting of *n* rows and *m* columns. As a prominent expert on rectangular tables, he immediately counted the table's properties, that is, the minimum of the numbers in the corners o...
3,474
Title: Bear and Prime 100 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 i...
3,475
Title: Mars rover Time Limit: None seconds Memory Limit: None megabytes Problem Description: Natasha travels around Mars in the Mars rover. But suddenly it broke down, namely — the logical scheme inside it. The scheme is an undirected tree (connected acyclic graph) with a root in the vertex $1$, in which every leaf ...
3,476
Title: Pavel and barbecue Time Limit: None seconds Memory Limit: None megabytes Problem Description: Pavel cooks barbecue. There are *n* skewers, they lay on a brazier in a row, each on one of *n* positions. Pavel wants each skewer to be cooked some time in every of *n* positions in two directions: in the one it was...
3,477
Title: Parity Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are fishing with polar bears Alice and Bob. While waiting for the fish to bite, the polar bears get bored. They come up with a game. First Alice and Bob each writes a 01-string (strings that only contain character "0" a...
3,478
Title: Fafa and his Company Time Limit: None seconds Memory Limit: None megabytes Problem Description: Fafa owns a company that works on huge projects. There are *n* employees in Fafa's company. Whenever the company has a new project to start working on, Fafa has to divide the tasks of this project among all the emp...
3,479
Title: Escape from Stones Time Limit: None seconds Memory Limit: None megabytes Problem Description: Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0,<=1]. Next, *n* stones will fall and Liss will escape from the ...
3,480
Title: Tavas and Nafas Time Limit: None seconds Memory Limit: None megabytes Problem Description: Today Tavas got his test result as an integer score and he wants to share it with his girlfriend, Nafas. His phone operating system is Tavdroid, and its keyboard doesn't have any digits! He wants to share his score wit...
3,481
Title: Cottage Village Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: A new cottage village called «Flatville» is being built in Flatland. By now they have already built in «Flatville» *n* square houses with the centres on the *Оx*-axis. The houses' sides are parallel to the coordinate axes. I...
3,482
Title: Coder Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (*x*,<=*y*), he can move to (or...
3,483
Title: Tree of Life (easy) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Heidi has finally found the mythical Tree of Life – a legendary combinatorial structure which is said to contain a prophecy crucially needed to defeat the undead armies. On the surface, the Tree of Life is just a r...
3,484
Title: Santa Claus and Tangerines Time Limit: None seconds Memory Limit: None megabytes Problem Description: Santa Claus has *n* tangerines, and the *i*-th of them consists of exactly *a**i* slices. Santa Claus came to a school which has *k* pupils. Santa decided to treat them with tangerines. However, there can be...
3,485
Title: Wizards' Duel Time Limit: None seconds Memory Limit: None megabytes Problem Description: Harry Potter and He-Who-Must-Not-Be-Named engaged in a fight to the death once again. This time they are located at opposite ends of the corridor of length *l*. Two opponents simultaneously charge a deadly spell in the en...
3,486
Title: Shaass the Great Time Limit: None seconds Memory Limit: None megabytes Problem Description: The great Shaass is the new king of the Drakht empire. The empire has *n* cities which are connected by *n*<=-<=1 bidirectional roads. Each road has an specific length and connects a pair of cities. There's a unique si...
3,487
Title: Endless Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: A Russian space traveller Alisa Selezneva, like any other schoolgirl of the late 21 century, is interested in science. She has recently visited the MIT (Moscow Institute of Time), where its chairman and the co-inventor o...
3,488
Title: BerPaint Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: Anfisa the monkey got disappointed in word processors as they aren't good enough at reflecting all the range of her emotions, that's why she decided to switch to graphics editors. Having opened the BerPaint, she saw a white rectan...
3,489
Title: Bowls Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Once Petya was in such a good mood that he decided to help his mum with the washing-up. There were *n* dirty bowls in the sink. From the geometrical point of view each bowl looks like a blunted cone. We can disregard the width of the ...
3,490
Title: Chessboard Time Limit: None seconds Memory Limit: None megabytes Problem Description: Magnus decided to play a classic chess game. Though what he saw in his locker shocked him! His favourite chessboard got broken into 4 pieces, each of size *n* by *n*, *n* is always odd. And what's even worse, some squares we...
3,491
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maxim always goes to the supermarket on Sundays. Today the supermarket has a special offer of discount systems. There are *m* types of discounts. We assume that the discounts are indexed from 1 to *m*. To use the discount number ...
3,492
Title: Prefix Product Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Consider a sequence [*a*1,<=*a*2,<=... ,<=*a**n*]. Define its prefix product sequence . Now given *n*, find a permutation of [1,<=2,<=...,<=*n*], such that its prefix product sequence is a permutation of [0,<=1...
3,493
Title: T-Shirt Hunt Time Limit: None seconds Memory Limit: None megabytes Problem Description: Not so long ago the Codecraft-17 contest was held on Codeforces. The top 25 participants, and additionally random 25 participants out of those who got into top 500, will receive a Codeforces T-shirt. Unfortunately, you di...
3,494
Title: Heidi and Library (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Whereas humans nowadays read fewer and fewer books on paper, book readership among marmots has surged. Heidi has expanded the library and is now serving longer request sequences. Input Specification: Same as...
3,495
Title: Ice Sculptures Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Berland University is preparing to celebrate the 256-th anniversary of its founding! A specially appointed Vice Rector for the celebration prepares to decorate the campus. In the center of the campus *n* ice sculptur...
3,496
Title: K-special Tables Time Limit: None seconds Memory Limit: None megabytes Problem Description: People do many crazy things to stand out in a crowd. Some of them dance, some learn by heart rules of Russian language, some try to become an outstanding competitive programmers, while others collect funny math objects...
3,497
Title: New Year's Eve Time Limit: None seconds Memory Limit: None megabytes Problem Description: Since Grisha behaved well last year, at New Year's Eve he was visited by Ded Moroz who brought an enormous bag of gifts with him! The bag contains *n* sweet candies from the good ol' bakery, each labeled from 1 to *n* co...
3,498
Title: Zuma 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,499