task stringlengths 0 154k | __index_level_0__ int64 0 39.2k |
|---|---|
Title: Computer Game
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasyaβs elder brother Petya loves playing computer games. In one of his favourite computer games Petya reached the final level where a fight with the boss take place.
While playing the game Petya found spell scrolls and now ... | 2,300 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a non-empty string *s* consisting of lowercase English letters. You have to pick exactly one non-empty substring of *s* and shift all its letters 'z' 'y' 'x' 'b' 'a' 'z'. In other words, each character is replac... | 2,301 |
Title: Dynamic Problem Scoring
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vasya and Petya take part in a Codeforces round. The round lasts for two hours and contains five problems.
For this round the dynamic problem scoring is used. If you were lucky not to participate in any Codefor... | 2,302 |
Title: Easy Number Challenge
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's denote *d*(*n*) as the number of divisors of a positive integer *n*. You are given three integers *a*, *b* and *c*. Your task is to calculate the following sum:
Find the sum modulo 1073741824 (230).
Input ... | 2,303 |
Title: Up the hill
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Hiking club "Up the hill" just returned from a walk. Now they are trying to remember which hills they've just walked through.
It is known that there were *N* stops, all on different integer heights between 1 and *N* kilome... | 2,304 |
Title: Crossword
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasya trains to compose crossword puzzles. He can only compose crosswords of a very simplΠ΅ type so far. All of them consist of exactly six words; the words can be read only from top to bottom vertically and from the left to the r... | 2,305 |
Title: Nested Segments
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a sequence *a*1,<=*a*2,<=...,<=*a**n* of one-dimensional segments numbered 1 through *n*. Your task is to find two distinct indices *i* and *j* such that segment *a**i* lies within segment *a**j*.
Segment... | 2,306 |
Title: Guess the Array
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This is an interactive problem. You should use flush operation after each printed line. For example, in C++ you should use fflush(stdout), in Java you should use System.out.flush(), and in PascalΒ β flush(output).
In th... | 2,307 |
Title: REQ
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Today on a math lesson the teacher told Vovochka that the Euler function of a positive integer Ο(*n*) is an arithmetic function that counts the positive integers less than or equal to n that are relatively prime to n. The number 1 ... | 2,308 |
Title: Maxim and Calculator
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Maxim has got a calculator. The calculator has two integer cells. Initially, the first cell contains number 1, and the second cell contains number 0. In one move you can perform one of the following operations:
1.... | 2,309 |
Title: The Elder Trolls IV: Oblivon
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Vasya plays The Elder Trolls IV: Oblivon. Oh, those creators of computer games! What they do not come up with! Absolutely unique monsters have been added to the The Elder Trolls IV: Oblivon. One of these monste... | 2,310 |
Title: The Beaver's Problem - 3
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Smart Beaver from ABBYY came up with another splendid problem for the ABBYY Cup participants! This time the Beaver invites the contest participants to check out a problem on sorting documents by their subje... | 2,311 |
Title: 2Char
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Andrew often reads articles in his favorite magazine 2Char. The main feature of these articles is that each of them uses at most two distinct letters. Andrew decided to send an article to the magazine, but as he hasn't written an... | 2,312 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in th... | 2,313 |
Title: Finite or not?
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction.
A fraction in notation with base $b$ ... | 2,314 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Consider the following grammar:
- <expression> ::= <term> | <expression> '+' <term>- <term> ::= <number> | <number> '-' <number> | <number> '(' <expression> ')'- <n... | 2,315 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Tachibana Kanade likes Mapo Tofu very much. One day, the canteen cooked all kinds of tofu to sell, but not all tofu is Mapo Tofu, only those spicy enough can be called Mapo Tofu.
Each piece of tofu in the canteen is given a *m*-b... | 2,316 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given two lists of non-zero digits.
Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positive pretty... | 2,317 |
Title: Black Square
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarp has a checkered sheet of paper of size *n*<=Γ<=*m*. Polycarp painted some of cells with black, the others remained white. Inspired by Malevich's "Black Square", Polycarp wants to paint minimum possible number of w... | 2,318 |
Title: Bipartite Checking
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an undirected graph consisting of *n* vertices. Initially there are no edges in the graph. Also you are given *q* queries, each query either adds one undirected edge to the graph or removes it. After ea... | 2,319 |
Title: Weighting a Tree
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a connected undirected graph with *n* vertices and *m* edges. The vertices are enumerated from 1 to *n*.
You are given *n* integers *c*1,<=*c*2,<=...,<=*c**n*, each of them is between <=-<=*n* and *n*, ... | 2,320 |
Title: Lexicographically Maximum Subsequence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got string *s*, consisting of only lowercase English letters. Find its lexicographically maximum subsequence.
We'll call a non-empty string *s*[*p*1*p*2... *p**k*]<==<=*s**p*1*s**p*2... *s*... | 2,321 |
Title: Teams Formation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
This time the Berland Team Olympiad in Informatics is held in a remote city that can only be reached by one small bus. Bus has *n* passenger seats, seat *i* can be occupied only by a participant from the city *a**i*.
T... | 2,322 |
Title: Restoring Map
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Archaeologists found some information about an ancient land of Treeland. We know for sure that the Treeland consisted of *n* cities connected by the *n*<=-<=1 road, such that you can get from each city to any other one al... | 2,323 |
Title: Roadside Trees
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Squirrel Liss loves nuts. Liss asks you to plant some nut trees.
There are *n* positions (numbered 1 to *n* from west to east) to plant a tree along a street. Trees grow one meter per month. At the beginning of each mon... | 2,324 |
Title: AND-permutations
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Given an integer *N*, find two permutations:
1. Permutation *p* of numbers from 1 to *N* such that *p**i*<=β <=*i* and *p**i*<=&<=*i*<==<=0 for all *i*<==<=1,<=2,<=...,<=*N*. 1. Permutation *q* of numbers from 1 ... | 2,325 |
Title: Marina and Vasya
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Marina loves strings of the same length and Vasya loves when there is a third string, different from them in exactly *t* characters. Help Vasya find at least one such string.
More formally, you are given two strings *... | 2,326 |
Title: Black Square
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Quite recently, a very smart student named Jury decided that lectures are boring, so he downloaded a game called "Black Square" on his super cool touchscreen phone.
In this game, the phone's screen is divided into four ve... | 2,327 |
Title: Long sequence
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
A sequence *a*0,<=*a*1,<=... is called a recurrent binary sequence, if each term *a**i* (*i*<==<=0,<=1,<=...) is equal to 0 or 1 and there exist coefficients such that
Note that such a sequence can be uniquely recovered fr... | 2,328 |
Title: Present to Mom
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
How many stars are there in the sky? A young programmer Polycarpus can't get this question out of his head! He took a photo of the starry sky using his digital camera and now he analyzes the resulting monochrome digital ... | 2,329 |
Title: PolandBall and Forest
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
PolandBall lives in a forest with his family. There are some trees in the forest. Trees are undirected acyclic graphs with *k* vertices and *k*<=-<=1 edges, where *k* is some integer. Note that one vertex is a val... | 2,330 |
Title: Tennis Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of multiple sets, each set consists of multiple serves. Each serve is won by one of the players, this pla... | 2,331 |
Title: Lucky Segments
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.
... | 2,332 |
Title: Biathlon
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
Perhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to enroll in a... | 2,333 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given *n* integers *a*1,<=*a*2,<=...,<=*a**n*. Denote this list of integers as *T*.
Let *f*(*L*) be a function that takes in a non-empty list of integers *L*.
The function will output another integer as follows:
- Fir... | 2,334 |
Title: Mr. Kitayuta's Gift
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mr. Kitayuta has kindly given you a string *s* consisting of lowercase English letters. You are asked to insert exactly *n* lowercase English letters into *s* to make it a palindrome. (A palindrome is a string that ... | 2,335 |
Title: ELCA
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You have a root tree containing *n* vertexes. Let's number the tree vertexes with integers from 1 to *n*. The tree root is in the vertex 1.
Each vertex (except fot the tree root) *v* has a direct ancestor *p**v*. Also each vertex... | 2,336 |
Title: Match & Catch
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Police headquarter is monitoring signal on different frequency levels. They have got two suspiciously encoded strings *s*1 and *s*2 from two different frequencies as signals. They are suspecting that these two strings are... | 2,337 |
Title: Magic Spheres
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Carl is a beginner magician. He has *a* blue, *b* violet and *c* orange magic spheres. In one move he can transform two spheres of the same color into one sphere of any other color. To make a spell that has never been see... | 2,338 |
Title: Inna, Dima and Song
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Inna is a great piano player and Dima is a modest guitar player. Dima has recently written a song and they want to play it together. Of course, Sereja wants to listen to the song very much.
A song is a sequence of... | 2,339 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
It's well-known that blog posts are an important part of Codeforces platform. Every blog post has a global characteristic changing over timeΒ β its community rating. A newly created blog post's community rating is 0. Codeforces use... | 2,340 |
Title: Harry Potter and the History of Magic
Time Limit: 1 seconds
Memory Limit: 256 megabytes
Problem Description:
The History of Magic is perhaps the most boring subject in the Hogwarts school of Witchcraft and Wizardry. Harry Potter is usually asleep during history lessons, and his magical quill writes the lectur... | 2,341 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8<=Γ<=8): Anna is in the upper right corner, and Maria is in the lower left one. Apart from them, th... | 2,342 |
Title: Item World
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Each item in the game has a level. The higher the level is, the higher basic parameters the item has. We shall consider only the following basic parameters: attack (atk), defense (def) and resistance to different types of impact... | 2,343 |
Title: Blood Cousins Return
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polycarpus got hold of a family tree. The found tree describes the family relations of *n* people, numbered from 1 to *n*. Every person in this tree has at most one direct ancestor. Also, each person in the tree ha... | 2,344 |
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,345 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a rooted tree consisting of *n* vertices numbered from 1 to *n*. The root of the tree is a vertex number 1.
Initially all vertices contain number 0. Then come *q* queries, each query has one of the two types:
- Th... | 2,346 |
Title: Cutting
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
There are a lot of things which could be cutΒ β trees, paper, "the rope". In this problem you are going to cut a sequence of integers.
There is a sequence of integers, which contains the equal number of even and odd numbers. Gi... | 2,347 |
Title: Weather
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Scientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all life on our planet.
Our hero Vasya is quite concerned about the problems. He decided to ... | 2,348 |
Title: Exponential notation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given a positive decimal number *x*.
Your task is to convert it to the "simple exponential notation".
Let *x*<==<=*a*Β·10*b*, where 1<=β€<=*a*<=<<=10, then in general case the "simple exponential notatio... | 2,349 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
For a given positive integer *n* denote its *k*-rounding as the minimum positive integer *x*, such that *x* ends with *k* or more zeros in base 10 and is divisible by *n*.
For example, 4-rounding of 375 is 375Β·80<==<=30000. 30000... | 2,350 |
Title: Hamming Distance
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Hamming distance between strings *a* and *b* of equal length (denoted by *h*(*a*,<=*b*)) is equal to the number of distinct integers *i* (1<=β€<=*i*<=β€<=|*a*|), such that *a**i*<=β <=*b**i*, where *a**i* is the *i*-th sy... | 2,351 |
Title: Post Lamps
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Adilbek's house is located on a street which can be represented as the OX axis. This street is really dark, so Adilbek wants to install some post lamps to illuminate it. Street has $n$ positions to install lamps, they corres... | 2,352 |
Title: Blinds
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are *n* blind stripes with the width of 1 in the factory warehouse for blind production.... | 2,353 |
Title: Extra-terrestrial Intelligence
Time Limit: 2 seconds
Memory Limit: 64 megabytes
Problem Description:
Recently Vasya got interested in finding extra-terrestrial intelligence. He made a simple extra-terrestrial signalsβ receiver and was keeping a record of the signals for *n* days in a row. Each of those *n* da... | 2,354 |
Title: Dima and Lisa
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Dima loves representing an odd number as the sum of multiple primes, and Lisa loves it when there are at most three primes. Help them to represent the given number as the sum of at most than three primes.
More formally, ... | 2,355 |
Title: Permutation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A permutation *p* is an ordered group of numbers *p*1,<=<=<=*p*2,<=<=<=...,<=<=<=*p**n*, consisting of *n* distinct positive integers, each is no more than *n*. We'll define number *n* as the length of permutation *p*1,<=<=... | 2,356 |
Title: Giving Awards
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The employees of the R1 company often spend time together: they watch football, they go camping, they solve contests. So, it's no big deal that sometimes someone pays for someone else.
Today is the day of giving out mone... | 2,357 |
Title: Mahmoud and Ehab and another array construction task
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mahmoud has an array *a* consisting of *n* integers. He asked Ehab to find another array *b* of the same length such that:
- *b* is lexicographically greater than or equal to *a*. ... | 2,358 |
Title: Ice Skating
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed tha... | 2,359 |
Title: Heroes of Making Magic III
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Iβm strolling on sunshine, yeah-ah! And doesnβt it feel good! Well, it certainly feels good for our Heroes of Making Magic, who are casually walking on a one-directional road, fighting imps. Imps are weak and... | 2,360 |
Title: Store
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Natasha was already going to fly back to Earth when she remembered that she needs to go to the Martian store to buy Martian souvenirs for her friends.
It is known, that the Martian year lasts $x_{max}$ months, month lasts $y_{ma... | 2,361 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her *t* queries, each of one of the following type:
1. <=+<= *a**i*Β β add no... | 2,362 |
Title: Trading Business
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
To get money for a new aeonic blaster, ranger Qwerty decided to engage in trade for a while. He wants to buy some number of items (or probably not to buy anything at all) on one of the planets, and then sell the bought... | 2,363 |
Title: Greg and Graph
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Greg has a weighed directed graph, consisting of *n* vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game... | 2,364 |
Title: Battleship
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Arkady is playing Battleship. The rules of this game aren't really important.
There is a field of $n \times n$ cells. There should be exactly one $k$-decker on the field, i.Β e. a ship that is $k$ cells long oriented either ... | 2,365 |
Title: Alyona and flowers
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Alyona is celebrating Happy Birthday! Her mother has an array of *n* flowers. Each flower has some mood, the mood of *i*-th flower is *a**i*. The mood can be positive, zero or negative.
Let's define a subarra... | 2,366 |
Title: Product transformation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Consider an array *A* with *N* elements, all being the same integer *a*.
Define the product transformation as a simultaneous update *A**i*<==<=*A**i*Β·*A**i*<=+<=1, that is multiplying each element to the element... | 2,367 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
DZY loves Physics, and he enjoys calculating density.
Almost everything has density, even a graph. We define the density of a non-directed graph (nodes and edges of the graph have some values) as follows:
Once DZY got a graph *... | 2,368 |
Title: Rewards
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Bizon the Champion is called the Champion for a reason.
Bizon the Champion has recently got a present β a new glass cupboard with *n* shelves and he decided to put all his presents there. All the presents can be divided into ... | 2,369 |
Title: Making a String
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an alphabet consisting of *n* letters, your task is to make a string of the maximum possible length so that the following conditions are satisfied:
- the *i*-th letter occurs in the string no more than ... | 2,370 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Jeff has become friends with Furik. Now these two are going to play one quite amusing game.
At the beginning of the game Jeff takes a piece of paper and writes down a permutation consisting of *n* numbers: *p*1, *p*2, ..., *p**n*... | 2,371 |
Title: One Occurrence
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You are given an array $a$ consisting of $n$ integers, and $q$ queries to it. $i$-th query is denoted by two integers $l_i$ and $r_i$. For each query, you have to find any integer that occurs exactly once in the subarray... | 2,372 |
Title: Python Indentation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
In Python, code blocks don't have explicit begin/end or curly braces to mark beginning and end of the block. Instead, code blocks are defined by indentation.
We will consider an extremely simplified subset of Python... | 2,373 |
Title: Tree Folding
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Vanya wants to minimize a tree. He can perform the following operation multiple times: choose a vertex *v*, and two disjoint (except for *v*) paths of equal length *a*0<==<=*v*, *a*1, ..., *a**k*, and *b*0<==<=*v*, *b*1, .... | 2,374 |
Title: Design Tutorial: Learn from a Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
One way to create task is to learn from game. You should pick a game and focus on part of the mechanic of that game, then it might be a good task.
Let's have a try. Puzzle and Dragon was a popular ga... | 2,375 |
Title: Masha and Bears
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. Also, mother bear can climb into the middle car and she likes it. Moreover, son b... | 2,376 |
Title: Zebra Tower
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Little Janet likes playing with cubes. Actually, she likes to play with anything whatsoever, cubes or tesseracts, as long as they are multicolored. Each cube is described by two parameters β color *c**i* and size *s**i*. A ... | 2,377 |
Title: Triangles
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Alice and Bob don't play games anymore. Now they study properties of all sorts of graphs together. Alice invented the following task: she takes a complete undirected graph with *n* vertices, chooses some *m* edges and keeps t... | 2,378 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
An atom of element X can exist in *n* distinct states with energies *E*1<=<<=*E*2<=<<=...<=<<=*E**n*. Arkady wants to build a laser on this element, using a three-level scheme. Here is a simplified description of the sche... | 2,379 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Let's define the permutation of length *n* as an array *p*<==<=[*p*1,<=*p*2,<=...,<=*p**n*] consisting of *n* distinct integers from range from 1 to *n*. We say that this permutation maps value 1 into the value *p*1, value 2 into ... | 2,380 |
Title: Series of Crimes
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Berland capital is shaken with three bold crimes committed by the Pihsters, a notorious criminal gang.
The Berland capital's map is represented by an *n*<=Γ<=*m* rectangular table. Each cell of the table on the ma... | 2,381 |
Title: Desk Disorder
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
A new set of desks just arrived, and it's about time! Things were getting quite cramped in the office. You've been put in charge of creating a new seating chart for the engineers. The desks are numbered, and you sent out ... | 2,382 |
Title: MUH and House of Cards
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of *n* playing cards. Let's ... | 2,383 |
Title: Sereja and Straight Lines
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Sereja placed *n* points on a plane. Now Sereja wants to place on the plane two straight lines, intersecting at a right angle, so that one of the straight lines intersect the *Ox* axis at an angle of 45 degree... | 2,384 |
Title: Winning Strategy
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
One university has just found out about a sport programming contest called ACM ICPC v2.0. This contest doesn't differ much from the well-known ACM ICPC, for example, the participants are not allowed to take part in the fin... | 2,385 |
Title: Safe cracking
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Right now you are to solve a very, very simple problem β to crack the safe. Four positive integers stand one by one on a circle protecting the safe. You know that to unlock this striking safe you have to make all four numbers... | 2,386 |
Title: Petya and Inequiations
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
Little Petya loves inequations. Help him find *n* positive integers *a*1,<=*a*2,<=...,<=*a**n*, such that the following two conditions are satisfied:
- *a*12<=+<=*a*22<=+<=...<=+<=*a**n*2<=β₯<=*x*- *a*1<=+<=*a*2<=+<... | 2,387 |
Title: Ball Game
Time Limit: 2 seconds
Memory Limit: 256 megabytes
Problem Description:
A kindergarten teacher Natalia Pavlovna has invented a new ball game. This game not only develops the children's physique, but also teaches them how to count.
The game goes as follows. Kids stand in circle. Let's agree to think... | 2,388 |
Title: Ciel and Duel
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Fox Ciel is playing a card game with her friend Jiro.
Jiro has *n* cards, each one has two attributes: *position* (Attack or Defense) and *strength*. Fox Ciel has *m* cards, each one has these two attributes too. It's kn... | 2,389 |
Title: Mishka and Game
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Mishka is a little polar bear. As known, little bears loves spending their free time playing dice for chocolates. Once in a wonderful sunny morning, walking around blocks of ice, Mishka met her friend Chris, and they st... | 2,390 |
Title: Appleman and a Sheet of Paper
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Appleman has a very big sheet of paper. This sheet has a form of rectangle with dimensions 1<=Γ<=*n*. Your task is help Appleman with folding of such a sheet. Actually, you need to perform *q* queries. Eac... | 2,391 |
Title: none
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
You've got a string $a_1, a_2, \dots, a_n$, consisting of zeros and ones.
Let's call a sequence of consecutive elements $a_i, a_{i<=+<=1}, \ldots,<=a_j$ ($1\leq<=i\leq<=j\leq<=n$) a substring of string $a$.
You can apply the fo... | 2,392 |
Title: Little Elephant and Function
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Little Elephant enjoys recursive functions.
This time he enjoys the sorting function. Let *a* is a permutation of an integers from 1 to *n*, inclusive, and *a**i* denotes the *i*-th element of the perm... | 2,393 |
Title: Buttons
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Manao is trying to open a rather challenging lock. The lock has *n* buttons on it and to open it, you should press the buttons in a certain order to open the lock. When you push some button, it either stays pressed into the loc... | 2,394 |
Title: Little Elephant and Inversions
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
The Little Elephant has array *a*, consisting of *n* positive integers, indexed from 1 to *n*. Let's denote the number with index *i* as *a**i*.
The Little Elephant wants to count, how many pairs of inte... | 2,395 |
Title: Level Generation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Ivan is developing his own computer game. Now he tries to create some levels for his game. But firstly for each level he needs to draw a graph representing the structure of the level.
Ivan decided that there should be... | 2,396 |
Title: Palindrome Transformation
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
Nam is playing with a string on his computer. The string consists of *n* lowercase English letters. It is meaningless, so Nam decided to make the string more beautiful, that is to make it be a palindrome by us... | 2,397 |
Title: Between the Offices
Time Limit: None seconds
Memory Limit: None megabytes
Problem Description:
As you may know, MemSQL has American offices in both San Francisco and Seattle. Being a manager in the company, you travel a lot between the two cities, always by plane.
You prefer flying from Seattle to San Franci... | 2,398 |
Title: Snow sellers
Time Limit: 10 seconds
Memory Limit: 256 megabytes
Problem Description:
The New Year celebrations in Berland last *n* days. Only this year the winter is snowless, thatβs why the winter celebrationsβ organizers should buy artificial snow. There are *m* snow selling companies in Berland. Every day ... | 2,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.