task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Title: Berland Local Positioning System
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In Berland a bus travels along the main street of the capital. The street begins from the main square and looks like a very long segment. There are *n* bus stops located along the street, the *i*-th of ... | 2,700 |
Title: A Tide of Riverscape
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
"Time," Mino thinks aloud.
"What?"
"Time and tide wait for no man," explains Mino. "My name, taken from the river, always reminds me of this."
"And what are you recording?"
"You see it, tide. Everything has its... | 2,701 |
Title: President and Roads
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Berland has *n* cities, the capital is located in city *s*, and the historic home town of the President is in city *t* (*s*<=β <=*t*). The cities are connected by one-way roads, the travel time for each of the road i... | 2,702 |
Title: Mirror Box
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a box full of mirrors. Box consists of grid of size *n*<=Γ<=*m*. Each cell of the grid contains a mirror put in the shape of '\' or '<=/<=' (45 degree to the horizontal or vertical line). But mirrors in some ce... | 2,703 |
Title: Limit
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given two polynomials:
- *P*(*x*)<==<=*a*0Β·*x**n*<=+<=*a*1Β·*x**n*<=-<=1<=+<=...<=+<=*a**n*<=-<=1Β·*x*<=+<=*a**n* and - *Q*(*x*)<==<=*b*0Β·*x**m*<=+<=*b*1Β·*x**m*<=-<=1<=+<=...<=+<=*b**m*<=-<=1Β·*x*<=+<=*b**m*.
Calculate l... | 2,704 |
Title: Rectangles and Square
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* rectangles, labeled 1 through *n*. The corners of rectangles have integer coordinates and their edges are parallel to the *Ox* and *Oy* axes. The rectangles may touch each other, but they do not ... | 2,705 |
Title: Slava and tanks
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Slava plays his favorite game "Peace Lightning". Now he is flying a bomber on a very specific map.
Formally, map is a checkered field of size 1<=Γ<=*n*, the cells of which are numbered from 1 to *n*, in each cell there... | 2,706 |
Title: Pills
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Doctor prescribed medicine to his patient. The medicine is represented by pills. Each pill consists of a shell and healing powder. The shell consists of two halves; each half has one of four colors β blue, red, white or yellow.
... | 2,707 |
Title: Island Puzzle
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A remote island chain contains *n* islands, with some bidirectional bridges between them. The current bridge network forms a tree. In other words, a total of *n*<=-<=1 bridges connect pairs of islands in a way that it's p... | 2,708 |
Title: Memory and De-Evolution
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length *x*, and he wishes to perform operations to obtain an equilateral triangle o... | 2,709 |
Title: LCS Again
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a string *S* of length *n* with each character being one of the first *m* lowercase English letters.
Calculate how many different strings *T* of length *n* composed from the first *m* lowercase English letters... | 2,710 |
Title: Triminoes
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
There are many interesting tasks on domino tilings. For example, an interesting fact is known. Let us take a standard chessboard (8<=Γ<=8) and cut exactly two squares out of it. It turns out that the resulting board can always be... | 2,711 |
Title: Robbers' watch
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of catching them even harder, they use their own watches.
First, as they know that kingdom police is bad a... | 2,712 |
Title: New Year and Binary Tree Paths
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The New Year tree is an infinite perfect binary tree rooted in the node 1. Each node *v* has two children: nodes indexed (2Β·*v*) and (2Β·*v*<=+<=1).
Polar bears love decorating the New Year tree and Limak... | 2,713 |
Title: Doodle Jump
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In Doodle Jump the aim is to guide a four-legged creature called "The Doodler" up a never-ending series of platforms without falling. β Wikipedia.
It is a very popular game and xiaodao likes it very much. One day when pla... | 2,714 |
Title: Bertown roads
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bertown has *n* junctions and *m* bidirectional roads. We know that one can get from any junction to any other one by the existing roads.
As there were more and more cars in the city, traffic jams started to pose real p... | 2,715 |
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 lo... | 2,716 |
Title: Dima and Two Sequences
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Dima has two sequences of points with integer coordinates: sequence (*a*1,<=1),<=(*a*2,<=2),<=...,<=(*a**n*,<=*n*) and sequence (*b*1,<=1),<=(*b*2,<=2),<=...,<=(*b**n*,<=*n*).
Now Dima wants to count the ... | 2,717 |
Title: Music
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Lesha loves listening to music via his smartphone. But the smartphone doesn't have much memory, so Lesha listens to his favorite songs in a well-known social network InTalk.
Unfortunately, internet is not that fast in the... | 2,718 |
Title: Goats and Wolves
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Once Vasya needed to transport *m* goats and *m* wolves from riverbank to the other as quickly as possible. The boat can hold *n* animals and Vasya, in addition, he is permitted to put less than *n* animals in the boat. If... | 2,719 |
Title: none
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 system, the dist... | 2,720 |
Title: 3-cycles
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
During a recent research Berland scientists found out that there were *n* cities in Ancient Berland, joined by two-way paths. Any two cities are joined by no more than one path. No path joins a city with itself. According to a wel... | 2,721 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You all know that the Library of Bookland is the largest library in the world. There are dozens of thousands of books in the library.
Some long and uninteresting story was removed...
The alphabet of Bookland is so large that its... | 2,722 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an array *a*1,<=*a*2,<=...,<=*a**n* and *m* sets *S*1,<=*S*2,<=...,<=*S**m* of indices of elements of this array. Let's denote *S**k*<==<={*S**k*,<=*i*}Β (1<=β€<=*i*<=β€<=|*S**k*|). In other words, *S**k*,<=*i* is some ... | 2,723 |
Title: Unusual Sequences
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Count the number of distinct sequences *a*1,<=*a*2,<=...,<=*a**n* (1<=β€<=*a**i*) consisting of positive integers such that *gcd*(*a*1,<=*a*2,<=...,<=*a**n*)<==<=*x* and . As this number could be large, print the answe... | 2,724 |
Title: A Game With Numbers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Imagine that Alice is playing a card game with her friend Bob. They both have exactly $8$ cards and there is an integer on each card, ranging from $0$ to $4$. In each round, Alice or Bob in turns choose two cards fr... | 2,725 |
Title: Peculiar apple-tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are *n* inflorescences, numbered from 1 to *n*. Inflorescence number 1 is ... | 2,726 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus got an internship in one well-known social network. His test task is to count the number of unique users who have visited a social network during the day. Polycarpus was provided with information on all user requests fo... | 2,727 |
Title: Prairie Partition
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It can be shown that any positive integer *x* can be uniquely represented as *x*<==<=1<=+<=2<=+<=4<=+<=...<=+<=2*k*<=-<=1<=+<=*r*, where *k* and *r* are integers, *k*<=β₯<=0, 0<=<<=*r*<=β€<=2*k*. Let's call that repr... | 2,728 |
Title: Rectangle and Square
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets ... | 2,729 |
Title: Ever-Hungry Krakozyabra
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Recently, a wild Krakozyabra appeared at Jelly Castle. It is, truth to be said, always eager to have something for dinner.
Its favorite meal is natural numbers (typically served with honey sauce), or, to be mor... | 2,730 |
Title: Parquet
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Once Bob decided to lay a parquet floor in his living room. The living room is of size *n*<=Γ<=*m* metres. Bob had planks of three types: *a* planks 1<=Γ<=2 meters, *b* planks 2<=Γ<=1 meters, and *c* planks 2<=Γ<=2 meters. Help Bob... | 2,731 |
Title: Parquet Re-laying
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Peter decided to lay a parquet in the room of size *n*<=Γ<=*m*, the parquet consists of tiles of size 1<=Γ<=2. When the workers laid the parquet, it became clear that the tiles pattern looks not like Peter likes, and ... | 2,732 |
Title: QR code
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Input Specification:
The input contains two integers *a*1,<=*a*2 (0<=β€<=*a**i*<=β€<=32), separated by a single space.
Output Specification:
Output a single integer.
Demo Input:
['1 1\n', '3 7\n', '13 10\n']
Demo Output:
['0... | 2,733 |
Title: Magic Breeding
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Nikita and Sasha play a computer game where you have to breed some magical creatures. Initially, they have *k* creatures numbered from 1 to *k*. Creatures have *n* different characteristics.
Sasha has a spell that allow... | 2,734 |
Title: Summer sell-off
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an ass... | 2,735 |
Title: Bear and Poker
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Limak is an old brown bear. He often plays poker with his friends. Today they went to a casino. There are *n* players (including Limak himself) and right now all of them have bids on the table. *i*-th of them has bid wit... | 2,736 |
Title: Memory and Crow
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are *n* integers *b*1,<=*b*2,<=...,<=*b**n* written in a row. For all *i* from 1 to *n*, values *a**i* are defined by the crows performing the following procedure:
- The crow sets *a**i* initially 0. - The crow... | 2,737 |
Title: Settlers' Training
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommodates exactly *n* soldiers... | 2,738 |
Title: Brand New Problem
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A widely known among some people Belarusian sport programmer Lesha decided to make some money to buy a one square meter larger flat. To do this, he wants to make and carry out a Super Rated Match (SRM) on the site Tor... | 2,739 |
Title: Recover Polygon (medium)
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Now that Heidi has made sure her Zombie Contamination level checker works, it's time to strike! This time, the zombie lair is a strictly convex polygon on the lattice. Each vertex of the polygon occupies a poin... | 2,740 |
Title: Misha and Palindrome Degree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Misha has an array of *n* integers indexed by integers from 1 to *n*. Let's define palindrome degree of array *a* as the number of such index pairs (*l*,<=*r*)(1<=β€<=*l*<=β€<=*r*<=β€<=*n*), that the elements f... | 2,741 |
Title: Maximal Binary Matrix
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given matrix with *n* rows and *n* columns filled with zeroes. You should put *k* ones in it in such a way that the resulting matrix is symmetrical with respect to the main diagonal (the diagonal that goes... | 2,742 |
Title: Covered Path
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The on-board computer on Polycarp's car measured that the car speed at the beginning of some section of the path equals *v*1 meters per second, and in the end it is *v*2 meters per second. We know that this section of the ... | 2,743 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is a number *x* initially written on a blackboard. You repeat the following action a fixed amount of times:
1. take the number *x* currently written on a blackboard and erase it 1. select an integer uniformly at random f... | 2,744 |
Title: Amr and Music
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Amr is a young coder who likes music a lot. He always wanted to learn how to play music but he was busy coding so he got an idea.
Amr has *n* instruments, it takes *a**i* days to learn *i*-th instrument. Being busy, Amr ... | 2,745 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a giftΒ β a large snow maker. He plans to make some amount of snow every day. On day *i... | 2,746 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Two best friends Serozha and Gena play a game.
Initially there is one pile consisting of *n* stones on the table. During one move one pile should be taken and divided into an arbitrary number of piles consisting of *a*1<=><=*a... | 2,747 |
Title: Little Girl and Maximum Sum
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The little girl loves the problems on array queries very much.
One day she came across a rather well-known problem: you've got an array of $n$ elements (the elements of the array are indexed starting from 1... | 2,748 |
Title: Phone Number
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Alas, finding one's true love is not easy. Masha has been unsuccessful in that yet. Her friend Dasha told Masha about a way to determine the phone number of one's Prince Charming through arithmancy.
The phone number is divin... | 2,749 |
Title: Entertaining Geodetics
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
The maps in the game are divided into square cells called Geo Panels. Some of these panels are painted. We shall assume that the Geo Panels without color are painted the transparent color.
Besides, the map has so-c... | 2,750 |
Title: Candies and Stones
Time Limit: 7 seconds
Memory Limit: 45 megabytes
Problem Description:
Little Gerald and his coach Mike play an interesting game. At the beginning of the game there is a pile consisting of *n* candies and a pile consisting of *m* stones. Gerald and Mike move in turns, Mike goes first. During... | 2,751 |
Title: Getting an A
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Translator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system.
The term is coming t... | 2,752 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got an array *a*, consisting of *n* integers. The array elements are indexed from 1 to *n*. Let's determine a two step operation like that:
1. First we build by the array *a* an array *s* of partial sums, consisting of *n... | 2,753 |
Title: Reclamation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In a far away land, there exists a planet shaped like a cylinder. There are three regions in this planet: top, bottom, and side as shown in the following picture.
Both the top and the bottom areas consist of big cities. Th... | 2,754 |
Title: Unsorting Array
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Petya likes arrays of integers a lot. Recently his mother has presented him one such array consisting of *n* elements. Petya is now wondering whether he can swap any two distinct integers in the array so that the... | 2,755 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Tavas is a cheerleader in the new sports competition named "Pashmaks".
This competition consists of two part: swimming and then running. People will immediately start running *R* meters after they finished swimming exactly *S* me... | 2,756 |
Title: Design Tutorial: Learn from Math
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One way to create a task is to learn from math. You can generate some random math statement or modify some theorems to get something new and build a new task from that.
For example, there is a statemen... | 2,757 |
Title: Vessels
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is a system of *n* vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to *n*, in the order from the highest to the lowest, the volume of the *i*-th vessel is *a*... | 2,758 |
Title: The Festive Evening
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It's the end of JulyΒ β the time when a festive evening is held at Jelly Castle! Guests from all over the kingdom gather here to discuss new trends in the world of confectionery. Yet some of the things discussed here... | 2,759 |
Title: Tetris revisited
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
Physicist Woll likes to play one relaxing game in between his search of the theory of everything.
Game interface consists of a rectangular *n*<=Γ<=*m* playing field and a dashboard. Initially some cells of the playing fie... | 2,760 |
Title: Levko and Array
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Levko has an array that consists of integers: *a*1,<=*a*2,<=... ,<=*a**n*. But he doesnβt like this array at all.
Levko thinks that the beauty of the array *a* directly depends on value *c*(*a*), which can be calculate... | 2,761 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Limak has a grid that consists of 2 rows and *n* columns. The *j*-th cell in the *i*-th row contains an integer *t**i*,<=*j* which can be positive, negative or zero.
A non-empty rectangle of cells is called nice if and only if th... | 2,762 |
Title: Birthday
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Ali is Hamed's little brother and tomorrow is his birthday. Hamed wants his brother to earn his gift so he gave him a hard programming problem and told him if he can successfully solve it, he'll get him a brand new laptop. Ali... | 2,763 |
Title: Cellular Network
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* points on the straight line β the positions (*x*-coordinates) of the cities and *m* points on the same line β the positions (*x*-coordinates) of the cellular towers. All towers work in the same way β ... | 2,764 |
Title: High Cry
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to learn Russian :)
Rick and Morty like to go to the ridge High Cry for crying loudlyΒ β there is ... | 2,765 |
Title: Famil Door and Brackets
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
As Famil Doorβs birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of brackets o... | 2,766 |
Title: King of Thieves
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In this problem you will meet the simplified model of game King of Thieves.
In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obsta... | 2,767 |
Title: Volcanoes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Iahub got lost in a very big desert. The desert can be represented as a *n*<=Γ<=*n* square matrix, where each cell is a zone of the desert. The cell (*i*,<=*j*) represents the cell at row *i* and column *j* (1<=β€<=*i*,<=*j*<=... | 2,768 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dreamoon has a string *s* and a pattern string *p*. He first removes exactly *x* characters from *s* obtaining string *s*' as a result. Then he calculates that is defined as the maximal number of non-overlapping substrings equal ... | 2,769 |
Title: Working out
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix *a* with *n* lines and *m* columns. Let number *a*[*i*][*j*] represents the calor... | 2,770 |
Title: Hill Climbing
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This problem has nothing to do with Little Chris. It is about hill climbers instead (and Chris definitely isn't one).
There are *n* hills arranged on a line, each in the form of a vertical line segment with one endpoint ... | 2,771 |
Title: Odds and Ends
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?
Given an integer sequence *a*1,<=*a*2,<=...,<=*a**n* of length *n*. Decide whether it is possible to divide it into an odd num... | 2,772 |
Title: Mr. Kitayuta's Colorful Graph
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mr. Kitayuta has just bought an undirected graph consisting of *n* vertices and *m* edges. The vertices of the graph are numbered from 1 to *n*. Each edge, namely edge *i*, has a color *c**i*, connecting v... | 2,773 |
Title: Two Arithmetic Progressions
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given two arithmetic progressions: *a*1*k*<=+<=*b*1 and *a*2*l*<=+<=*b*2. Find the number of integers *x* such that *L*<=β€<=*x*<=β€<=*R* and *x*<==<=*a*1*k*'<=+<=*b*1<==<=*a*2*l*'<=+<=*b*2, for some i... | 2,774 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Qwerty the Ranger took up a government job and arrived on planet Mars. He should stay in the secret lab and conduct some experiments on bacteria that have funny and abnormal properties. The job isn't difficult, but the salary is h... | 2,775 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
After the piece of a devilish mirror hit the Kay's eye, he is no longer interested in the beauty of the roses. Now he likes to watch snowflakes.
Once upon a time, he found a huge snowflake that has a form of the tree (connected a... | 2,776 |
Title: Two Rooted Trees
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have two rooted undirected trees, each contains *n* vertices. Let's number the vertices of each tree with integers from 1 to *n*. The root of each tree is at vertex 1. The edges of the first tree are painted blue, ... | 2,777 |
Title: Sums of Digits
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya had a strictly increasing sequence of positive integers *a*1, ..., *a**n*. Vasya used it to build a new sequence *b*1, ..., *b**n*, where *b**i* is the sum of digits of *a**i*'s decimal representation. Then sequenc... | 2,778 |
Title: Long Jumps
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler!
However, there is no reason for disappointment, as Valery has found another r... | 2,779 |
Title: Funny Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Once upon a time Petya and Gena gathered after another programming competition and decided to play some game. As they consider most modern games to be boring, they always try to invent their own games. They have only sticker... | 2,780 |
Title: Orchestra
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Paul is at the orchestra. The string section is arranged in an *r*<=Γ<=*c* rectangular grid and is filled with violinists with the exception of *n* violists. Paul really likes violas, so he would like to take a picture includ... | 2,781 |
Title: none
Time Limit: None seconds
Memory Limit: None 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 roads.... | 2,782 |
Title: Tavas in Kansas
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Tavas lives in Kansas. Kansas has *n* cities numbered from 1 to *n* connected with *m* bidirectional roads. We can travel from any city to any other city via these roads. Kansas is as strange as Tavas. So there may be a... | 2,783 |
Title: Black Widow
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Natalia Romanova is trying to test something on the new gun S.H.I.E.L.D gave her. In order to determine the result of the test, she needs to find the number of answers to a certain equation. The equation is of form:
Wher... | 2,784 |
Title: Exams
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly *n* exams. Valera is a smart guy, so he will be able to pass any exam he takes on his first try. Beside... | 2,785 |
Title: Vitaly and Night
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day Vitaly was going home late at night and wondering: how many people aren't sleeping at that moment? To estimate, Vitaly decided to look which windows are lit in the house he was passing by at that moment.
Vital... | 2,786 |
Title: Love Rescue
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Valya and Tolya are an ideal pair, but they quarrel sometimes. Recently, Valya took offense at her boyfriend because he came to her in t-shirt with lettering that differs from lettering on her pullover. Now she doesn't want... | 2,787 |
Title: Beautiful Year
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It seems like the year of 2013 came only yesterday. Do you know a curious fact? The year of 2013 is the first year after the old 1987 with only distinct digits.
Now you are suggested to solve the following problem: give... | 2,788 |
Title: I'm bored with life
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Holidays have finished. Thanks to the help of the hacker Leha, Noora managed to enter the university of her dreams which is located in a town Pavlopolis. It's well known that universities provide students with dormi... | 2,789 |
Title: Polycarp's Practice
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarp is practicing his problem solving skill. He has a list of $n$ problems with difficulties $a_1, a_2, \dots, a_n$, respectively. His plan is to practice for exactly $k$ days. Each day he has to solve at least... | 2,790 |
Title: GukiZ hates Boxes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.
In total there are *n* piles of boxes, arranged in a line, from left to right, *i*-th pile (1<=β€<=*i*... | 2,791 |
Title: Mysterious Present
Time Limit: 1 seconds
Memory Limit: 64 megabytes
Problem Description:
Peter decided to wish happy birthday to his friend from Australia and send him a card. To make his present more mysterious, he decided to make a chain. Chain here is such a sequence of envelopes *A*<==<={*a*1,<=<=*a*2,<=<... | 2,792 |
Title: Sereja and Mirroring
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's assume that we are given a matrix *b* of size *x*<=Γ<=*y*, let's determine the operation of mirroring matrix *b*. The mirroring of matrix *b* is a 2*x*<=Γ<=*y* matrix *c* which has the following properties:
... | 2,793 |
Title: Verifying Kingdom
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This is an interactive problem.
The judge has a hidden rooted full binary tree with *n* leaves. A full binary tree is one where every node has either 0 or 2 children. The nodes with 0 children are called the leaves o... | 2,794 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Drazil is playing a math game with Varda.
Let's define for positive integer *x* as a product of factorials of its digits. For example, .
First, they choose a decimal number *a* consisting of *n* digits that contains at least on... | 2,795 |
Title: Sockets
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The ICM ACPC World Finals is coming! Unfortunately, the organizers of the competition were so busy preparing tasks that totally missed an important technical point β the organization of electricity supplement for all the partic... | 2,796 |
Title: Vanya and Field
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vanya decided to walk in the field of size *n*<=Γ<=*n* cells. The field contains *m* apple trees, the *i*-th apple tree is at the cell with coordinates (*x**i*,<=*y**i*). Vanya moves towards vector (*dx*,<=*dy*). That m... | 2,797 |
Title: Alice, Bob, Oranges and Apples
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the re... | 2,798 |
Title: Balancer
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya has *k* matches, placed in *n* matchboxes lying in a line from left to right. We know that *k* is divisible by *n*. Petya wants all boxes to have the same number of matches inside. For that, he can move a match from its ... | 2,799 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.