task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: New Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities in Berland, each of them has a unique idΒ β€” an integer from 1 to *n*, the capital is the one with id 1. Now there is a serious problem in Berland with roadsΒ β€” there are no roads. That is why there was a d...
2,100
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This problem has unusual memory constraint. At evening, Igor and Zhenya the financiers became boring, so they decided to play a game. They prepared *n* papers with the income of some company for some time periods. Note that the i...
2,101
Title: Pollywog Time Limit: None seconds Memory Limit: None megabytes Problem Description: As we all know, Dart is some kind of creature from Upside Down world. For simplicity, we call their kind pollywogs. Dart and *x*<=-<=1 other pollywogs are playing a game. There are *n* stones in a row, numbered from 1 through ...
2,102
Title: Three-level Laser Time Limit: None seconds Memory Limit: None megabytes Problem Description: An atom of element X can exist in *n* distinct states with energies *E*1<=&lt;<=*E*2<=&lt;<=...<=&lt;<=*E**n*. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified descriptio...
2,103
Title: DNA Evolution Time Limit: None seconds Memory Limit: None megabytes Problem Description: Everyone knows that DNA strands consist of nucleotides. There are four types of nucleotides: "A", "T", "G", "C". A DNA strand is a sequence of nucleotides. Scientists decided to track evolution of a rare species, which DN...
2,104
Title: History Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus likes studying at school a lot and he is always diligent about his homework. Polycarpus has never had any problems with natural sciences as his great-great-grandfather was the great physicist Seinstein. On the other ...
2,105
Title: Bathroom terminal Time Limit: None seconds Memory Limit: None megabytes Problem Description: Smith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written message "Play Me". He finds a tape in his own back pocket. After putting the tape in ...
2,106
Title: Four Divisors Time Limit: None seconds Memory Limit: None megabytes Problem Description: If an integer *a* is divisible by another integer *b*, then *b* is called the divisor of *a*. For example: 12 has positive 6 divisors. They are 1, 2, 3, 4, 6 and 12. Let’s define a function *D*(*n*) β€” number of integers...
2,107
Title: Best Edge Weight Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a connected weighted graph with *n* vertices and *m* edges. The graph doesn't contain loops nor multiple edges. Consider some edge with id *i*. Let's determine for this edge the maximum integer weight we ...
2,108
Title: Choosing Laptop Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya is choosing a laptop. The shop has *n* laptops to all tastes. Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in ...
2,109
Title: Increase and Decrease Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus has an array, consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that...
2,110
Title: Reconnaissance Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: According to the regulations of Berland's army, a reconnaissance unit should consist of exactly two soldiers. Since these two soldiers shouldn't differ much, their heights can differ by at most *d* centimeters. Captain Bob h...
2,111
Title: USB Flash Drives Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sean is trying to save a large file to a USB flash drive. He has *n* USB flash drives with capacities equal to *a*1,<=*a*2,<=...,<=*a**n* megabytes. The file size is equal to *m* megabytes. Find the minimum number of...
2,112
Title: Sky Full of Stars Time Limit: None seconds Memory Limit: None megabytes Problem Description: On one of the planets of Solar system, in Atmosphere University, many students are fans of bingo game. It is well known that one month on this planet consists of $n^2$ days, so calendars, represented as square matrix...
2,113
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This problem is the most boring one you've ever seen. Given a sequence of integers *a*1,<=*a*2,<=...,<=*a**n* and a non-negative integer *h*, our goal is to partition the sequence into two subsequences (not necessarily consist o...
2,114
Title: Aramic script Time Limit: None seconds Memory Limit: None megabytes Problem Description: In Aramic language words can only represent objects. Words in Aramic have special properties: - A word is a root if it does not contain the same letter more than once. - A root and all its permutations represent the ...
2,115
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Squirrel Liss is interested in sequences. She also has preferences of integers. She thinks *n* integers *a*1,<=*a*2,<=...,<=*a**n* are good. Now she is interested in good sequences. A sequence *x*1,<=*x*2,<=...,<=*x**k* is called...
2,116
Title: Bear and Bad Powers of 42 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak, a bear, isn't good at handling queries. So, he asks you to do it. We say that powers of 42 (numbers 1,<=42,<=1764,<=...) are bad. Other numbers are good. You are given a sequence of *n* good integers ...
2,117
Title: Labyrinth-7 Time Limit: None seconds Memory Limit: None megabytes Problem Description: See the problem statement here: [http://codeforces.com/contest/921/problem/01](//codeforces.com/contest/921/problem/01). Input Specification: none Output Specification: none Note: none
2,118
Title: Babaei and Birthday Cake Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you know, every birthday party has a cake! This time, Babaei is going to prepare the very special birthday party's cake. Simple cake is a cylinder of some radius and height. The volume of the simple cake is...
2,119
Title: Robo-Footballer Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's a beautiful April day and Wallace is playing football with his friends. But his friends do not know that Wallace actually stayed home with Gromit and sent them his robotic self instead. Robo-Wallace has several adv...
2,120
Title: Race Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Today *s* kilometer long auto race takes place in Berland. The track is represented by a straight line as long as *s* kilometers. There are *n* cars taking part in the race, all of them start simultaneously at the very beginning of th...
2,121
Title: Not Afraid Time Limit: None seconds Memory Limit: None megabytes Problem Description: Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them. There are *n* parallel universes ...
2,122
Title: Radio Station Time Limit: None seconds Memory Limit: None megabytes Problem Description: As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has *n* servers. Each server ...
2,123
Title: MUH and Important Things Time Limit: None seconds Memory Limit: None megabytes Problem Description: It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are *n* tasks for the day and each animal should do each ...
2,124
Title: Death Stars (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: The stardate is 1983, and Princess Heidi is getting better at detecting the Death Stars. This time, two Rebel spies have yet again given Heidi two maps with the possible locations of the Death Star. Since she got r...
2,125
Title: Coins Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One day Vasya came across three Berland coins. They didn't have any numbers that's why Vasya didn't understand how their denominations differ. He supposed that if one coin is heavier than the other one, then it should be worth more. ...
2,126
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: One must train much to do well on wizardry contests. So, there are numerous wizardry schools and magic fees. One of such magic schools consists of *n* tours. A winner of each tour gets a huge prize. The school is organised quite ...
2,127
Title: Card Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Digital collectible card games have become very popular recently. So Vova decided to try one of these. Vova has *n* cards in his collection. Each of these cards is characterised by its power *p**i*, magic number *c**i* and l...
2,128
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out *n* numbers on a single line. After that, Vasya began to write out different ways to put pluses ("+") in the line between cert...
2,129
Title: Weird Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Yaroslav, Andrey and Roman can play cubes for hours and hours. But the game is for three, so when Roman doesn't show up, Yaroslav and Andrey play another game. Roman leaves a word for each of them. Each word consists of 2Β·...
2,130
Title: Choosing Carrot Time Limit: None seconds Memory Limit: None megabytes Problem Description: Oleg the bank client and Igor the analyst are arguing again. This time, they want to pick a gift as a present for their friend, ZS the coder. After a long thought, they decided that their friend loves to eat carrots the...
2,131
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: User ainta likes trees. This time he is going to make an undirected tree with *n* vertices numbered by integers from 1 to *n*. The tree is weighted, so each edge of the tree will have some integer weight. Also he has an array *t*...
2,132
Title: Jamie and Binary Sequence (changed after round) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jamie is preparing a Codeforces round. He has got an idea for a problem, but does not know how to solve it. Help him write a solution to the following problem: Find *k* integers such tha...
2,133
Title: Rectangle Puzzle Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two rectangles on a plane. The centers of both rectangles are located in the origin of coordinates (meaning the center of the rectangle's symmetry). The first rectangle's sides are parallel to the coordin...
2,134
Title: Geometrical Progression Time Limit: None seconds Memory Limit: None megabytes Problem Description: For given *n*, *l* and *r* find the number of distinct geometrical progression, each of which contains *n* distinct integers not less than *l* and not greater than *r*. In other words, for each progression the f...
2,135
Title: none 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*<=≀<=*min...
2,136
Title: Xenia and Dominoes Time Limit: None seconds Memory Limit: None megabytes Problem Description: Xenia likes puzzles very much. She is especially fond of the puzzles that consist of domino pieces. Look at the picture that shows one of such puzzles. A puzzle is a 3<=Γ—<=*n* table with forbidden cells (black squar...
2,137
Title: Maximum of Maximums of Minimums Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array *a*1,<=*a*2,<=...,<=*a**n* consisting of *n* integers, and an integer *k*. You have to split the array into exactly *k* non-empty subsegments. You'll then compute the minimum integ...
2,138
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've got array *A*, consisting of *n* integers and a positive integer *k*. Array *A* is indexed by integers from 1 to *n*. You need to permute the array elements so that value Input Specification: The first line contains two i...
2,139
Title: Coins and Queries Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp has $n$ coins, the value of the $i$-th coin is $a_i$. It is guaranteed that all the values are integer powers of $2$ (i.e. $a_i = 2^d$ for some non-negative integer number $d$). Polycarp wants to know answer...
2,140
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a string of decimal digits *s*. Let's define *b**ij*<==<=*s**i*Β·*s**j*. Find in matrix *b* the number of such rectangles that the sum *b**ij* for all cells (*i*,<=*j*) that are the elements of the rectangle equals *a* in ...
2,141
Title: Memory for Arrays Time Limit: None seconds Memory Limit: None megabytes Problem Description: You get to work and turn on the computer. You start coding and give little thought to the RAM role in the whole process. In this problem your task is to solve one of the problems you encounter in your computer routine...
2,142
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem you need to write job distribution subsystem for testing submissions. Invokers (simplistically) are components of testing system, which test given submission on single test and give back a verdict. In this problem...
2,143
Title: Magic Powder - 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: The term of this problem is the same as the previous one, the only exception β€” increased restrictions. Input Specification: The first line contains two positive integers *n* and *k* (1<=≀<=*n*<=≀<=100<=000,<=1<=≀<=*k*...
2,144
Title: Birthday Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anna's got a birthday today. She invited many guests and cooked a huge (nearly infinite) birthday cake decorated by *n* banana circles of different sizes. Maria's birthday is about to start in 7 minutes too, and while Anna is ...
2,145
Title: Life Without Zeros Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Can you imagine our life if we removed all zeros from it? For sure we will have many problems. In this problem we will have a simple example if we removed all zeros from our life, it's the addition operation. Let's assu...
2,146
Title: Roma and Poker Time Limit: None seconds Memory Limit: None megabytes Problem Description: Each evening Roma plays online poker on his favourite website. The rules of poker on this website are a bit strange: there are always two players in a hand, there are no bets, and the winner takes 1 virtual bourle from t...
2,147
Title: k-th divisor Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two integers *n* and *k*. Find *k*-th smallest divisor of *n*, or report that it doesn't exist. Divisor of *n* is any such natural number, that *n* can be divided by it without remainder. Input Specificatio...
2,148
Title: Shaass and Lights Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* lights aligned in a row. These lights are numbered 1 to *n* from left to right. Initially some of the lights are switched on. Shaass wants to switch all the lights on. At each step he can switch a light ...
2,149
Title: Finding lines Time Limit: None seconds Memory Limit: None megabytes Problem Description: After some programming contest Roma decided to try himself in tourism. His home country Uzhlyandia is a Cartesian plane. He wants to walk along each of the Main Straight Lines in Uzhlyandia. It is known that each of these...
2,150
Title: Cutlet Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady wants to have a dinner. He has just returned from a shop where he has bought a semifinished cutlet. He only needs to fry it. The cutlet should be fried for 2*n* seconds, in particular, it should be fried for *n* seconds o...
2,151
Title: Fraction Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction is called proper iff its numerator is smaller than its denominator (*a*<=&lt;<=*b*) and that the fraction is cal...
2,152
Title: Strange Radiation Time Limit: None seconds Memory Limit: None megabytes Problem Description: *n* people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can...
2,153
Title: New Year Garland Time Limit: None seconds Memory Limit: None megabytes Problem Description: As Gerald, Alexander, Sergey and Gennady are already busy with the usual New Year chores, Edward hastily decorates the New Year Tree. And any decent New Year Tree must be decorated with a good garland. Edward has lamps...
2,154
Title: Summer Dichotomy Time Limit: None seconds Memory Limit: None megabytes Problem Description: *T* students applied into the ZPP class of Summer Irrelevant School. The organizing committee of the school may enroll any number of them, but at least *t* students must be enrolled. The enrolled students should be div...
2,155
Title: Rank List Time Limit: None seconds Memory Limit: None megabytes Problem Description: Another programming contest is over. You got hold of the contest's final results table. The table has the following data. For each team we are shown two numbers: the number of problems and the total penalty time. However, for...
2,156
Title: Roads not only in Berland Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Berland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighboring countries it became possible to reach a...
2,157
Title: Gift Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The kingdom of Olympia consists of *N* cities and *M* bidirectional roads. Each road connects exactly two cities and two cities can be connected with more than one road. Also it possible that some roads connect city with itself making...
2,158
Title: Beautiful Subarrays Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day, ZS the Coder wrote down an array of integers *a*<=with elements *a*1,<=<=*a*2,<=<=...,<=<=*a**n*. A subarray of the array *a* is a sequence *a**l*,<=<=*a**l*<=<=+<=<=1,<=<=...,<=<=*a**r* for some integers ...
2,159
Title: Japanese Crosswords Strike Back Time Limit: None seconds Memory Limit: None megabytes Problem Description: A one-dimensional Japanese crossword can be represented as a binary string of length *x*. An encoding of this crossword is an array *a* of size *n*, where *n* is the number of segments formed completely ...
2,160
Title: Magic Box Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges are parallel to the coord...
2,161
Title: Almost Prime Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A number is called almost prime if it has exactly two distinct prime divisors. For example, numbers 6, 18, 24 are almost prime, while 4, 8, 9, 42 are not. Find the amount of almost prime numbers which are between 1 and *n*, in...
2,162
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *S* of length *n* with each character being one of the first *m* lowercase English letters. Calculate how many different strings *T* of length *n* composed from the first *m* lowercase English letters exis...
2,163
Title: Bear and Cavalry Time Limit: None seconds Memory Limit: None megabytes Problem Description: Would you want to fight against bears riding horses? Me neither. Limak is a grizzly bear. He is general of the dreadful army of Bearland. The most important part of an army is cavalry of course. Cavalry of Bearland c...
2,164
Title: Dasha and Puzzle Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity β€” origami, but remembered the puzzle that she could not solve. The tree is a non-oriented connected graph wit...
2,165
Title: Square Root of Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: A permutation of length *n* is an array containing each integer from 1 to *n* exactly once. For example, *q*<==<=[4,<=5,<=1,<=2,<=3] is a permutation. For the permutation *q* the square of permutation is the ...
2,166
Title: Division into Teams Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves football very much, especially when his parents aren't home. Each morning he comes to the yard, gathers his friends and they play all day. From time to time they have a break to have some food or do some...
2,167
Title: Simple Molecules Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mad scientist Mike is busy carrying out experiments in chemistry. Today he will attempt to join three atoms into one molecule. A molecule consists of atoms, with some pairs of atoms connected by atomic bonds. Each ato...
2,168
Title: Group Projects Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* students in a class working on group projects. The students will divide into groups (some students may be in groups alone), work on their independent pieces, and then discuss the results together. It takes ...
2,169
Title: Vasya and String Time Limit: None seconds Memory Limit: None megabytes Problem Description: High school student Vasya got a string of length *n* as a birthday present. This string consists of letters 'a' and 'b' only. Vasya denotes beauty of the string as the maximum length of a substring (consecutive subsequ...
2,170
Title: Playing with Dice Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two players are playing a game. First each of them writes an integer from 1 to 6, and then a dice is thrown. The player whose written number got closer to the number on the dice wins. If both payers have the same diff...
2,171
Title: Bear and Destroying Subtrees Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a little grizzly bear. He will once attack Deerland but now he can only destroy trees in role-playing games. Limak starts with a tree with one vertex. The only vertex has index 1 and is a root of t...
2,172
Title: Galaxy Union Time Limit: 3 seconds Memory Limit: 256 megabytes Problem Description: In a far away galaxy there are *n* inhabited planets numbered with numbers from 1 to *n*. One day the presidents of all the *n* planets independently from each other came up with an idea of creating the Galaxy Union. Now they ...
2,173
Title: They Are Everywhere Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sergei B., the young coach of Pokemons, has found the big house which consists of *n* flats ordered in a row from left to right. It is possible to enter each flat from the street. It is possible to go out from each ...
2,174
Title: Freelancer's Dreams Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mikhail the Freelancer dreams of two things: to become a cool programmer and to buy a flat in Moscow. To become a cool programmer, he needs at least *p* experience points, and a desired flat in Moscow costs *q* doll...
2,175
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: This is an interactive problem. You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to *x*. More formally, there is a singly liked list bu...
2,176
Title: Buses Between Cities Time Limit: None seconds Memory Limit: None megabytes Problem Description: Buses run between the cities *A* and *B*, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city *A* departs every *a* minutes and arrives to the city *B* in a *t**a* ...
2,177
Title: Three strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given three strings (*s*1,<=*s*2,<=*s*3). For each integer *l* (1<=≀<=*l*<=≀<=*min*(|*s*1|,<=|*s*2|,<=|*s*3|) you need to find how many triples (*i*1,<=*i*2,<=*i*3) exist such that three strings *s**k*[*i**k*... *...
2,178
Title: Om Nom and Dark Park Time Limit: None seconds Memory Limit: None megabytes Problem Description: Om Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even somebody as fearless a...
2,179
Title: Jon and Orbs Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jon Snow is on the lookout for some orbs required to defeat the white walkers. There are *k* different types of orbs and he needs at least one of each. One orb spawns daily at the base of a Weirwood tree north of the wall....
2,180
Title: Sereja and Periods Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's introduce the designation , where *x* is a string, *n* is a positive integer and operation "<=+<=" is the string concatenation operation. For example, [*abc*,<=2]<==<=*abcabc*. We'll say that string *s* can be...
2,181
Title: Solitaire Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: Vasya has a pack of 54 cards (52 standard cards and 2 distinct jokers). That is all he has at the moment. Not to die from boredom, Vasya plays Solitaire with them. Vasya lays out *nm* cards as a rectangle *n*<=Γ—<=*m*. If there a...
2,182
Title: Div. 64 Time Limit: None seconds Memory Limit: None megabytes Problem Description: Top-model Izabella participates in the competition. She wants to impress judges and show her mathematical skills. Her problem is following: for given string, consisting of only 0 and 1, tell if it's possible to remove some dig...
2,183
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Note that girls in Arpa’s land are really attractive. Arpa loves overnight parties. In the middle of one of these parties Mehrdad suddenly appeared. He saw *n* pairs of friends sitting around a table. *i*-th pair consisted of a b...
2,184
Title: Alyona and towers Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alyona has built *n* towers by putting small cubes some on the top of others. Each cube has size 1<=Γ—<=1<=Γ—<=1. A tower is a non-zero amount of cubes standing on the top of each other. The towers are next to each othe...
2,185
Title: Fools and Foolproof Roads Time Limit: None seconds Memory Limit: None megabytes Problem Description: You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of *n* cities...
2,186
Title: Journey Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The territory of Berland is represented by a rectangular field *n*<=Γ—<=*m* in size. The king of Berland lives in the capital, located on the upper left square (1,<=1). The lower right square has coordinates (*n*,<=*m*). One day the...
2,187
Title: Carrot Cakes Time Limit: None seconds Memory Limit: None megabytes Problem Description: In some game by Playrix it takes *t* minutes for an oven to bake *k* carrot cakes, all cakes are ready at the same moment *t* minutes after they started baking. Arkady needs at least *n* cakes to complete a task, but he cu...
2,188
Title: Inna and Alarm Clock Time Limit: None seconds Memory Limit: None megabytes Problem Description: Inna loves sleeping very much, so she needs *n* alarm clocks in total to wake up. Let's suppose that Inna's room is a 100<=Γ—<=100 square with the lower left corner at point (0,<=0) and with the upper right corner a...
2,189
Title: Road Improvement Time Limit: None seconds Memory Limit: None megabytes Problem Description: The country has *n* cities and *n*<=-<=1 bidirectional roads, it is possible to get from every city to any other one if you move only along the roads. The cities are numbered with integers from 1 to *n* inclusive. All...
2,190
Title: Sonya and Problem Wihtout a Legend Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sonya was unable to think of a story for this problem, so here comes the formal description. You are given the array containing *n* positive integers. At one turn you can pick any element and increas...
2,191
Title: Spy Syndrome 2 Time Limit: None seconds Memory Limit: None megabytes Problem Description: After observing the results of Spy Syndrome, Yash realised the errors of his ways. He now believes that a super spy such as Siddhant can't use a cipher as basic and ancient as Caesar cipher. After many weeks of observati...
2,192
Title: The Last Hole! 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 ...
2,193
Title: Berland Federalization Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently, Berland faces federalization requests more and more often. The proponents propose to divide the country into separate states. Moreover, they demand that there is a state which includes exactly *k* towns...
2,194
Title: Edges in MST Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a connected weighted undirected graph without any loops and multiple edges. Let us remind you that a graph's spanning tree is defined as an acyclic connected subgraph of the given graph that includes all of...
2,195
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Of course our child likes walking in a zoo. The zoo has *n* areas, that are numbered from 1 to *n*. The *i*-th area contains *a**i* animals in it. Also there are *m* roads in the zoo, and each road connects two distinct areas. Nat...
2,196
Title: No to Palindromes! Time Limit: None seconds Memory Limit: None megabytes Problem Description: Paul hates palindromes. He assumes that string *s* is tolerable if each its character is one of the first *p* letters of the English alphabet and *s* doesn't contain any palindrome contiguous substring of length 2 or...
2,197
Title: An overnight dance in discotheque Time Limit: None seconds Memory Limit: None megabytes Problem Description: The crowdedness of the discotheque would never stop our friends from having fun, but a bit more spaciousness won't hurt, will it? The discotheque can be seen as an infinite *xy*-plane, in which there ...
2,198
Title: Upgrading Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have an array of positive integers *a*[1],<=*a*[2],<=...,<=*a*[*n*] and a set of bad prime numbers *b*1,<=*b*2,<=...,<=*b**m*. The prime numbers that do not occur in the set *b* are considered good. The beauty of ar...
2,199