problem_statement stringlengths 147 8.53k | input stringlengths 1 771 | output stringlengths 1 592 ⌀ | time_limit stringclasses 32
values | memory_limit stringclasses 21
values | tags stringlengths 6 168 |
|---|---|---|---|---|---|
D. How many trees?time limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputIn one very old text file there was written Great Wisdom. This Wisdom was so Great that nobody could decipher it, even Phong — the oldest among the inhabitants of Mainframe. But still he managed to get ... | Input3 2 | Output5 | 1 second | 64 megabytes | ['combinatorics', 'divide and conquer', 'dp', '*1900'] |
C. Hexadecimal's Numberstime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputOne beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of ... | Input10 | Output2 | 1 second | 64 megabytes | ['brute force', 'implementation', 'math', '*1200'] |
B. Running Studenttime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputAnd again a misfortune fell on Poor Student. He is being late for an exam.Having rushed to a bus stop that is in point (0, 0), he got on a minibus and they drove along a straight line, parallel to axis ... | Input4 5 20 2 4 64 1 | Output3 | 1 second | 64 megabytes | ['brute force', 'geometry', 'implementation', '*1200'] |
A. Die Rolltime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputYakko, Wakko and Dot, world-famous animaniacs, decided to rest from acting in cartoons, and take a leave to travel a bit. Yakko dreamt to go to Pennsylvania, his Motherland and the Motherland of his ancestors.... | Input4 2 | Output1/2 | 1 second | 64 megabytes | ['math', 'probabilities', '*800'] |
E. Beadstime limit per test5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputOne Martian boy called Zorg wants to present a string of beads to his friend from the Earth — Masha. He knows that Masha likes two colours: blue and red, — and right in the shop where he has come, there is a var... | Input4 4 | Output0101 | 5 seconds | 64 megabytes | ['dp', 'graphs', '*2600'] |
D. Two Friendstime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputTwo neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. Once they went to the cinema, and the... | Input0 20 04 0-3 0 | Output1.0000000000 | 1 second | 64 megabytes | ['binary search', 'geometry', '*2600'] |
C. Looking for Ordertime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGirl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess — all the objects from her handb... | Input0 021 1-1 1 | Output80 1 2 0 | 4 seconds | 512 megabytes | ['bitmasks', 'dp', '*2000'] |
B. Obsession with Robotstime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThe whole world got obsessed with robots,and to keep pace with the progress, great Berland's programmer Draude decided to build his own robot. He was working hard at the robot. He taught it to wa... | InputLLUUUR | OutputOK | 2 seconds | 64 megabytes | ['constructive algorithms', 'graphs', 'implementation', '*1400'] |
A. Train and Petertime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputPeter likes to travel by train. He likes it so much that on the train he falls asleep. Once in summer Peter was going by train from city A to city B, and as usual, was sleeping. Then he woke up, started... | Inputatobab | Outputforward | 1 second | 64 megabytes | ['strings', '*1200'] |
E. Defining Macrostime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMost C/C++ programmers know about excellent opportunities that preprocessor #define directives give; but many know as well about the problems that can arise because of their careless use.In this probl... | Input1#define sum x + y1 * sum | OutputSuspicious | 3 seconds | 256 megabytes | ['dp', 'expression parsing', 'implementation', '*2600'] |
D. Palindrome Degreetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputString s of length n is called k-palindrome, if it is a palindrome itself, and its prefix and suffix of length are (k - 1)-palindromes. By definition, any string (even empty) is 0-palindrome.Let's c... | Inputa2A | Output1 | 1 second | 256 megabytes | ['hashing', 'strings', '*2200'] |
C. Linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·1018 inclusive, or to find out that such points d... | Input2 5 3 | Output6 -3 | 1 second | 256 megabytes | ['math', 'number theory', '*1800'] |
B. Memory Managertime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere is little time left before the release of the first national operating system BerlOS. Some of its components are not finished yet — the memory manager is among them. According to the developers' pl... | Input6 10alloc 5alloc 3erase 1alloc 6defragmentalloc 6 | Output12NULL3 | 1 second | 64 megabytes | ['implementation', '*1600'] |
A. Kalevitch and Chesstime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputA famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotono... | InputWWWBWWBWBBBBBBBBWWWBWWBWWWWBWWBWWWWBWWBWWWWBWWBWWWWBWWBWWWWBWWBW | Output3 | 2 seconds | 64 megabytes | ['brute force', 'constructive algorithms', '*1100'] |
E. Expositiontime limit per test1.5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library decided to make an exposition of the works of this famous science-ficti... | Input3 314 12 10 | Output2 21 22 3 | 1.5 seconds | 64 megabytes | ['binary search', 'data structures', 'dsu', 'trees', 'two pointers', '*1900'] |
D. Lizards and Basements 2time limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThis is simplified version of the problem used on the original contest. The original problem seems to have too difiicult solution. The constraints for input data have been reduced.Polycarp like... | Input3 2 12 2 2 | Output32 2 2 | 2 seconds | 64 megabytes | ['brute force', 'dp', '*2600'] |
C. Alice, Bob and Chocolatetime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputAlice and Bob like games. And now they are ready to start a new game. They have placed n chocolate bars in a line. Alice starts to eat chocolate bars one by one from left to right, and Bob — f... | Input52 9 8 2 7 | Output2 3 | 2 seconds | 64 megabytes | ['greedy', 'two pointers', '*1200'] |
B. President's Officetime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputPresident of Berland has a very vast office-room, where, apart from him, work his subordinates. Each subordinate, as well as President himself, has his own desk of a unique colour. Each desk is rect... | Input3 4 RG.B..RR.TTT. | Output2 | 2 seconds | 64 megabytes | ['implementation', '*1100'] |
A. Triangletime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputJohnny has a younger sister Anne, who is very clever and smart. As she came home from the kindergarten, she told his brother about the task that her kindergartener asked her to solve. The task was just to con... | Input4 2 1 3 | OutputTRIANGLE | 2 seconds | 64 megabytes | ['brute force', 'geometry', '*900'] |
E. Bindian Signalizingtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEveryone knows that long ago on the territory of present-day Berland there lived Bindian tribes. Their capital was surrounded by n hills, forming a circle. On each hill there was a watchman, who w... | Input51 2 4 5 3 | Output7 | 4 seconds | 256 megabytes | ['data structures', '*2400'] |
D. Follow Traffic Rulestime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputEverybody knows that the capital of Berland is connected to Bercouver (the Olympic capital) by a direct road. To improve the road's traffic capacity, there was placed just one traffic sign, limitin... | Input1 12 1 3 | Output2.500000000000 | 1 second | 64 megabytes | ['implementation', 'math', '*2100'] |
C. Longest Regular Bracket Sequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is yet another problem dealing with regular bracket sequences.We should remind you that a bracket sequence is called regular, if by inserting «+» and «1» into it we can get a cor... | Input)((())))(()()) | Output6 2 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'dp', 'greedy', 'sortings', 'strings', '*1900'] |
B. Center Alignmenttime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputAlmost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release... | InputThis isCodeforcesBetaRound5 | Output************* This is ** **Codeforces** Beta ** Round ** 5 ************* | 1 second | 64 megabytes | ['implementation', 'strings', '*1200'] |
A. Chat Server's Outgoing Traffictime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputPolycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has sp... | Input+MikeMike:hello+Kate+Dmitry-DmitryKate:hi-Kate | Output9 | 1 second | 64 megabytes | ['implementation', '*1000'] |
D. Mysterious Presenttime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputPeter 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 = ... | Input2 1 12 22 2 | Output11 | 1 second | 64 megabytes | ['dp', 'sortings', '*1700'] |
C. Registration systemtime limit per test5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputA new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. Yo... | Input4abacabaacabaabacabaacab | OutputOKOKabacaba1OK | 5 seconds | 64 megabytes | ['data structures', 'hashing', 'implementation', '*1300'] |
B. Before an Examtime limit per test0.5 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputTomorrow Peter has a Biology exam. He does not like this subject much, but d days ago he learnt that he would have to take this exam. Peter's strict parents made him prepare for the exam immediately, f... | Input1 485 7 | OutputNO | 0.5 second | 64 megabytes | ['constructive algorithms', 'greedy', '*1200'] |
A. Watermelontime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputOne hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that the watermelon was weighed, and the scales showed w kilos. Th... | Input8 | OutputYES | 1 second | 64 megabytes | ['brute force', 'math', '*800'] |
D. Least Cost Bracket Sequencetime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThis is yet another problem on regular bracket sequences.A bracket sequence is called regular, if by inserting "+" and "1" into it we get a correct mathematical expression. For example, sequ... | Input(??)1 22 8 | Output4()() | 1 second | 64 megabytes | ['greedy', '*2600'] |
C. Tic-tac-toetime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputCertainly, everyone is familiar with tic-tac-toe game. The rules are very simple indeed. Two players take turns marking the cells in a 3 × 3 grid (one player always draws crosses, the other — noughts). The ... | InputX0X.0..X. | Outputsecond | 1 second | 64 megabytes | ['brute force', 'games', 'implementation', '*1800'] |
B. Lorrytime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputA group of tourists is going to kayak and catamaran tour. A rented lorry has arrived to the boat depot to take kayaks and catamarans to the point of departure. It's known that all kayaks are of the same size (an... | Input3 21 22 71 3 | Output72 | 2 seconds | 64 megabytes | ['greedy', 'sortings', '*1900'] |
A. Shortest path of the kingtime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThe king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, because he has business of national importance. For example, he has to pay an official visit to sq... | Inputa8h1 | Output7RDRDRDRDRDRDRD | 1 second | 64 megabytes | ['greedy', 'shortest paths', '*1000'] |
C. Commentator problemtime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThe Olympic Games in Bercouver are in full swing now. Here everyone has their own objectives: sportsmen compete for medals, and sport commentators compete for more convenient positions to give a run... | Input0 0 1060 0 1030 30 10 | Output30.00000 0.00000 | 1 second | 64 megabytes | ['geometry', '*2600'] |
B. The least round waytime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere is a square matrix n × n, consisting of non-negative integer numbers. You should find such a way on it that starts in the upper left cell of the matrix; each following cell is to the right... | Input31 2 34 5 67 8 9 | Output0DDRR | 2 seconds | 64 megabytes | ['dp', 'math', '*2000'] |
A. Winnertime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThe winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner.... | Input3mike 3andrew 5mike 2 | Outputandrew | 1 second | 64 megabytes | ['hashing', 'implementation', '*1500'] |
C. Ancient Berland Circustime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputNowadays all circuses in Berland have a round arena with diameter 13 meters, but in the past things were different.In Ancient Berland arenas in circuses were shaped as a regular (equiangular) po... | Input0.000000 0.0000001.000000 1.0000000.000000 1.000000 | Output1.00000000 | 2 seconds | 64 megabytes | ['geometry', 'math', '*2100'] |
B. Spreadsheetstime limit per test10 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputIn the popular spreadsheets systems (for example, in Excel) the following numeration of columns is used. The first column has number A, the second — number B, etc. till column 26 that is marked by Z. The... | Input2R23C55BC23 | OutputBC23R23C55 | 10 seconds | 64 megabytes | ['implementation', 'math', '*1600'] |
A. Theatre Squaretime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTheatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite f... | Input6 6 4 | Output4 | 1 second | 256 megabytes | ['math', '*1000'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.