task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: Coupons and Discounts Time Limit: None seconds Memory Limit: None megabytes Problem Description: The programming competition season has already started and it's time to train for ICPC. Sereja coaches his teams for a number of year and he knows that to get ready for the training session it's not enough to prep...
3,000
Title: Cities Excursions Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* cities in Berland. Some pairs of them are connected with *m* directed roads. One can use only these roads to move from one city to another. There are no roads that connect a city to itself. For each pair...
3,001
Title: Ant colony Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mole is hungry again. He found one ant colony, consisting of *n* ants, ordered in a row. Each ant *i* (1<=≀<=*i*<=≀<=*n*) has a strength *s**i*. In order to make his dinner more interesting, Mole organizes a version of Β«Hun...
3,002
Title: Mister B and PR Shifts Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some time ago Mister B detected a strange signal from the space, which he started to study. After some transformation the signal turned out to be a permutation *p* of length *n* or its cyclic shift. For the furt...
3,003
Title: Tanya and Stairways Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little girl Tanya climbs the stairs inside a multi-storey building. Every time Tanya climbs a stairway, she starts counting steps from $1$ to the number of steps in this stairway. She speaks every number aloud. For ...
3,004
Title: Lieges of Legendre Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kevin and Nicky Sun have invented a new game called Lieges of Legendre. In this game, two players take turns modifying the game state with Kevin moving first. Initially, the game is set up so that there are *n* piles...
3,005
Title: Replace To Make Regular Bracket Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given string *s* consists of opening and closing brackets of four kinds &lt;&gt;, {}, [], (). There are two types of brackets: opening and closing. You can replace any bracket by another...
3,006
Title: Equal Sums Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given $k$ sequences of integers. The length of the $i$-th sequence equals to $n_i$. You have to choose exactly two sequences $i$ and $j$ ($i \ne j$) such that you can remove exactly one element in each of them in su...
3,007
Title: Bitwise Formula Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer *m*, bit depth of the game, which means that all n...
3,008
Title: Logistical Questions Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some country consists of *n* cities, connected by a railroad network. The transport communication of the country is so advanced that the network consists of a minimum required number of (*n*<=-<=1) bidirectional ro...
3,009
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform *n* operations. Each operation is one of the following: 1. Add the integer *x**i*...
3,010
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Galya is playing one-dimensional Sea Battle on a 1<=Γ—<=*n* grid. In this game *a* ships are placed on the grid. Each of the ships consists of *b* consecutive cells. No cell can be part of two ships, however, the ships can touch ea...
3,011
Title: 4-point polyline Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangular grid of lattice points from (0,<=0) to (*n*,<=*m*) inclusive. You have to choose exactly 4 different points to build a polyline possibly with self-intersections and self-touching. This polyl...
3,012
Title: Special Task Time Limit: None seconds Memory Limit: None megabytes Problem Description: Special Agent Smart Beaver works in a secret research department of ABBYY. He's been working there for a long time and is satisfied with his job, as it allows him to eat out in the best restaurants and order the most expen...
3,013
Title: Chat Servers Outgoing Traffic Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Polycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in fr...
3,014
Title: Union of Doubly Linked Lists Time Limit: None seconds Memory Limit: None megabytes Problem Description: Doubly linked list is one of the fundamental data structures. A doubly linked list is a sequence of elements, each containing information about the previous and the next elements of the list. In this proble...
3,015
Title: Pokermon League challenge Time Limit: None seconds Memory Limit: None megabytes Problem Description: Welcome to the world of Pokermon, yellow little mouse-like creatures, who absolutely love playing poker! Yeah, right… In the ensuing Pokermon League, there are *n* registered Pokermon trainers, and *t* exi...
3,016
Title: Dinner with Emma Time Limit: None seconds Memory Limit: None megabytes Problem Description: Jack decides to invite Emma out for a dinner. Jack is a modest student, he doesn't want to go to an expensive restaurant. Emma is a girl with high taste, she prefers elite places. Munhattan consists of *n* streets and...
3,017
Title: Yaroslav and Sequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Yaroslav has an array, consisting of (2Β·*n*<=-<=1) integers. In a single operation Yaroslav can change the sign of exactly *n* elements in the array. In other words, in one operation Yaroslav can select exactly *n...
3,018
Title: Dasha and Very Difficult Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences *a* and *b* of length *n* each you need to write a sequence *c* of length *n*, the *i*-th elemen...
3,019
Title: Skills Time Limit: None seconds Memory Limit: None megabytes Problem Description: Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was introduced. Now, each player character has exactly *n* skills. Each skill is represented by a non-negati...
3,020
Title: More Reclamation Time Limit: None seconds Memory Limit: None megabytes Problem Description: In a far away land, there are two cities near a river. One day, the cities decide that they have too little space and would like to reclaim some of the river area into land. The river area can be represented by a grid...
3,021
Title: Train Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: A stowaway and a controller play the following game. The train is represented by *n* wagons which are numbered with positive integers from 1 to *n* from the head to the tail. The stowaway and the controller are initially in some tw...
3,022
Title: Grammar Lessons Time Limit: 5 seconds Memory Limit: 256 megabytes Problem Description: Petya got interested in grammar on his third year in school. He invented his own language called Petya's. Petya wanted to create a maximally simple language that would be enough to chat with friends, that's why all the lang...
3,023
Title: Love Triangle Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are *n* planes on Earth, numbered from 1 to *n*, and the plane with number *i* likes the plane with ...
3,024
Title: New Year and Old Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: A string *t* is called nice if a string "2017" occurs in *t* as a subsequence but a string "2016" doesn't occur in *t* as a subsequence. For example, strings "203434107" and "9220617" are nice, while string...
3,025
Title: Karen and Morning Time Limit: None seconds Memory Limit: None megabytes Problem Description: Karen is getting ready for a new school day! It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome. Wh...
3,026
Title: Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: Two players play the following game. Initially, the players have a knife and a rectangular sheet of paper, divided into equal square grid cells of unit size. The players make moves in turn, the player who can't make a move loses. ...
3,027
Title: Distinct Paths Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a rectangular *n*<=Γ—<=*m*-cell board. Some cells are already painted some of *k* colors. You need to paint each uncolored cell one of the *k* colors so that any path from the upper left square to the lower right...
3,028
Title: New Year and North Pole Time Limit: None seconds Memory Limit: None megabytes Problem Description: In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of the equator and any meridian is considered to be exactly 40<=000 kilometers. Thus, travelling fro...
3,029
Title: Mishka and Interesting sum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers *a*1,<=*a*2,<=...,<=*a**n* of *n* elements! Mishka loved the array...
3,030
Title: Xors on Segments Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given an array with *n* integers *a**i* and *m* queries. Each query is described by two integers (*l**j*,<=*r**j*). Let's define the function . The function is defined for only *u*<=≀<=*v*. For each query pri...
3,031
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A tree is an undirected connected graph without cycles. Let's consider a rooted undirected tree with *n* vertices, numbered 1 through *n*. There are many ways to represent such a tree. One way is to create an array with *n* integ...
3,032
Title: Bus Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: This night wasn't easy on Vasya. His favorite team lost, and he didn't find himself victorious eitherΒ β€” although he played perfectly, his teammates let him down every time. He had to win at least one more time, but the loses...
3,033
Title: Cards and Joy Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are $n$ players sitting at the card table. Each player has a favorite number. The favorite number of the $j$-th player is $f_j$. There are $k \cdot n$ cards on the table. Each card contains a single integer: the $i...
3,034
Title: Ability To Convert Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alexander is learning how to convert numbers from the decimal system to any other, however, he doesn't know English letters, so he writes any number only as a decimal number, it means that instead of the letter *A* h...
3,035
Title: Mahmoud and Ehab and the final stage Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mahmoud and Ehab solved Dr. Evil's questions so he gave them the password of the door of the evil land. When they tried to open the door using it, the door gave them a final question to solve before...
3,036
Title: Jumping Jack Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Jack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point *x*. In order to train, he has decided that he'll first jump by only one unit, and each ...
3,037
Title: Wizard's Tour Time Limit: None seconds Memory Limit: None megabytes Problem Description: All Berland residents are waiting for an unprecedented tour of wizard in his Blue Helicopter over the cities of Berland! It is well-known that there are *n* cities in Berland, some pairs of which are connected by bidirec...
3,038
Title: String Reconstruction Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ivan had string *s* consisting of small English letters. However, his friend Julia decided to make fun of him and hid the string *s*. Ivan preferred making a new string to finding the old one. Ivan knows some in...
3,039
Title: Woodcutters Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described b...
3,040
Title: Two Friends Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the film impressed them...
3,041
Title: Cyclic Cipher Time Limit: None seconds Memory Limit: None megabytes Problem Description: Senor Vorpal Kickass'o invented an innovative method to encrypt integer sequences of length *n*. To encrypt a sequence, one has to choose a secret sequence , that acts as a key. Vorpal is very selective, so the key shoul...
3,042
Title: Bob and stages Time Limit: None seconds Memory Limit: None megabytes Problem Description: The citizens of BubbleLand are celebrating their 10th anniversary so they decided to organize a big music festival. Bob got a task to invite *N* famous singers who would sing on the fest. He was too busy placing stages f...
3,043
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's assume that - *v*(*n*) is the largest prime number, that does not exceed *n*;- *u*(*n*) is the smallest prime number strictly greater than *n*. Find . Input Specification: The first line contains integer *t*Β (1<=≀<=*t*...
3,044
Title: Fox and Meteor Shower Time Limit: None seconds Memory Limit: None megabytes Problem Description: There is a meteor shower on the sky and there are *n* meteors. The sky can be viewed as a 2D Euclid Plane and the meteor is point on this plane. Fox Ciel looks at the sky. She finds out that the orbit of each me...
3,045
Title: Team Olympiad Time Limit: None seconds Memory Limit: None megabytes Problem Description: The School β„–0 of the capital of Berland has *n* children studying in it. All the children in this school are gifted: some of them are good at programming, some are good at maths, others are good at PE (Physical Education)...
3,046
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a rectangular parallelepiped with sides of positive integer lengths $A$, $B$ and $C$. Find the number of different groups of three integers ($a$, $b$, $c$) such that $1\leq a\leq b\leq c$ and parallelepiped $A\time...
3,047
Title: Maxim and Discounts 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 d...
3,048
Title: Square Subsets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya was late for the lesson too. The teacher gave him an additional task. For some array *a* Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their produc...
3,049
Title: Labyrinth-8 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
3,050
Title: Heads or Tails Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya and Vasya are tossing a coin. Their friend Valera is appointed as a judge. The game is very simple. First Vasya tosses a coin *x* times, then Petya tosses a coin *y* times. If the tossing player gets head, he score...
3,051
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Artem is given a graph, constructed as follows: start with some *k*-clique, then add new vertices one by one, connecting them to *k* already existing vertices that form a *k*-clique. Artem wants to count the number of span...
3,052
Title: Mushroom Scientists Time Limit: None seconds Memory Limit: None megabytes Problem Description: As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (*x*,<=*y*,<=*z*). In this coordinate s...
3,053
Title: Sereja and Sets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's assume that set *S* consists of *m* distinct intervals [*l*1,<=*r*1], [*l*2,<=*r*2], ..., [*l**m*,<=*r**m*] (1<=≀<=*l**i*<=≀<=*r**i*<=≀<=*n*; *l**i*,<=*r**i* are integers). Let's assume that *f*(*S*) is the maxim...
3,054
Title: A Trivial Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer *m* and asks for the number of positive integers *n*, such that the factorial of *n* ends with exactly *m* zer...
3,055
Title: Ghd Time Limit: None seconds Memory Limit: None megabytes Problem Description: John Doe offered his sister Jane Doe find the gcd of some set of numbers *a*. Gcd is a positive integer *g*, such that all number from the set are evenly divisible by *g* and there isn't such *g*' (*g*'<=&gt;<=*g*), that all numbe...
3,056
Title: Arkady and Rectangles Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady has got an infinite plane painted in color $0$. Then he draws $n$ rectangles filled with paint with sides parallel to the Cartesian coordinate axes, one after another. The color of the $i$-th rectangle is $...
3,057
Title: New York Hotel Time Limit: None seconds Memory Limit: None megabytes Problem Description: Think of New York as a rectangular grid consisting of *N* vertical avenues numerated from 1 to *N* and *M* horizontal streets numerated 1 to *M*. *C* friends are staying at *C* hotels located at some street-avenue crossi...
3,058
Title: Four Segments Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creati...
3,059
Title: Embassy Queue Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: In an embassy of a well-known kingdom an electronic queue is organised. Every person who comes to the embassy, needs to make the following three actions: show the ID, pay money to the cashier and be fingerprinted. Besides, th...
3,060
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $n - 2$ intermediate planets. Formally: we number all the planets from $1$ to $n$. $1$ is Earth, $n$ is Mars. Natasha will...
3,061
Title: Books Time Limit: None seconds Memory Limit: None megabytes Problem Description: When Valera has got some free time, he goes to the library to read some books. Today he's got *t* free minutes to read. That's why Valera took *n* books in the library and for each book he estimated the time he is going to need t...
3,062
Title: Increasing Sequence Time Limit: 1 seconds Memory Limit: 64 megabytes Problem Description: A sequence *a*0,<=*a*1,<=...,<=*a**t*<=-<=1 is called increasing if *a**i*<=-<=1<=&lt;<=*a**i* for each *i*:<=0<=&lt;<=*i*<=&lt;<=*t*. You are given a sequence *b*0,<=*b*1,<=...,<=*b**n*<=-<=1 and a positive integer *d*...
3,063
Title: Xenia and Ringroad Time Limit: None seconds Memory Limit: None megabytes Problem Description: Xenia lives in a city that has *n* houses built along the main ringroad. The ringroad houses are numbered 1 through *n* in the clockwise order. The ringroad traffic is one way and also is clockwise. Xenia has recent...
3,064
Title: Find Extra One Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have *n* distinct points on a plane, none of them lie on *OY* axis. Check that there is a point after removal of which the remaining points are located on one side of the *OY* axis. Input Specification: The first li...
3,065
Title: Tram Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: In a Berland city S*** there is a tram engine house and only one tram. Three people work in the house β€” the tram driver, the conductor and the head of the engine house. The tram used to leave the engine house every morning and drove al...
3,066
Title: Hydra Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph. A non-oriented graph is a hydra, if it has a structure, shown on the fig...
3,067
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Petya loves lucky numbers very much. Everybody knows that lucky numbers are positive integers whose decimal record contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya ha...
3,068
Title: Gabriel and Caterpillar Time Limit: None seconds Memory Limit: None megabytes Problem Description: The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height *h*1 cm from the ground. On the height *h*2 cm (*h*2<=&gt;<=*h*...
3,069
Title: Towers Time Limit: None seconds Memory Limit: None megabytes Problem Description: The city of D consists of *n* towers, built consecutively on a straight line. The height of the tower that goes *i*-th (from left to right) in the sequence equals *h**i*. The city mayor decided to rebuild the city to make it bea...
3,070
Title: Set of Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a string *q*. A sequence of *k* strings *s*1,<=*s*2,<=...,<=*s**k* is called beautiful, if the concatenation of these strings is string *q* (formally, *s*1<=+<=*s*2<=+<=...<=+<=*s**k*<==<=*q*) and the first...
3,071
Title: Thor 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...
3,072
Title: Report Time Limit: None seconds Memory Limit: None megabytes Problem Description: Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are *n* commodities produced by the company. For each of them there is exactly one integer in the final report, that...
3,073
Title: MEX Queries Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a set of integer numbers, initially it is empty. You should perform *n* queries. There are three different types of queries: - 1 *l* *r* β€” Add all missing numbers from the interval [*l*,<=*r*] - 2 *l* *r*...
3,074
Title: Sagheer and Crossroads Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two parts where each part has 3 lanes getting into the intersection (one for each direction) and 3 l...
3,075
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kevin has just recevied his disappointing results on the USA Identification of Cows Olympiad (USAICO) in the form of a binary string of length *n*. Each character of Kevin's string represents Kevin's score on one of the *n* questi...
3,076
Title: Huffman Coding on Segment Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alice wants to send an important message to Bob. Message *a*<==<=(*a*1,<=...,<=*a**n*) is a sequence of positive integers (characters). To compress the message Alice wants to use binary Huffman coding. We rec...
3,077
Title: Maximum Questions Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vasya wrote down two strings *s* of length *n* and *t* of length *m* consisting of small English letters 'a' and 'b'. What is more, he knows that string *t* has a form "abab...", namely there are letters 'a' on odd po...
3,078
Title: Maxim and Increasing Subsequence Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maxim loves sequences, especially those that strictly increase. He is wondering, what is the length of the longest increasing subsequence of the given sequence *a*? Sequence *a* is given as follows: ...
3,079
Title: Chocolate Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarpus likes giving presents to Paraskevi. He has bought two chocolate bars, each of them has the shape of a segmented rectangle. The first bar is *a*1<=Γ—<=*b*1 segments large and the second one is *a*2<=Γ—<=*b*2 segments ...
3,080
Title: Vanya and Treasure Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vanya is in the palace that can be represented as a grid *n*<=Γ—<=*m*. Each room contains a single chest, an the room located in the *i*-th row and *j*-th columns contains the chest of type *a**ij*. Each chest of type...
3,081
Title: Degenerate Matrix Time Limit: None seconds Memory Limit: None megabytes Problem Description: The determinant of a matrix 2<=Γ—<=2 is defined as follows: A matrix is called degenerate if its determinant is equal to zero. The norm ||*A*|| of a matrix *A* is defined as a maximum of absolute values of its eleme...
3,082
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: It turns out that you are a great fan of rock band AC/PE. Peter learned that and started the following game: he plays the first song of the list of *n* songs of the group, and you have to find out the name of the song. After you t...
3,083
Title: Caramel Clouds Time Limit: None seconds Memory Limit: None megabytes Problem Description: It is well-known that the best decoration for a flower bed in Sweetland are vanilla muffins. Seedlings of this plant need sun to grow up. Slastyona has *m* seedlings, and the *j*-th seedling needs at least *k**j* minutes...
3,084
Title: Sonya and Bitwise OR Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sonya has an array $a_1, a_2, \ldots, a_n$ consisting of $n$ integers and also one non-negative integer $x$. She has to perform $m$ queries of two types: - $1$ $i$ $y$: replace $i$-th element by value $y$, i.e. t...
3,085
Title: Book Reading Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recently Luba bought a very interesting book. She knows that it will take *t* seconds to read the book. Luba wants to finish reading as fast as she can. But she has some work to do in each of *n* next days. The number of ...
3,086
Title: Optimizer Time Limit: None seconds Memory Limit: None megabytes Problem Description: A process RAM is a sequence of bytes that are indexed from 1 to *n*. Polycarpus's program contains such instructions as "memset", that is, the operations of filling memory cells on a segment with some value. The details are: ...
3,087
Title: New Year Permutation Time Limit: None seconds Memory Limit: None megabytes Problem Description: User ainta has a permutation *p*1,<=*p*2,<=...,<=*p**n*. As the New Year is coming, he wants to make his permutation as pretty as possible. Permutation *a*1,<=*a*2,<=...,<=*a**n* is prettier than permutation *b*1,...
3,088
Title: Fake NP Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tavak and Seyyed are good friends. Seyyed is very funny and he told Tavak to solve the following problem instead of longest-path. You are given *l* and *r*. For all integers from *l* to *r*, inclusive, we wrote down all of the...
3,089
Title: Labyrinth-3 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
3,090
Title: Ksusha the Squirrel Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ksusha the Squirrel is standing at the beginning of a straight road, divided into *n* sectors. The sectors are numbered 1 to *n*, from left to right. Initially, Ksusha stands in sector 1. Ksusha wants to walk to t...
3,091
Title: T-shirts from Sponsor Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One day a well-known sponsor of a well-known contest decided to give every participant of the contest a T-shirt as a present. A natural problem occurred: on the one hand, it is not clear how many T-shirts of what size...
3,092
Title: New Year and Domino Time Limit: None seconds Memory Limit: None megabytes Problem Description: They say "years are like dominoes, tumbling one after the other". But would a year fit into a grid? I don't think so. Limak is a little polar bear who loves to play. He has recently got a rectangular grid with *h* ...
3,093
Title: Exam Time Limit: None seconds Memory Limit: None megabytes Problem Description: An exam for *n* students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (*i* and *i*<=+<=1) always studied side by side and bec...
3,094
Title: Context Advertising Time Limit: None seconds Memory Limit: None megabytes Problem Description: Advertising has become part of our routine. And now, in the era of progressive technologies, we need your ideas to make advertising better! In this problem we'll look at a simplified version of context advertising....
3,095
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: As we all know Barney's job is "PLEASE" and he has not much to do at work. That's why he started playing "cups and key". In this game there are three identical cups arranged in a line from left to right. Initially key to Barney's ...
3,096
Title: Ring Road 2 Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: It is well known that Berland has *n* cities, which form the Silver ring β€” cities *i* and *i*<=+<=1 (1<=≀<=*i*<=&lt;<=*n*) are connected by a road, as well as the cities *n* and 1. The goverment have decided to build *m* new ro...
3,097
Title: Robot's Task Time Limit: None seconds Memory Limit: None megabytes Problem Description: Robot Doc is located in the hall, with *n* computers stand in a line, numbered from left to right from 1 to *n*. Each computer contains exactly one piece of information, each of which Doc wants to get eventually. The compu...
3,098
Title: Strange Calculation and Cats Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gosha's universe is a table consisting of *n* rows and *m* columns. Both the rows and columns are numbered with consecutive integers starting with 1. We will use (*r*,<=*c*) to denote a cell located in the ...
3,099