task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0,<=1]. Next, *n* stones will fall and Liss will escape from the stones. The st... | 2,200 |
Title: Playlist
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Manao's friends often send him new songs. He never listens to them right away. Instead, he compiles them into a playlist. When he feels that his mind is open to new music, he opens the playlist and starts to listen to the song... | 2,201 |
Title: Little Elephant and Magic Square
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Elephant loves magic squares very much.
A magic square is a 3<=×<=3 table, each cell contains some positive integer. At that the sums of integers in all rows, columns and diagonals of the table ... | 2,202 |
Title: Cutting Carrot
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Igor the analyst has adopted *n* little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cu... | 2,203 |
Title: Sorting Railway Cars
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
An infinitely long railway has a train consisting of *n* cars, numbered from 1 to *n* (the numbers of all the cars are distinct) and positioned in arbitrary order. David Blaine wants to sort the railway cars in the... | 2,204 |
Title: Xor-sequences
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* integers *a*1,<=<=*a*2,<=<=...,<=<=*a**n*.
A sequence of integers *x*1,<=<=*x*2,<=<=...,<=<=*x**k* is called a "xor-sequence" if for every 1<=<=≤<=<=*i*<=<=≤<=<=*k*<=-<=1 the number of ones in the binar... | 2,205 |
Title: Tyndex.Brome
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Tyndex is again well ahead of the rivals! The reaction to the release of Zoozle Chrome browser was the release of a new browser Tyndex.Brome!
The popularity of the new browser is growing daily. And the secret is not even the ... | 2,206 |
Title: New Year and Cleaning
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Limak is a little polar bear. His parents told him to clean a house before the New Year's Eve. Their house is a rectangular grid with *h* rows and *w* columns. Each cell is an empty square.
He is a little bear an... | 2,207 |
Title: Recycling Bottles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.
We can think Central Perk as coordinate plane. There... | 2,208 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Barney lives in NYC. NYC has infinite number of intersections numbered with positive integers starting from 1. There exists a bidirectional road between intersections *i* and 2*i* and another road between *i* and 2*i*<=+<=1 for ev... | 2,209 |
Title: Expression
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers *a*, *b*, *c* on the blackboard. The task was to insert signs of ... | 2,210 |
Title: Karen and Supermarket
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
On the way home, Karen decided to stop by the supermarket to buy some groceries.
She needs to buy a lot of goods, but since she is a student her budget is still quite limited. In fact, she can only spend up to *b... | 2,211 |
Title: Factory Repairs
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A factory produces thimbles in bulk. Typically, it can produce up to *a* thimbles a day. However, some of the machinery is defective, so it can currently only produce *b* thimbles each day. The factory intends to choose... | 2,212 |
Title: Field of Wonders
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus takes part in the "Field of Wonders" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden.
The game consists of several tur... | 2,213 |
Title: Vitya and Strange Lesson
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Today at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as element. For example, *mex*([4,<=33,<=... | 2,214 |
Title: New Year and Buggy Bot
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bob programmed a robot to navigate through a 2d maze.
The maze has some obstacles. Empty cells are denoted by the character '.', where obstacles are denoted by '#'.
There is a single robot in the maze. Its star... | 2,215 |
Title: Half-decay tree
Time Limit: 3 seconds
Memory Limit: 256 megabytes
Problem Description:
Recently Petya has become keen on physics. Anna V., his teacher noticed Petya's interest and gave him a fascinating physical puzzle — a half-decay tree.
A half-decay tree is a complete binary tree with the height *h*. The... | 2,216 |
Title: Parking Lot
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya's been bored at work and he is killing the time by watching the parking lot at the office. The parking lot looks from above like an *n*<=×<=*m* table (a cell of the table corresponds to a single parking spot). Some sp... | 2,217 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular *w* mm <=×<= *h* mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks ... | 2,218 |
Title: Chord
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasya studies music.
He has learned lots of interesting stuff. For example, he knows that there are 12 notes: C, C#, D, D#, E, F, F#, G, G#, A, B, H. He also knows that the notes are repeated cyclically: after H goes C again, and b... | 2,219 |
Title: Neural Network country
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Due to the recent popularity of the Deep learning new countries are starting to look like Neural Networks. That is, the countries are being built deep with many layers, each layer possibly having many cities. The... | 2,220 |
Title: GCD Table
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Consider a table *G* of size *n*<=×<=*m* such that *G*(*i*,<=*j*)<==<=*GCD*(*i*,<=*j*) for all 1<=≤<=*i*<=≤<=*n*,<=1<=≤<=*j*<=≤<=*m*. *GCD*(*a*,<=*b*) is the greatest common divisor of numbers *a* and *b*.
You have a sequenc... | 2,221 |
Title: none
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 neighbors are not ne... | 2,222 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Long ago, when Petya was a schoolboy, he was very much interested in the Petr# language grammar. During one lesson Petya got interested in the following question: how many different continuous substrings starting with the *s**begi... | 2,223 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Barney lives in country USC (United States of Charzeh). USC has *n* cities numbered from 1 through *n* and *n*<=-<=1 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the ... | 2,224 |
Title: Dividing Kingdom II
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Long time ago, there was a great kingdom and it was being ruled by The Great Arya and Pari The Great. These two had some problems about the numbers they like, so they decided to divide the great kingdom between them... | 2,225 |
Title: Timofey and a flat tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Timofey has a big tree — an undirected connected graph with *n* vertices and no simple cycles. He likes to walk along it. His tree is flat so when he walks along it he sees it entirely. Quite naturally, w... | 2,226 |
Title: Replacement
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Petya very much likes arrays consisting of *n* integers, where each of them is in the range from 1 to 109, inclusive. Recently he has received one such array as a gift from his mother. Petya didn't like it at once. H... | 2,227 |
Title: Kleofáš and the n-thlon
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Kleofáš is participating in an *n*-thlon - a tournament consisting of *n* different competitions in *n* different disciplines (numbered 1 through *n*). There are *m* participants in the *n*-thlon and each of the... | 2,228 |
Title: Ring road
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Nowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Formerly all *n* cities of Berland were conne... | 2,229 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Consider some square matrix *A* with side *n* consisting of zeros and ones. There are *n* rows numbered from 1 to *n* from top to bottom and *n* columns numbered from 1 to *n* from left to right in this matrix. We'll denote the el... | 2,230 |
Title: Huge Strings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* strings *s*1,<=*s*2,<=...,<=*s**n* consisting of characters 0 and 1. *m* operations are performed, on each of them you concatenate two existing strings into a new one. On the *i*-th operation the concaten... | 2,231 |
Title: Trace
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day, as Sherlock Holmes was tracking down one very important criminal, he found a wonderful painting on the wall. This wall could be represented as a plane. The painting had several concentric circles that divided the wall in... | 2,232 |
Title: Duff is Mad
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Duff is mad at her friends. That's why she sometimes makes Malek to take candy from one of her friends for no reason!
She has *n* friends. Her *i*-th friend's name is *s**i* (their names are not necessarily unique). *q* ti... | 2,233 |
Title: none
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 key is either on its place, ... | 2,234 |
Title: Mass Change Queries
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an array *a* consisting of *n* integers. You have to process *q* queries to this array; each query is given as four numbers *l*, *r*, *x* and *y*, denoting that for every *i* such that *l*<=≤<=*i*<=≤<=... | 2,235 |
Title: Porcelain
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
During her tantrums the princess usually smashes some collectable porcelain. Every furious shriek is accompanied with one item smashed.
The collection of porcelain is arranged neatly on *n* shelves. Within each shelf the ite... | 2,236 |
Title: Tidying Up
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Smart Beaver is careful about his appearance and pays special attention to shoes so he has a huge number of pairs of shoes from the most famous brands of the forest. He's trying to handle his shoes carefully so that each pai... | 2,237 |
Title: Shift It!
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
There is a square box 6<=×<=6 in size. It contains 36 chips 1<=×<=1 in size. Those chips contain 36 different characters — "0"-"9" and "A"-"Z". There is exactly one chip with each character.
You are allowed to make the following... | 2,238 |
Title: Ant on the Tree
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Connected undirected graph without cycles is called a tree. Trees is a class of graphs which is interesting not only for people, but for ants too.
An ant stands at the root of some tree. He sees that there are *n* vertexes... | 2,239 |
Title: Electric Charges
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Programmer Sasha is a student at MIPT (Moscow Institute of Physics and Technology) and he needs to make a laboratory work to pass his finals.
A laboratory unit is a plane with standard coordinate axes marked on it. Ph... | 2,240 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Everyone knows what the Fibonacci sequence is. This sequence can be defined by the recurrence relation:
We'll define a new number sequence *A**i*(*k*) by the formula:
In this problem, your task is to calculate the following su... | 2,241 |
Title: Letters Removing
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya has a string of length *n* consisting of small and large English letters and digits.
He performs *m* operations. Each operation is described with two integers *l* and *r* and a character *c*: Petya removes from ... | 2,242 |
Title: Maximum Absurdity
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Reforms continue entering Berland. For example, during yesterday sitting the Berland Parliament approved as much as *n* laws (each law has been assigned a unique number from 1 to *n*). Today all these laws were put on... | 2,243 |
Title: Friends and Presents
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have two friends. You want to present each of them several positive integers. You want to present *cnt*1 numbers to the first friend and *cnt*2 numbers to the second friend. Moreover, you want all presented num... | 2,244 |
Title: Tavas and Karafs
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Karafs is some kind of vegetable in shape of an 1<=×<=*h* rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.
Each Karafs has a positive inte... | 2,245 |
Title: ZgukistringZ
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Professor GukiZ doesn't accept string as they are. He likes to swap some letters in string to obtain a new one.
GukiZ has strings *a*, *b*, and *c*. He wants to obtain string *k* by swapping some letters in *a*, so that *... | 2,246 |
Title: none
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-empty subset o... | 2,247 |
Title: Beautiful Matrix
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got a 5<=×<=5 matrix, consisting of 24 zeroes and a single number one. Let's index the matrix rows by numbers from 1 to 5 from top to bottom, let's index the matrix columns by numbers from 1 to 5 from left to ri... | 2,248 |
Title: Puzzling Language
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In this problem you will write a simple code generator for a 2D programming language derived from [Brainfuck](https://en.wikipedia.org/wiki/Brainfuck).
The code in this language is a rectangular grid of characters '.... | 2,249 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Allen and Bessie are playing a simple number game. They both know a function $f: \{0, 1\}^n \to \mathbb{R}$, i. e. the function takes $n$ binary arguments and returns a real value. At the start of the game, the variables $x_1, x_2... | 2,250 |
Title: Tavas and SaDDas
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphone... | 2,251 |
Title: Spiders Evil Plan
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Spiders are Om Nom's old enemies. They love eating candies as much as he does and that's why they keep trying to keep the monster away from his favorite candies. They came up with an evil plan to trap Om Nom.
Let's c... | 2,252 |
Title: Palindromic Cut
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Kolya has a string *s* of length *n* consisting of lowercase and uppercase Latin letters and digits.
He wants to rearrange the symbols in *s* and cut it into the minimum number of parts so that each part is a palindrom... | 2,253 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided into *n* teams and played several matches, two teams could not play against each other more than... | 2,254 |
Title: Promocodes with Mistakes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
During a New Year special offer the "Sudislavl Bars" offered *n* promo codes. Each promo code consists of exactly six digits and gives right to one free cocktail at the bar "Mosquito Shelter". Of course, all th... | 2,255 |
Title: CNF 2
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
'In Boolean logic, a formula is in conjunctive normal form (CNF) or clausal normal form if it is a conjunction of clauses, where a clause is a disjunction of literals' (cited from https://en.wikipedia.org/wiki/Conjunctive_normal_... | 2,256 |
Title: Hamster Farm
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dima has a hamsters farm. Soon *N* hamsters will grow up on it and Dima will sell them in a city nearby.
Hamsters should be transported in boxes. If some box is not completely full, the hamsters in it are bored, that's wh... | 2,257 |
Title: Appleman and Tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Appleman has a tree with *n* vertices. Some of the vertices (at least one) are colored black and other vertices are colored white.
Consider a set consisting of *k* (0<=≤<=*k*<=<<=*n*) edges of Appleman's tree. If ... | 2,258 |
Title: Ice Cave
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You play a computer game. Your character stands on some level of a multilevel ice cave. In order to move on forward, you need to descend one level lower and the only way to do this is to fall through the ice.
The level of the... | 2,259 |
Title: Round Subset
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's call the roundness of the number the number of zeros to which it ends.
You have an array of *n* numbers. You need to choose a subset of exactly *k* numbers so that the roundness of the product of the selected number... | 2,260 |
Title: Anthem of Berland
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem.
Though there are lots and lots of victories in history of Berland, there i... | 2,261 |
Title: Area of Two Circles' Intersection
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given two circles. Find the area of their intersection.
Input Specification:
The first line contains three integers *x*1,<=*y*1,<=*r*1 (<=-<=109<=≤<=*x*1,<=*y*1<=≤<=109,<=1<=≤<=*r*1<=≤<=109) —... | 2,262 |
Title: Martian Architecture
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Chris the Rabbit found the traces of an ancient Martian civilization. The brave astronomer managed to see through a small telescope an architecture masterpiece — "A Road to the Sun". The building stands on cubical ston... | 2,263 |
Title: Painting The Wall
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
User ainta decided to paint a wall. The wall consists of *n*2 tiles, that are arranged in an *n*<=×<=*n* table. Some tiles are painted, and the others are not. As he wants to paint it beautifully, he will follow the r... | 2,264 |
Title: Chris and Road
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
And while Mishka is enjoying her trip...
Chris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important ... | 2,265 |
Title: Subway Innovation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Berland is going through tough times — the dirt price has dropped and that is a blow to the country's economy. Everybody knows that Berland is the top world dirt exporter!
The President of Berland was forced to leave... | 2,266 |
Title: Mission Impassable
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Market stalls now have the long-awaited game The Colder Scrools V: Nvodsk. The game turned out to be difficult as hell and most students can't complete the last quest ("We don't go to Nvodsk..."). That threatened win... | 2,267 |
Title: Foe Pairs
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a permutation *p* of length *n*. Also you are given *m* foe pairs (*a**i*,<=*b**i*) (1<=≤<=*a**i*,<=*b**i*<=≤<=*n*,<=*a**i*<=≠<=*b**i*).
Your task is to count the number of different intervals (*x*,<=*y*) (1<=... | 2,268 |
Title: Sorting Permutations
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
We are given a permutation sequence *a*1,<=*a*2,<=...,<=*a**n* of numbers from 1 to *n*. Let's assume that in one second, we can choose some disjoint pairs (*u*1,<=*v*1),<=(*u*2,<=*v*2),<=...,<=(*u**k*,<=*v**k*) an... | 2,269 |
Title: Mike and gcd problem
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mike has a sequence *A*<==<=[*a*1,<=*a*2,<=...,<=*a**n*] of length *n*. He considers the sequence *B*<==<=[*b*1,<=*b*2,<=...,<=*b**n*] beautiful if the *gcd* of all its elements is bigger than 1, i.e. .
Mike want... | 2,270 |
Title: Team Work
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have a team of *N* people. For a particular task, you can pick any non-empty subset of people. The cost of having *x* people for the task is *x**k*.
Output the sum of costs over all non-empty subsets of people.
Input S... | 2,271 |
Title: Table Tennis Game 2
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Misha and Vanya have played several table tennis sets. Each set consists of several serves, each serve is won by one of the players, he receives one point and the loser receives nothing. Once one of the players scor... | 2,272 |
Title: Chloe and the sequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Chloe, the same as Vladik, is a competitive programmer. She didn't have any problems to get to the olympiad like Vladik, but she was confused by the task proposed on the olympiad.
Let's consider the following a... | 2,273 |
Title: Rounding
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya has a non-negative integer *n*. He wants to round it to nearest integer, which ends up with 0. If *n* already ends up with 0, Vasya considers it already rounded.
For example, if *n*<==<=4722 answer is 4720. If *n*<==<=5... | 2,274 |
Title: Cows and Sequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform *n* operations. Each operation is one of the following:
1. Add the i... | 2,275 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have multiset of *n* strings of the same length, consisting of lowercase English letters. We will say that those strings are easy to remember if for each string there is some position *i* and some letter *c* of the English alp... | 2,276 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district center is located at the point *d*.
Johnny's truck has a gas tank th... | 2,277 |
Title: Almost Difference
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's denote a function
You are given an array *a* consisting of *n* integers. You have to calculate the sum of *d*(*a**i*,<=*a**j*) over all pairs (*i*,<=*j*) such that 1<=≤<=*i*<=≤<=*j*<=≤<=*n*.
Input Specifica... | 2,278 |
Title: Chip Play
Time Limit: 4 seconds
Memory Limit: 256 megabytes
Problem Description:
Let's consider the following game. We have a rectangular field *n*<=×<=*m* in size. Some squares of the field contain chips.
Each chip has an arrow painted on it. Thus, each chip on the field points in one of the following direc... | 2,279 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There is a social website with *n* fanpages, numbered 1 through *n*. There are also *n* companies, and the *i*-th company owns the *i*-th fanpage.
Recently, the website created a feature called following. Each fanpage must choose... | 2,280 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Manao is taking part in a quiz. The quiz consists of *n* consecutive questions. A correct answer gives one point to the player. The game also has a counter of consecutive correct answers. When the player answers a question correct... | 2,281 |
Title: Empty Rectangles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got an *n*<=×<=*m* table (*n* rows and *m* columns), each cell of the table contains a "0" or a "1".
Your task is to calculate the number of rectangles with the sides that are parallel to the sides of the table... | 2,282 |
Title: Expensive Strings
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* strings *t**i*. Each string has cost *c**i*.
Let's define the function of string , where *p**s*,<=*i* is the number of occurrences of *s* in *t**i*, |*s*| is the length of the string *s*. Find the m... | 2,283 |
Title: Couple Cover
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Couple Cover, a wildly popular luck-based game, is about to begin! Two players must work together to construct a rectangle. A bag with *n* balls, each with an integer written on it, is placed on the table. The first player... | 2,284 |
Title: Timofey and cubes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Young Timofey has a birthday today! He got kit of *n* cubes as a birthday present from his parents. Every cube has a number *a**i*, which is written on it. Timofey put all the cubes in a row and went to unpack other p... | 2,285 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are *n* flights that must depart today, the *i*-th of them is planned to depart at the *i*-th minute of the day.
Metropolis airport is... | 2,286 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bear Limak has *n* colored balls, arranged in one long row. Balls are numbered 1 through *n*, from left to right. There are *n* possible colors, also numbered 1 through *n*. The *i*-th ball has color *t**i*.
For a fixed interval ... | 2,287 |
Title: Greg and Friends
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One day Greg and his friends were walking in the forest. Overall there were *n* people walking, including Greg. Soon he found himself in front of a river. The guys immediately decided to get across the river. Luckily, ... | 2,288 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Furik loves writing all sorts of problems, especially such that he can't solve himself. You've got one of his problems, the one Furik gave to Rubik. And Rubik asks you to solve it.
There is integer *n* and array *a*, consisting o... | 2,289 |
Title: Repairing Of String
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Stepan had a favorite string *s* which consisted of the lowercase letters of the Latin alphabet.
After graduation, he decided to remember it, but it was a long time ago, so he can't now remember it. But Stepan rem... | 2,290 |
Title: Row of Models
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
During the final part of fashion show all models come to the stage and stay in one row and fashion designer stays to right to model on the right. During the rehearsal, Izabella noticed, that row isn't nice, but she can't ... | 2,291 |
Title: Plate Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got a rectangular table with length *a* and width *b* and the infinite number of plates of radius *r*. Two players play the following game: they take turns to put the plates on the table so that the plates don't lie o... | 2,292 |
Title: Duff in the Army
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Recently Duff has been a soldier in the army. Malek is her commander.
Their country, Andarz Gu has *n* cities (numbered from 1 to *n*) and *n*<=-<=1 bidirectional roads. Each road connects two different cities. There ... | 2,293 |
Title: Cutting the Line
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a non-empty line *s* and an integer *k*. The following operation is performed with this line exactly once:
- A line is split into at most *k* non-empty substrings, i.e. string *s* is represented as a co... | 2,294 |
Title: Domino Carpet
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
...Mike the TV greets you again!
Tired of the monotonous furniture? Sick of gray routine? Dreaming about dizzying changes in your humble abode? We have something to offer you!
This domino carpet for only $99.99 will chang... | 2,295 |
Title: Nastya and King-Shamans
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Nastya likes reading and even spends whole days in a library sometimes. Today she found a chronicle of Byteland in the library, and it stated that there lived shamans long time ago. It is known that at every mom... | 2,296 |
Title: Magic Numbers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Consider the decimal presentation of an integer. Let's call a number d-magic if digit *d* appears in decimal presentation of the number on even positions and nowhere else.
For example, the numbers 1727374, 17, 1 are 7-ma... | 2,297 |
Title: Lucky Common Subsequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence BDF is a subsequen... | 2,298 |
Title: New Language
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Living in Byteland was good enough to begin with, but the good king decided to please his subjects and to introduce a national language. He gathered the best of wise men, and sent an expedition to faraway countries, so tha... | 2,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.