task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Title: Hanoi Factory
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Of course you have heard the famous task about Hanoi Towers, but did you know that there is a special factory producing the rings for this wonderful game? Once upon a time, the ruler of the ancient Egypt ordered the worke... | 5,000 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've gotten an *n*<=×<=*m* sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as *A*. Set *A* is connected. Your task is to find the minimum number of squares that we can delete fr... | 5,001 |
Title: Little Artem and Dance
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.
More detailed, there are *n* pairs of boys and... | 5,002 |
Title: Lightsabers (easy)
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is unrest in the Galactic Senate. Several thousand solar systems have declared their intentions to leave the Republic. Master Heidi needs to select the Jedi Knights who will go on peacekeeping missions througho... | 5,003 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two adjacent beads, if the chain ... | 5,004 |
Title: Equivalent Strings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Today on a lecture about strings Gerald learned a new definition of string equivalency. Two strings *a* and *b* of equal length are called equivalent in one of the two cases:
1. They are equal. 1. If we split str... | 5,005 |
Title: Ember and Storm's Tree Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Ember and Storm play a game. First, Ember picks a labelled tree *T* of *n* vertices, such that the degree of every vertex is at most *d*. Then, Storm picks two distinct vertices *u* and *v* in this tree and ... | 5,006 |
Title: New Password
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Innokentiy decides to change the password in the social net "Contact!", but he is too lazy to invent a new password by himself. That is why he needs your help.
Innokentiy decides that new password should satisfy the foll... | 5,007 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).
There are *n* members, numbered 1 through *n*. *m* pairs of member... | 5,008 |
Title: Arpa’s hard exam and Mehrdad’s naive cheat
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There exists an island called Arpa’s land, some beautiful girls live there, as ugly ones do.
Mehrdad wants to become minister of Arpa’s land. Arpa has prepared an exam. Exam has only one ques... | 5,009 |
Title: Kyoya and Photobooks
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Kyoya Ootori is selling photobooks of the Ouran High School Host Club. He has 26 photos, labeled "a" to "z", and he has compiled them into a photo booklet with some photos in some order (possibly with some photos b... | 5,010 |
Title: Codehorses T-shirts
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Codehorses has just hosted the second Codehorses Cup. This year, the same as the previous one, organizers are giving T-shirts for the winners.
The valid sizes of T-shirts are either "M" or from $0$ to $3$ "X" follo... | 5,011 |
Title: New Year and Snowy Grid
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Pay attention to the output section below, where you will see the information about flushing the output.
Bearland is a grid with *h* rows and *w* columns. Rows are numbered 1 through *h* from top to bottom. Col... | 5,012 |
Title: Quadcopter Competition
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarp takes part in a quadcopter competition. According to the rules a flying robot should:
- start the race from some point of a field, - go around the flag, - close cycle returning back to the starting p... | 5,013 |
Title: T-decomposition
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got a undirected tree *s*, consisting of *n* nodes. Your task is to build an optimal T-decomposition for it. Let's define a T-decomposition as follows.
Let's denote the set of all nodes *s* as *v*. Let's conside... | 5,014 |
Title: Hamming Triples
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Chris is having a nightmare. Even in dreams all he thinks about is math.
Chris dreams about *m* binary strings of length *n*, indexed with numbers from 1 to *m*. The most horrifying part is that the bits of each... | 5,015 |
Title: Cannon
Time Limit: 3 seconds
Memory Limit: 256 megabytes
Problem Description:
Bertown is under siege! The attackers have blocked all the ways out and their cannon is bombarding the city. Fortunately, Berland intelligence managed to intercept the enemies' shooting plan. Let's introduce the Cartesian system of ... | 5,016 |
Title: Binary Cards
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It is never too late to play the fancy "Binary Cards" game!
There is an infinite amount of cards of positive and negative ranks that are used in the game. The absolute value of any card rank is a power of two, i.e. each c... | 5,017 |
Title: Harry Potter and the Golden Snitch
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Brothers Fred and George Weasley once got into the sporting goods store and opened a box of Quidditch balls. After long and painful experiments they found out that the Golden Snitch is not enchanted at al... | 5,018 |
Title: Tritonic Iridescence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Overlooking the captivating blend of myriads of vernal hues, Arkady the painter lays out a long, long canvas.
Arkady has a sufficiently large amount of paint of three colours: cyan, magenta, and yellow. On the one... | 5,019 |
Title: Large Refrigerator
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya wants to buy a new refrigerator. He believes that a refrigerator should be a rectangular parallelepiped with integer edge lengths. Vasya calculated that for daily use he will need a refrigerator with volume of ... | 5,020 |
Title: Plane of Tanks
Time Limit: 4 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasya plays the Plane of Tanks. The tanks in this game keep trying to finish each other off. But your "Pedalny" is not like that... He just needs to drive in a straight line from point *A* to point B on the plane. Unfortunat... | 5,021 |
Title: Cards Sorting
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasily has a deck of cards consisting of *n* cards. There is an integer on each of the cards, this integer is between 1 and 100<=000, inclusive. It is possible that some cards have the same integers on them.
Vasily decid... | 5,022 |
Title: Little Elephant and Rozdil
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil").
However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elepha... | 5,023 |
Title: Lucky Permutation
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... | 5,024 |
Title: Greg and Caves
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Greg has a pad. The pad's screen is an *n*<=×<=*m* rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to *n* from top to bottom. Similarly, the pad's column... | 5,025 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Happy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.
One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through *n* and is asked to ... | 5,026 |
Title: Measuring Lengths in Baden
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.
You are given a length equa... | 5,027 |
Title: Developing Skills
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya loves computer games. Finally a game that he's been waiting for so long came out!
The main character of this game has *n* different skills, each of which is characterized by an integer *a**i* from 0 to 100. The... | 5,028 |
Title: Arthur and Brackets
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Notice that the memory limit is non-standard.
Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he eve... | 5,029 |
Title: I Wanna Be the Guy
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is a game called "I Wanna Be the Guy", consisting of *n* levels. Little X and his friend Little Y are addicted to the game. Each of them wants to pass the whole game.
Little X can pass only *p* levels of the g... | 5,030 |
Title: Saitama Destroys Hotel
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Saitama accidentally destroyed a hotel again. To repay the hotel company, Genos has volunteered to operate an elevator in one of its other hotels. The elevator is special — it starts on the top floor, can only mo... | 5,031 |
Title: Trip For Meal
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Winnie-the-Pooh likes honey very much! That is why he decided to visit his friends. Winnie has got three best friends: Rabbit, Owl and Eeyore, each of them lives in his own house. There are winding paths between each pair... | 5,032 |
Title: Stars
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Furik loves painting stars. A star is a shape that results if we take a regular pentagon and paint all diagonals in it.
Recently he decided to teach Rubik to paint stars. After many years of training Rubik could paint stars eas... | 5,033 |
Title: Distributing Parts
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are an assistant director in a new musical play. The play consists of *n* musical parts, each part must be performed by exactly one actor. After the casting the director chose *m* actors who can take part in the... | 5,034 |
Title: Rowena Ravenclaw's Diadem
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Harry, upon inquiring Helena Ravenclaw's ghost, came to know that she told Tom Riddle or You-know-who about Rowena Ravenclaw's diadem and that he stole it from her.
Harry thought that Riddle would have assum... | 5,035 |
Title: Petya's Exams
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya studies at university. The current academic year finishes with $n$ special days. Petya needs to pass $m$ exams in those special days. The special days in this problem are numbered from $1$ to $n$.
There are three v... | 5,036 |
Title: Permutations
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Happy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.
One of the seniors gave Happy PMP a nice game. He is given two permutations of numbers 1 through *n* and is a... | 5,037 |
Title: Primal Sport
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alice and Bob begin their day with a quick game. They first choose a starting number *X*0<=≥<=3 and try to reach one million by the process described below.
Alice goes first and then they take alternating turns. In the *... | 5,038 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bike is interested in permutations. A permutation of length *n* is an integer sequence such that each integer from 0 to (*n*<=-<=1) appears exactly once in it. For example, [0,<=2,<=1] is a permutation of length 3 while both [0,<=... | 5,039 |
Title: Restaurant
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A restaurant received *n* orders for the rental. Each rental order reserve the restaurant for a continuous period of time, the *i*-th order is characterized by two time values — the start time *l**i* and the finish time *r**... | 5,040 |
Title: Transforming Sequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's define the transformation *P* of a sequence of integers *a*1,<=*a*2,<=...,<=*a**n* as *b*1,<=*b*2,<=...,<=*b**n*, where *b**i*<==<=*a*1 | *a*2 | ... | *a**i* for all *i*<==<=1,<=2,<=...,<=*n*, where | is the... | 5,041 |
Title: Two Bags of Potatoes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Valera had two bags of potatoes, the first of these bags contains *x* (*x*<=≥<=1) potatoes, and the second — *y* (*y*<=≥<=1) potatoes. Valera — very scattered boy, so the first bag of potatoes (it contains *x* pota... | 5,042 |
Title: Permutations
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
A permutation is a sequence of integers from 1 to *n* of length *n* containing each number exactly once. For example, (1), (4,<=3,<=5,<=1,<=2), (3,<=2,<=1) are permutations, and (1,<=1), (4,<=3,<=1), (2,<=3,<=4) are not.
The... | 5,043 |
Title: Selling Souvenirs
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After several latest reforms many tourists are planning to visit Berland, and Berland people understood that it's an opportunity to earn money and changed their jobs to attract tourists. Petya, for example, left the I... | 5,044 |
Title: Colorful Points
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a set of points on a straight line. Each point has a color assigned to it. For point *a*, its neighbors are the points which don't have any other points between them and *a*. Each point has at most two nei... | 5,045 |
Title: Shaass and Painter Robot
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Shaass thinks a kitchen with all white floor tiles is so boring. His kitchen floor is made of *n*·*m* square tiles forming a *n*<=×<=*m* rectangle. Therefore he's decided to color some of the tiles in black so ... | 5,046 |
Title: Misha and Changing Handles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Misha hacked the Codeforces site. Then he decided to let all the users change their handles. A user can now change his handle any number of times. But each new handle must not be equal to any handle that is a... | 5,047 |
Title: Painting Edges
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Note the unusual memory limit for this problem.
You are given an undirected graph consisting of *n* vertices and *m* edges. The vertices are numbered with integers from 1 to *n*, the edges are numbered with integers fro... | 5,048 |
Title: Vika and Squares
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vika has *n* jars with paints of distinct colors. All the jars are numbered from 1 to *n* and the *i*-th jar contains *a**i* liters of paint of color *i*.
Vika also has an infinitely long rectangular piece of paper of... | 5,049 |
Title: Prison Transfer
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The prison of your city has *n* prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer *c* of the prisoners to a prison located in another city.
For this reason, he made the *n* ... | 5,050 |
Title: Second price auction
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Nowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the web page is opened... | 5,051 |
Title: Alena's Schedule
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alena has successfully passed the entrance exams to the university and is now looking forward to start studying.
One two-hour lesson at the Russian university is traditionally called a pair, it lasts for two academic ... | 5,052 |
Title: Naughty Stone Piles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are *n* piles of stones of sizes *a*1,<=*a*2,<=...,<=*a**n* lying on the table in front of you.
During one move you can take one pile and add it to the other. As you add pile *i* to pile *j*, the size of pile... | 5,053 |
Title: Beaver
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to ... | 5,054 |
Title: Harry Potter and Moving Staircases
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Harry Potter lost his Invisibility Cloak, running from the school caretaker Filch. Finding an invisible object is not an easy task. Fortunately, Harry has friends who are willing to help. Hermione Granger... | 5,055 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are playing a video game and you have just reached the bonus level, where the only possible goal is to score as many points as possible. Being a perfectionist, you've decided that you won't leave this level until you've gained... | 5,056 |
Title: Divisibility
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Find the number of *k*-divisible numbers on the segment [*a*,<=*b*]. In other words you need to find the number of such integer values *x* that *a*<=≤<=*x*<=≤<=*b* and *x* is divisible by *k*.
Input Specification:
The onl... | 5,057 |
Title: Queue on Bus Stop
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It's that time of the year when the Russians flood their countryside summer cottages (dachas) and the bus stop has a lot of people. People rarely go to the dacha on their own, it's usually a group, so the people stand... | 5,058 |
Title: Partitions
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a set of *n* elements indexed from 1 to *n*. The weight of *i*-th element is *w**i*. The weight of some subset of a given set is denoted as . The weight of some partition *R* of a given set into *k* subsets is ... | 5,059 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh.
In this game Mashmokh writes sequence of *n* distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first mov... | 5,060 |
Title: Levko and Table
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Levko loves tables that consist of *n* rows and *n* columns very much. He especially loves beautiful tables. A table is beautiful to Levko if the sum of elements in each row and column of the table equals *k*.
Unfortun... | 5,061 |
Title: Bus Video System
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.
If $x$ is the number of passengers in a bus just befo... | 5,062 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus has a finite sequence of opening and closing brackets. In order not to fall asleep in a lecture, Polycarpus is having fun with his sequence. He is able to perform two operations:
- adding any bracket in any position (... | 5,063 |
Title: Dice Tower
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A dice is a cube, its faces contain distinct integers from 1 to 6 as black points. The sum of numbers at the opposite dice faces always equals 7. Please note that there are only two dice (these dices are mirror of each other... | 5,064 |
Title: The Child and Homework
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Once upon a time a child got a test consisting of multiple-choice questions as homework. A multiple-choice question consists of four choices: A, B, C and D. Each choice has a description, and the child should fin... | 5,065 |
Title: Xenia and Spies
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Xenia the vigorous detective faced *n* (*n*<=≥<=2) foreign spies lined up in a row. We'll consider the spies numbered from 1 to *n* from left to right.
Spy *s* has an important note. He has to pass the note to spy *f*... | 5,066 |
Title: Polycarpus and Tasks
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus has many tasks. Each task is characterized by three integers *l**i*, *r**i* and *t**i*. Three integers (*l**i*,<=*r**i*,<=*t**i*) mean that to perform task *i*, one needs to choose an integer *s**i* (*l*... | 5,067 |
Title: String Problem
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Boy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting of lower case Latin letters, and tries to mak... | 5,068 |
Title: Rebus
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a rebus of form ? + ? - ? + ? = n, consisting of only question marks, separated by arithmetic operation '+' and '-', equality and positive integer *n*. The goal is to replace each question mark with some positive in... | 5,069 |
Title: Alyona and Numbers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After finishing eating her bun, Alyona came up with two integers *n* and *m*. She decided to write down two columns of integers — the first column containing integers from 1 to *n* and the second containing integers ... | 5,070 |
Title: LionAge II
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasya plays the LionAge II. He was bored of playing with a stupid computer, so he installed this popular MMORPG, to fight with his friends. Vasya came up with the name of his character — non-empty string *s*, consisting of a low... | 5,071 |
Title: Ancient Berland Hieroglyphs
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus enjoys studying Berland hieroglyphs. Once Polycarp got hold of two ancient Berland pictures, on each of which was drawn a circle of hieroglyphs. We know that no hieroglyph occurs twice in either t... | 5,072 |
Title: Help Caretaker
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Autumn came late to the kingdom of Far Far Away. The harvest was exuberant and it is now time to get ready for the winter. As most people celebrate the Harvest festival, Simon the Caretaker tries to solve a very non-triv... | 5,073 |
Title: Squares
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an infinite checkered field. You should get from a square (*x*1; *y*1) to a square (*x*2; *y*2). Using the shortest path is not necessary. You can move on the field squares in four directions. That is, when you ar... | 5,074 |
Title: Little Elephant and Furik and Rubik
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Elephant loves Furik and Rubik, who he met in a small city Kremenchug.
The Little Elephant has two strings of equal length *a* and *b*, consisting only of uppercase English letters. The Littl... | 5,075 |
Title: Dating
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This story is happening in a town named BubbleLand. There are *n* houses in BubbleLand. In each of these *n* houses lives a boy or a girl. People there really love numbers and everyone has their favorite number *f*. That means t... | 5,076 |
Title: Lemmings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
As you know, lemmings like jumping. For the next spectacular group jump *n* lemmings gathered near a high rock with *k* comfortable ledges on it. The first ledge is situated at the height of *h* meters, the second one is at th... | 5,077 |
Title: Hex Dyslexia
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Copying large hexadecimal (base 16) strings by hand can be error prone, but that doesn't stop people from doing it. You've discovered a bug in the code that was likely caused by someone making a mistake when copying such a... | 5,078 |
Title: Subsequences
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
For the given sequence with *n* different elements find the number of increasing subsequences with *k*<=+<=1 elements. It is guaranteed that the answer is not greater than 8·1018.
Input Specification:
First line contain t... | 5,079 |
Title: Looksery Party
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Looksery company, consisting of *n* staff members, is planning another big party. Every employee has his phone number and the phone numbers of his friends in the phone book. Everyone who comes to the party, sends mes... | 5,080 |
Title: Cards with Numbers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya has got 2*n* cards, each card contains some integer. The numbers on the cards can be the same. Let's index all cards by consecutive integers from 1 to 2*n*. We'll denote the number that is written on a card wit... | 5,081 |
Title: Consecutive Subsequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an integer array of length $n$.
You have to choose some subsequence of this array of maximum length such that this subsequence forms a increasing sequence of consecutive integers. In other words t... | 5,082 |
Title: Digital Counter
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Malek lives in an apartment block with 100 floors numbered from 0 to 99. The apartment has an elevator with a digital counter showing the floor that the elevator is currently on. The elevator shows each digit of a numbe... | 5,083 |
Title: Smile House
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A smile house is created to raise the mood. It has *n* rooms. Some of the rooms are connected by doors. For each two rooms (number *i* and *j*), which are connected by a door, Petya knows their value *c**ij* — the value whi... | 5,084 |
Title: Duff in Mafia
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Duff is one if the heads of Mafia in her country, Andarz Gu. Andarz Gu has *n* cities (numbered from 1 to *n*) connected by *m* bidirectional roads (numbered by 1 to *m*).
Each road has a destructing time, and a color. *... | 5,085 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Artem found a grasshopper. He brought it to his house and constructed a jumping area for him.
The area looks like a strip of cells 1<=×<=*n*. Each cell contains the direction for the next jump and the length of that jump. ... | 5,086 |
Title: Statues
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8<=×<=8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them,... | 5,087 |
Title: Dominoes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have a set of dominoes. Each domino is a rectangular tile with a line dividing its face into two square ends. Can you put all dominoes in a line one by one from left to right so that any two dominoes touched with the sides... | 5,088 |
Title: Competition
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The secondary diagonal of a square matrix is a diagonal going from the top right to the bottom left corner. Let's define an *n*-degree staircase as a square matrix *n*<=×<=*n* containing no squares above the secondary diago... | 5,089 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Recently a tournament in *k* kinds of sports has begun in Berland. Vasya wants to make money on the bets.
The scheme of the tournament is very mysterious and not fully disclosed. Competitions are held back to back, each of them i... | 5,090 |
Title: Tachibana Kanade's Tofu
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Tachibana Kanade likes Mapo Tofu very much. One day, the canteen cooked all kinds of tofu to sell, but not all tofu is Mapo Tofu, only those spicy enough can be called Mapo Tofu.
Each piece of tofu in the cante... | 5,091 |
Title: Ice cream coloring
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Isart and Modsart were trying to solve an interesting problem when suddenly Kasra arrived. Breathless, he asked: "Can you solve a problem I'm stuck at all day?"
We have a tree *T* with *n* vertices and *m* types of ... | 5,092 |
Title: Sequence Recovery
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Zane once had a good sequence *a* consisting of *n* integers *a*1,<=*a*2,<=...,<=*a**n* — but he has lost it.
A sequence is said to be good if and only if all of its integers are non-negative and do not exceed 109 in... | 5,093 |
Title: Guilty --- to the kitchen!
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his a... | 5,094 |
Title: String Transformation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a string *s* consisting of |*s*| small english letters.
In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be rep... | 5,095 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Ryouko is an extremely forgetful girl, she could even forget something that has just happened. So in order to remember, she takes a notebook with her, called Ryouko's Memory Note. She writes what she sees and what she hears on the... | 5,096 |
Title: Something with XOR Queries
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This is an interactive problem.
Jury has hidden a permutation *p* of integers from 0 to *n*<=-<=1. You know only the length *n*. Remind that in permutation all integers are distinct.
Let *b* be the inverse ... | 5,097 |
Title: Curious Array
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got an array consisting of *n* integers: *a*[1],<=*a*[2],<=...,<=*a*[*n*]. Moreover, there are *m* queries, each query can be described by three integers *l**i*,<=*r**i*,<=*k**i*. Query *l**i*,<=*r**i*,<=*k**i* mea... | 5,098 |
Title: A Preponderant Reunion
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
East or west, home is best. That's why family reunion, the indispensable necessity of Lunar New Year celebration, is put in such a position.
After the reunion dinner, Little Tommy plays a game with the family. H... | 5,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.