task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Title: Hongcow Builds A Nation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries.
The world can be modeled as an undirected graph with *n* nodes and *m* e... | 4,400 |
Title: Labyrinth-9
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 | 4,401 |
Title: Merging Two Decks
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are two decks of cards lying on the table in front of you, some cards in these decks lay face up, some of them lay face down. You want to merge them into one deck in which each card is face down. You're going to... | 4,402 |
Title: Table Tennis
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
*n* people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so o... | 4,403 |
Title: Little Victor and Set
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Victor adores the sets theory. Let us remind you that a set is a group of numbers where all numbers are pairwise distinct. Today Victor wants to find a set of integers *S* that has the following properties:... | 4,404 |
Title: Hyper String
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Paul ErdΕs's prediction came true. Finally an alien force landed on the Earth. In contrary to our expectation they didn't asked the humans to compute the value of a Ramsey number (maybe they had solved it themselves). They... | 4,405 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After all the events in Orlando we all know, Sasha and Roma decided to find out who is still the team's biggest loser. Thankfully, Masha found somewhere a revolver with a rotating cylinder of *n* bullet slots able to contain exact... | 4,406 |
Title: Monsters and Diamonds
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Piegirl has found a monster and a book about monsters and pies. When she is reading the book, she found out that there are *n* types of monsters, each with an ID between 1 and *n*. If you feed a pie to a monster, ... | 4,407 |
Title: Enduring Exodus
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In an attempt to escape the Mischievous Mess Makers' antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. During the journey, he and his *k* cows have decided to stay at the luxuriou... | 4,408 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made *y* submissions, out of which *x* have been successful. Thus, your current success rate on Codeforces is equal to *x... | 4,409 |
Title: Camels
Time Limit: 2 seconds
Memory Limit: 64 megabytes
Problem Description:
Bob likes to draw camels: with a single hump, two humps, three humps, etc. He draws a camel by connecting points on a coordinate plane. Now he's drawing camels with *t* humps, representing them as polylines in the plane. Each polylin... | 4,410 |
Title: Bear and Bowling 4
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Limak is an old brown bear. He often goes bowling with his friends. Today he feels really good and tries to beat his own record!
For rolling a ball one gets a score β an integer (maybe negative) number of points. Sc... | 4,411 |
Title: Polycarpus is Looking for Good Substrings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
We'll call string *s*[*a*,<=*b*]<==<=*s**a**s**a*<=+<=1... *s**b* (1<=β€<=*a*<=β€<=*b*<=β€<=|*s*|) a substring of string *s*<==<=*s*1*s*2... *s*|*s*|, where |*s*| is the length of string *s*.
The... | 4,412 |
Title: Brevity is Soul of Wit
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
As we communicate, we learn much new information. However, the process of communication takes too much time. It becomes clear if we look at the words we use in our everyday speech.
We can list many simple words ... | 4,413 |
Title: Milking cows
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Iahub helps his grandfather at the farm. Today he must milk the cows. There are *n* cows sitting in a row, numbered from 1 to *n* from left to right. Each cow is either facing to the left or facing to the right. When Iahub... | 4,414 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Iahub helps his grandfather at the farm. Today he must milk the cows. There are *n* cows sitting in a row, numbered from 1 to *n* from left to right. Each cow is either facing to the left or facing to the right. When Iahub milks a... | 4,415 |
Title: Dima and Kicks
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dima is a good person. In fact, he's great. But all good things come to an end...
Seryozha is going to kick Dima just few times.. For this reason he divides the room into unit squares. Now the room is a rectangle *n*<=Γ... | 4,416 |
Title: Students and Shoelaces
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Anna and Maria are in charge of the math club for junior students. When the club gathers together, the students behave badly. They've brought lots of shoe laces to the club and got tied with each other. Specifica... | 4,417 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Rainbow built *h* cells in a row that are numbered from 1 to *h* from left to right. There are *n* cells with treasure. We call each of these *n* cells "Treasure Cell". The *i*-th "Treasure Cell" is the *a**i*-th cell and the valu... | 4,418 |
Title: Feed the cat
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After waking up at *hh*:*mm*, Andrew realised that he had forgotten to feed his only cat for yet another time (guess why there's only one cat). The cat's current hunger level is *H* points, moreover each minute without foo... | 4,419 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guaranteed way to determine what the user originally meant by typing some query, we have to use different sorts of... | 4,420 |
Title: New Year Tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are a programmer and you have a New Year Tree (not the traditional fur tree, though) β a tree of four vertices: one vertex of degree three (has number 1), connected with three leaves (their numbers are from 2 to 4).
... | 4,421 |
Title: Nagini
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Nagini, being a horcrux You-know-who created with the murder of Bertha Jorkins, has accumulated its army of snakes and is launching an attack on Hogwarts school.
Hogwarts' entrance can be imagined as a straight line (x-axis) f... | 4,422 |
Title: Boy or Girl
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he though... | 4,423 |
Title: We Need More Bosses
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Your friend is developing a computer game. He has already decided how the game world should look like β it should consist of $n$ locations connected by $m$ two-way passages. The passages are designed in such a way t... | 4,424 |
Title: Berland Army
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are *n* military men in the Berland army. Some of them have given orders to other military men by now. Given *m* pairs (*x**i*, *y**i*), meaning that the military man *x**i* gave the *i*-th order to another military ... | 4,425 |
Title: Travel Card
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A new innovative ticketing systems for public transport is introduced in Bytesburg. Now there is a single travel card for all transport. To make a trip a passenger scan his card and then he is charged according to the fare.... | 4,426 |
Title: z-sort
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A student of *z*-school found a kind of sorting called *z*-sort. The array *a* with *n* elements are *z*-sorted if two conditions hold:
1. *a**i*<=β₯<=*a**i*<=-<=1 for all even *i*, 1. *a**i*<=β€<=*a**i*<=-<=1 for all odd *i*<=... | 4,427 |
Title: Sereja and Brackets
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Sereja has a bracket sequence *s*1,<=*s*2,<=...,<=*s**n*, or, in other words, a string *s* of length *n*, consisting of characters "(" and ")".
Sereja needs to answer *m* queries, each of them is described by two i... | 4,428 |
Title: Destruction of a Tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a tree (a graph with *n* vertices and *n*<=-<=1 edges in which it's possible to reach any vertex from any other vertex using only its edges).
A vertex can be destroyed if this vertex has even degree... | 4,429 |
Title: Watching Fireworks is Fun
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A festival will be held in a town's main street. There are *n* sections in the main street. The sections are numbered 1 through *n* from left to right. The distance between each adjacent sections is 1.
In the... | 4,430 |
Title: Lights Out
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Lenny is playing a game on a 3<=Γ<=3 grid of lights. In the beginning of the game all lights are switched on. Pressing any of the lights will toggle it and all side-adjacent lights. The goal of the game is to switch all the ... | 4,431 |
Title: Photo to Remember
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day *n* friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together.
Simply speaking, the process of taking photos can be described as follows. On the p... | 4,432 |
Title: Mike and Foam
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mike is a bartender at Rico's bar. At Rico's, they put beer glasses in a special shelf. There are *n* kinds of beer at Rico's numbered from 1 to *n*. *i*-th kind of beer has *a**i* milliliters of foam on it.
Maxim is Mik... | 4,433 |
Title: TL
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it.
Valera has written *n* correct solutions. For each correct solution, he knows its running time (in seconds). Val... | 4,434 |
Title: Alice and Bob
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It is so boring in the summer holiday, isn't it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of *n* distinct integers. And then they take turns to make the following ... | 4,435 |
Title: Minimum Sum
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a set of *n* vectors on a plane. For each vector you are allowed to multiply any of its coordinates by -1. Thus, each vector *v**i*<==<=(*x**i*,<=*y**i*) can be transformed into one of the following four vecto... | 4,436 |
Title: Two Melodies
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alice is a beginner composer and now she is ready to create another masterpiece. And not even the single one but two at the same time!
Alice has a sheet with *n* notes written on it. She wants to take two such non-empty ... | 4,437 |
Title: Square Equation Roots
Time Limit: 5 seconds
Memory Limit: 256 megabytes
Problem Description:
A schoolboy Petya studies square equations. The equations that are included in the school curriculum, usually look simple:
Petya noticed that some equations have two real roots, some of them have only one root and s... | 4,438 |
Title: Summer Homework
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
By the age of three Smart Beaver mastered all arithmetic operations and got this summer homework from the amazed teacher:
You are given a sequence of integers *a*1,<=*a*2,<=...,<=*a**n*. Your task is to perform on it *... | 4,439 |
Title: Bars
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarp's workday lasts exactly $n$ minutes. He loves chocolate bars and can eat one bar in one minute. Today Polycarp has $k$ bars at the beginning of the workday.
In some minutes of the workday Polycarp has important things to... | 4,440 |
Title: Mahmoud and Ehab and the MEX
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems to let them go.
Dr. Evil is interested in ... | 4,441 |
Title: Bear and Floodlight
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day a bear lived on the *Oxy* axis. He was afraid of the dark, so he couldn't move at night along the plane points that aren't lit. One day the bear wanted to have a night walk from his house at point (*l*,<=0) ... | 4,442 |
Title: Long Path
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day, little Vasya found himself in a maze consisting of (*n*<=+<=1) rooms, numbered from 1 to (*n*<=+<=1). Initially, Vasya is at the first room and to get out of the maze, he needs to get to the (*n*<=+<=1)-th one.
The ... | 4,443 |
Title: Seating of Students
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Students went into a class to write a test and sat in some way. The teacher thought: "Probably they sat in this order to copy works of each other. I need to rearrange them in such a way that students that were neigh... | 4,444 |
Title: Beauty Pageant
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
General Payne has a battalion of *n* soldiers. The soldiers' beauty contest is coming up, it will last for *k* days. Payne decided that his battalion will participate in the pageant. Now he has choose the participants.
... | 4,445 |
Title: Problem About Equation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A group of *n* merry programmers celebrate Robert Floyd's birthday. Polucarpus has got an honourable task of pouring Ber-Cola to everybody. Pouring the same amount of Ber-Cola to everybody is really important. In... | 4,446 |
Title: Design Tutorial: Make It Nondeterministic
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A way to make a new task is to make it nondeterministic or probabilistic. For example, the hard task of Topcoder SRM 595, Constellation, is the probabilistic version of a convex hull.
Let's tr... | 4,447 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Once Vasya and Petya assembled a figure of *m* cubes, each of them is associated with a number between 0 and *m*<=-<=1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the *OX* is the gr... | 4,448 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
On the math lesson a teacher asked each pupil to come up with his own lucky numbers. As a fan of number theory Peter chose prime numbers. Bob was more original. He said that number *t* is his lucky number, if it can be represented... | 4,449 |
Title: Domino
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
We all know the problem about the number of ways one can tile a 2<=Γ<=*n* field by 1<=Γ<=2 dominoes. You probably remember that it goes down to Fibonacci numbers. We will talk about some other problem below, there you also are going... | 4,450 |
Title: Tourists
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are *n* cities in Cyberland, numbered from 1 to *n*, connected by *m* bidirectional roads. The *j*-th road connects city *a**j* and *b**j*.
For tourists, souvenirs are sold in every city of Cyberland. In particular, cit... | 4,451 |
Title: Nastya Studies Informatics
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Today on Informatics class Nastya learned about GCD and LCM (see links below). Nastya is very intelligent, so she solved all the tasks momentarily and now suggests you to solve one of them as well.
We define... | 4,452 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mad scientist Mike has just finished constructing a new device to search for extraterrestrial intelligence! He was in such a hurry to launch it for the first time that he plugged in the power wires without giving it a proper glanc... | 4,453 |
Title: Unlucky Ticket
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Each of you probably has your personal experience of riding public transportation and buying tickets. After a person buys a ticket (which traditionally has an even number of digits), he usually checks whether the ticket ... | 4,454 |
Title: Volleyball
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city has *n* junctions, some of which are connected by two-way road... | 4,455 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are *n* animals in the queue to Dr. Dolittle. When an animal comes into the office, the doctor examines him, gives prescriptions, appoints tests and may appoint extra examination. Doc knows all the forest animals perfectly w... | 4,456 |
Title: Hidden Word
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Letβs define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on them.... | 4,457 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
For a vector $\vec{v} = (x, y)$, define $|v| = \sqrt{x^2 + y^2}$.
Allen had a bit too much to drink at the bar, which is at the origin. There are $n$ vectors $\vec{v_1}, \vec{v_2}, \cdots, \vec{v_n}$. Allen will make $n$ moves. A... | 4,458 |
Title: Kefa and Company
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Kefa wants to celebrate his first big salary by going to restaurant. However, he needs company.
Kefa has *n* friends, each friend will agree to go to the restaurant if Kefa asks. Each friend is characterized by the a... | 4,459 |
Title: Selling Numbers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Boris really likes numbers and even owns a small shop selling interesting numbers. He has *n* decimal numbers *B**i*. Cost of the number in his shop is equal to the sum of costs of its digits. You are given the values *... | 4,460 |
Title: Weird Rounding
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarp is crazy about round numbers. He especially likes the numbers divisible by 10*k*.
In the given number of *n* Polycarp wants to remove the least number of digits to get a number that is divisible by 10*k*. For e... | 4,461 |
Title: Magnum Opus
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Salve, mi amice.
Et tu quidem de lapis philosophorum. Barba non facit philosophum. Labor omnia vincit. Non potest creatio ex nihilo. Necesse est partibus.
Rp:
Β Β Β Β I Aqua Fortis
Β Β Β Β I Aqua Regia
Β Β Β Β II Amalgama
Β Β Β Β VII... | 4,462 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A couple of friends, Axel and Marston are travelling across the country of Bitland. There are *n* towns in Bitland, with some pairs of towns connected by one-directional roads. Each road in Bitland is either a pedestrian road or a... | 4,463 |
Title: Karen and Test
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Karen has just arrived at school, and she has a math test today!
The test is about basic addition and subtraction. Unfortunately, the teachers were too busy writing tasks for Codeforces rounds, and had no time to make a... | 4,464 |
Title: Running with Obstacles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A sportsman starts from point *x**start*<==<=0 and runs to point with coordinate *x**finish*<==<=*m* (on a straight line). Also, the sportsman can jump β to jump, he should first take a run of length of not less ... | 4,465 |
Title: Swap Adjacent Elements
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have an array *a* consisting of *n* integers. Each integer from 1 to *n* appears exactly once in this array.
For some indices *i* (1<=β€<=*i*<=β€<=*n*<=-<=1) it is possible to swap *i*-th element with (*i*<=+<... | 4,466 |
Title: Splitting in Teams
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There were *n* groups of students which came to write a training contest. A group is either one person who can write the contest with anyone else, or two people who want to write the contest in the same team.
The co... | 4,467 |
Title: Alien DNA
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Professor Bajtocy is conducting experiments on alien DNA. He has discovered that it is subject to repetitive mutations β each mutation happens in the same way: some continuous subsequence of the alien DNA becomes active, copi... | 4,468 |
Title: Labyrinth-1
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have a robot in a two-dimensional labyrinth which consists of *N*<=Γ<=*M* cells. Some pairs of cells adjacent by side are separated by a wall or a door. The labyrinth itself is separated from the outside with walls arou... | 4,469 |
Title: Mystical Mosaic
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is a rectangular grid of *n* rows of *m* initially-white cells each.
Arkady performed a certain number (possibly zero) of operations on it. In the *i*-th operation, a non-empty subset of rows *R**i* and a non-emp... | 4,470 |
Title: Positions in Permutations
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Permutation *p* is an ordered set of integers *p*1,<=<=*p*2,<=<=...,<=<=*p**n*, consisting of *n* distinct positive integers, each of them doesn't exceed *n*. We'll denote the *i*-th element of permutation *p*... | 4,471 |
Title: Spider's Web
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Paw the Spider is making a web. Web-making is a real art, Paw has been learning to do it his whole life. Let's consider the structure of the web.
There are *n* main threads going from the center of the web. All main threa... | 4,472 |
Title: Dynasty Puzzles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to ab... | 4,473 |
Title: Duff in Beach
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
While Duff was resting in the beach, she accidentally found a strange array *b*0,<=*b*1,<=...,<=*b**l*<=-<=1 consisting of *l* positive integers. This array was strange because it was extremely long, but there was another... | 4,474 |
Title: Stairs and Elevators
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In the year of $30XX$ participants of some world programming championship live in a single large hotel. The hotel has $n$ floors. Each floor has $m$ sections with a single corridor connecting all of them. The secti... | 4,475 |
Title: Sandy and Nuts
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Rooted tree is a connected graph without any simple cycles with one vertex selected as a root. In this problem the vertex number 1 will always serve as a root.
Lowest common ancestor of two vertices *u* and *v* is the f... | 4,476 |
Title: A Heap of Heaps
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Andrew skipped lessons on the subject 'Algorithms and Data Structures' for the entire term. When he came to the final test, the teacher decided to give him a difficult task as a punishment.
The teacher gave Andrew an a... | 4,477 |
Title: Poster
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the... | 4,478 |
Title: Zebras
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Oleg writes down the history of the days he lived. For each day he decides if it was good or bad. Oleg calls a non-empty sequence of days a zebra, if it starts with a bad day, ends with a bad day, and good and bad days are alter... | 4,479 |
Title: Checking the Calendar
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given names of two days of the week.
Please, determine whether it is possible that during some non-leap year the first day of some month was equal to the first day of the week you are given, while the fir... | 4,480 |
Title: Santa Claus and Keyboard Check
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each ke... | 4,481 |
Title: Dreamoon and Notepad
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dreamoon has just created a document of hard problems using notepad.exe. The document consists of *n* lines of text, *a**i* denotes the length of the *i*-th line. He now wants to know what is the fastest way to mov... | 4,482 |
Title: Forgotten Episode
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus adores TV series. Right now he is ready to finish watching a season of a popular sitcom "Graph Theory". In total, the season has *n* episodes, numbered with integers from 1 to *n*.
Polycarpus watches episo... | 4,483 |
Title: Quantity of Strings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Just in case somebody missed it: this winter is totally cold in Nvodsk! It is so cold that one gets funny thoughts. For example, let's say there are strings with the length exactly *n*, based on the alphabet of size... | 4,484 |
Title: Chat Online
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little X and Little Z are good friends. They always chat online. But both of them have schedules.
Little Z has fixed schedule. He always online at any moment of time between *a*1 and *b*1, between *a*2 and *b*2, ..., betwe... | 4,485 |
Title: Cloud of Hashtags
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya is an administrator of a public page of organization "Mouse and keyboard" and his everyday duty is to publish news from the world of competitive programming. For each news he also creates a list of hashtags to m... | 4,486 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Latin letters.
Peterson makes new language every morning. It is difficult task to s... | 4,487 |
Title: Armistice Area Apportionment
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After a drawn-out mooclear arms race, Farmer John and the Mischievous Mess Makers have finally agreed to establish peace. They plan to divide the territory of Bovinia with a line passing through at least tw... | 4,488 |
Title: Special Olympics
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A renowned abstract artist Sasha, drawing inspiration from nowhere, decided to paint a picture entitled "Special Olympics". He justly thought that, if the regular Olympic games have five rings, then the Special ones wi... | 4,489 |
Title: Two Paths
Time Limit: 2 seconds
Memory Limit: 64 megabytes
Problem Description:
As you know, Bob's brother lives in Flatland. In Flatland there are *n* cities, connected by *n*<=-<=1 two-way roads. The cities are numbered from 1 to *n*. You can get from one city to another moving along the roads.
The Β«Two Pa... | 4,490 |
Title: Tree Destruction
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an unweighted tree with *n* vertices. Then *n*<=-<=1 following operations are applied to the tree. A single operation consists of the following steps:
1. choose two leaves; 1. add the length of the si... | 4,491 |
Title: C*++ Calculations
Time Limit: 2 seconds
Memory Limit: 64 megabytes
Problem Description:
C*++ language is quite similar to C++. The similarity manifests itself in the fact that the programs written in C*++ sometimes behave unpredictably and lead to absolutely unexpected effects. For example, let's imagine an a... | 4,492 |
Title: The Untended Antiquity
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Adieu l'ami.
Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.
The space is represented by a rectangu... | 4,493 |
Title: Tennis Championship
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Famous Brazil city Rio de Janeiro holds a tennis tournament and Ostap Bender doesn't want to miss this event. There will be *n* players participating, and the tournament will follow knockout rules from the very firs... | 4,494 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.
Let's assume that strings *s* and *t* h... | 4,495 |
Title: Segments Removal
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya has an array of integers of length *n*.
Vasya performs the following operations on the array: on each step he finds the longest segment of consecutive equal integers (the leftmost, if there are several such segm... | 4,496 |
Title: Permutation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a permutation of numbers from 1 to *n*. Determine whether there's a pair of integers *a*,<=*b* (1<=β€<=*a*,<=*b*<=β€<=*n*;Β *a*<=β <=*b*) such that the element (note, that it is usual division, not integer one) i... | 4,497 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Olya wants to buy a custom wardrobe. It should have *n* boxes with heights *a*1,<=*a*2,<=...,<=*a**n*, stacked one on another in some order. In other words, we can represent each box as a vertical segment of length *a**i*, and all... | 4,498 |
Title: Misha and XOR
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After Misha's birthday he had many large numbers left, scattered across the room. Now it's time to clean up and Misha needs to put them in a basket. He ordered this task to his pet robot that agreed to complete the task a... | 4,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.