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 |
|---|---|---|---|---|---|
B. String inside outtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string S of even length s1..s2n . Perform the following manipulations: divide it into two halves s1..sn and snβ+β1..s2n reverse each of them sn..s1 and s2n..snβ+β1 concatenate the re... | Inputcodeforces | Outputfedocsecro | 2 seconds | 256 megabytes | ['*special problem', '*1600'] |
A. Quadratic equationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a quadratic equation with integer coefficients Aβ*βX2β+βBβ*βXβ+βCβ=β0. It is guaranteed that Aββ β0 and that the equation has at least one real root. Output the roots of the equation.I... | Input1 -2 1 | Output1 | 2 seconds | 256 megabytes | ['*special problem', '*1500'] |
B. Group Photo 2 (online mirror version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMany years have passed, and n friends met at a party again. Technologies have leaped forward since the last meeting, cameras with timer appeared and now it is not obligatory for ... | Input310 120 230 3 | Output180 | 2 seconds | 256 megabytes | ['brute force', 'greedy', 'sortings', '*1900'] |
D. Fuzzy Searchtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeonid works for a small and promising start-up that works on decoding the human genome. His duties include solving complex problems of finding certain patterns in long strings consisting of letters 'A',... | Input10 4 1AGCAATTCATACAT | Output3 | 3 seconds | 256 megabytes | ['bitmasks', 'brute force', 'fft', '*2500'] |
E. Data Center Dramatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe project of a data center of a Big Software Company consists of n computers connected by m cables. Simply speaking, each computer can be considered as a box with multiple cables going out of the ... | Input4 61 22 33 44 11 31 3 | Output61 23 41 43 21 31 3 | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', '*2600'] |
D. Clique Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vert... | Input42 33 16 10 2 | Output3 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'greedy', 'implementation', 'sortings', '*1800'] |
C. Glass Carvingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLeonid 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 enth... | Input4 3 4H 2V 2V 3V 1 | Output8442 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'implementation', '*1500'] |
B. Error Correct Systemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFord Prefect got a job as a web developer for a small company that makes towels. His current work task is to create a search engine for the website of the company. During the development process,... | Input9pergamentpermanent | Output14 6 | 2 seconds | 256 megabytes | ['greedy', '*1500'] |
A. Playing with Papertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Vasya was sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm βΓβ b mm sheet of paper (aβ>βb). Usually the first step in making an origami is making a... | Input2 1 | Output2 | 2 seconds | 256 megabytes | ['implementation', 'math', '*1100'] |
G. Spiders Evil Plantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSpiders 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 tra... | Input6 31 2 22 3 23 4 24 6 13 5 103 12 51 1 | Output141317 | 1 second | 256 megabytes | ['greedy', 'trees', '*3300'] |
F. Pudding Monsterstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you will meet the simplified model of game Pudding Monsters.An important process in developing any game is creating levels. A game field in Pudding Monsters is an nβΓβn rectangular gr... | Input51 14 33 22 45 5 | Output10 | 2 seconds | 256 megabytes | ['data structures', 'divide and conquer', '*3000'] |
E. Transmitting Levelstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOptimizing the amount of data transmitted via a network is an important and interesting part of developing any network application. In one secret game developed deep in the ZeptoLab company, the ... | Input6 32 4 2 1 3 2746 | Output243 | 3 seconds | 256 megabytes | ['dp', 'implementation', '*2400'] |
D. Om Nom and Necklacetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Om Nom found a thread with n beads of different colors. He decided to cut the first several beads from this thread to make a bead necklace and present it to his girlfriend Om Nelly. Om Nom... | Input7 2bcabcab | Output0000011 | 1 second | 256 megabytes | ['hashing', 'string suffix structures', 'strings', '*2200'] |
C. Om Nom and Candiestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed wi... | Input10 3 5 2 3 | Output16 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*2000'] |
B. Om Nom and Dark Parktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOm Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scare even some... | Input21 2 3 4 5 6 | Output5 | 1 second | 256 megabytes | ['dfs and similar', 'greedy', 'implementation', '*1400'] |
A. King of Thievestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn 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... | Input16.**.*..*.***.**. | Outputyes | 1 second | 256 megabytes | ['brute force', 'implementation', '*1300'] |
E. Anya and Cubestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya loves to fold and stick. Today she decided to do just that.Anya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k sticke... | Input2 2 304 3 | Output1 | 2 seconds | 256 megabytes | ['binary search', 'bitmasks', 'brute force', 'dp', 'math', 'meet-in-the-middle', '*2100'] |
D. Arthur and Wallstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFinally it is a day when Arthur has enough money for buying an apartment. He found a great option close to the center of the city with a nice price.Plan of the apartment found by Arthur looks like a ... | Input5 5.*.*.*****.*.*.*****.*.*. | Output.*.*.*****.*.*.*****.*.*. | 2 seconds | 512 megabytes | ['constructive algorithms', 'data structures', 'graphs', 'greedy', 'shortest paths', '*2400'] |
C. Ilya and Stickstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the evening, after the contest Ilya was bored, and he really felt like maximizing. He remembered that he had a set of n sticks and an instrument. Each stick is characterized by its length li.Ilya d... | Input42 4 4 2 | Output8 | 2 seconds | 256 megabytes | ['greedy', 'math', 'sortings', '*1600'] |
B. Pasha and Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length ... | Inputabcdef12 | Outputaedcbf | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'math', 'strings', '*1400'] |
A. Vitaliy and Pietime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter a hard day Vitaly got very hungry and he wants to eat his favorite potato pie. But it's not that simple. Vitaly is in the first room of the house with n room located in a line and numbered start... | Input3aAbB | Output0 | 2 seconds | 256 megabytes | ['greedy', 'hashing', 'strings', '*1100'] |
F. And Yet Another Bracket Sequencetime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus has a finite sequence of opening and closing brackets. In order not to fall asleep in a lecture, Polycarpus is having fun with his sequence. He is able to perform two opera... | Input()(()) | Output(())() | 5 seconds | 256 megabytes | ['data structures', 'greedy', 'hashing', 'string suffix structures', 'strings', '*2700'] |
E. Rooks and Rectanglestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus has a chessboard of size nβΓβm, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game he will play. However, he has already allocated q rectangular areas of sp... | Input4 3 3 31 13 22 32 3 2 32 1 3 31 2 2 3 | OutputYESYESNO | 2 seconds | 256 megabytes | ['data structures', 'sortings', '*2400'] |
D. Social Networktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarpus 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 inform... | Input4 2 1017:05:5317:05:5817:06:0122:39:47 | Output31223 | 2 seconds | 256 megabytes | ['greedy', 'two pointers', '*2100'] |
C. The Art of Dealing with ATMtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device tha... | Input6 2010 50 100 500 1000 5000842001000009500096000990001010020159950 | Output6201920-13-1-1 | 2 seconds | 256 megabytes | ['binary search', 'sortings', '*1900'] |
B. Π€ΠΎΡΠΎ Π½Π° ΠΏΠ°ΠΌΡΡΡ - 2 (round version)ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ Π½Π° ΡΠ΅ΡΡ2 ΡΠ΅ΠΊΡΠ½Π΄ΡΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΏΠ°ΠΌΡΡΠΈ Π½Π° ΡΠ΅ΡΡ256 ΠΌΠ΅Π³Π°Π±Π°ΠΉΡΠ²Π²ΠΎΠ΄ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΡΠΉ Π²Π²ΠΎΠ΄Π²ΡΠ²ΠΎΠ΄ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΡΠΉ Π²ΡΠ²ΠΎΠ΄ΠΡΠΎΡΠ»ΠΎ ΠΌΠ½ΠΎΠ³ΠΎ Π»Π΅Ρ, ΠΈ Π½Π° Π²Π΅ΡΠ΅ΡΠΈΠ½ΠΊΠ΅ ΡΠ½ΠΎΠ²Π° Π²ΡΡΡΠ΅ΡΠΈΠ»ΠΈΡΡ n Π΄ΡΡΠ·Π΅ΠΉ. Π‘ ΠΌΠΎΠΌΠ΅Π½ΡΠ° ΠΏΠΎΡΠ»Π΅Π΄Π½Π΅ΠΉ Π²ΡΡΡΠ΅ΡΠΈ ΡΠ΅Ρ
Π½ΠΈΠΊΠ° ΡΠ°Π³Π½ΡΠ»Π° Π΄Π°Π»Π΅ΠΊΠΎ Π²ΠΏΠ΅ΡΡΠ΄, ΠΏΠΎΡΠ²ΠΈΠ»ΠΈΡΡ ΡΠΎΡΠΎΠ°ΠΏΠΏΠ°ΡΠ°ΡΡ Ρ Π°Π²ΡΠΎΡΠΏΡΡΠΊΠΎΠΌ, ΠΈ Ρ... | ΠΡ
ΠΎΠ΄Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅310 120 230 3 | ΠΡΡ
ΠΎΠ΄Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅180 | ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ Π½Π° ΡΠ΅ΡΡ2 ΡΠ΅ΠΊΡΠ½Π΄Ρ | ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΏΠ°ΠΌΡΡΠΈ Π½Π° ΡΠ΅ΡΡ256 ΠΌΠ΅Π³Π°Π±Π°ΠΉΡ | ['dp', 'greedy', '*1700'] |
A. ΠΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ, Π²Ρ Π·Π½Π°Π΅ΡΠ΅ ΡΡΠΈΡ
Π»ΡΠ΄Π΅ΠΉ?ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ Π½Π° ΡΠ΅ΡΡ2 ΡΠ΅ΠΊΡΠ½Π΄ΡΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΏΠ°ΠΌΡΡΠΈ Π½Π° ΡΠ΅ΡΡ256 ΠΌΠ΅Π³Π°Π±Π°ΠΉΡΠ²Π²ΠΎΠ΄ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΡΠΉ Π²Π²ΠΎΠ΄Π²ΡΠ²ΠΎΠ΄ΡΡΠ°Π½Π΄Π°ΡΡΠ½ΡΠΉ Π²ΡΠ²ΠΎΠ΄ΠΡΠ½ΠΎΠ²ΠΎΠΉ Π»ΡΠ±ΠΎΠΉ ΡΠΎΡΠΈΠ°Π»ΡΠ½ΠΎΠΉ ΡΠ΅ΡΠΈ ΡΠ²Π»ΡΠ΅ΡΡΡ ΠΎΡΠ½ΠΎΡΠ΅Π½ΠΈΠ΅ Π΄ΡΡΠΆΠ±Ρ ΠΌΠ΅ΠΆΠ΄Ρ Π΄Π²ΡΠΌΡ ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΠΌΠΈ Π² ΡΠΎΠΌ ΠΈΠ»ΠΈ ΠΈΠ½ΠΎΠΌ ΡΠΌΡΡΠ»Π΅. Π ΠΎΠ΄Π½ΠΎΠΉ ΠΈΠ·Π²Π΅ΡΡΠ½ΠΎΠΉ ΡΠΎΡΠΈΠ°Π»ΡΠ½ΠΎΠΉ ΡΠ΅ΡΠΈ Π΄ΡΡΠΆΠ±Π° ΡΠΈΠΌΠΌΠ΅ΡΡΠΈΡΠ½Π°, ΡΠΎ Π΅... | ΠΡ
ΠΎΠ΄Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅5 5110 2323 4239 4210 3939 58 | ΠΡΡ
ΠΎΠ΄Π½ΡΠ΅ Π΄Π°Π½Π½ΡΠ΅10: 1 4223: 1 3939: 1 2342: 1 1058: 2 10 42 | ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ Π²ΡΠ΅ΠΌΠ΅Π½ΠΈ Π½Π° ΡΠ΅ΡΡ2 ΡΠ΅ΠΊΡΠ½Π΄Ρ | ΠΎΠ³ΡΠ°Π½ΠΈΡΠ΅Π½ΠΈΠ΅ ΠΏΠΎ ΠΏΠ°ΠΌΡΡΠΈ Π½Π° ΡΠ΅ΡΡ256 ΠΌΠ΅Π³Π°Π±Π°ΠΉΡ | ['implementation', '*1600'] |
D. Statistics of Recompressing Videostime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA social network for dogs called DH (DogHouse) has k special servers to recompress uploaded videos of cute cats. After each video is uploaded, it should be recompressed on one (any)... | Input3 21 52 53 5 | Output6711 | 3 seconds | 256 megabytes | ['*special problem', 'data structures', 'implementation', '*1600'] |
C. Name Questtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA Martian boy is named s β he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from so... | Inputababaobababbah | Output2 | 2 seconds | 256 megabytes | ['*special problem', 'greedy', '*1400'] |
B. Mean Requeststime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem you will have to deal with a real algorithm that is used in the VK social network.As in any other company that creates high-loaded websites, the VK developers have to deal with request s... | Input1 1 2.000000111 | Output1.000000 0.500000 0.500000 | 4 seconds | 256 megabytes | ['*special problem', 'implementation', '*1500'] |
A. Rotate, Flip and Zoomtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is writing the prototype of a graphic editor. He has already made up his mind that the basic image transformations in his editor will be: rotate the image 90 degrees clockwise, flip the... | Input3 2.*..*. | Output........********........ | 2 seconds | 256 megabytes | ['*special problem', 'implementation', '*1200'] |
D. Closest Equalstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given sequence a1,βa2,β...,βan and m queries lj,βrj (1ββ€βljββ€βrjββ€βn). For each query you need to print the minimum distance between such pair of elements ax and ay (xββ βy), that: both indexes... | Input5 31 1 2 3 21 52 43 5 | Output1-12 | 3 seconds | 256 megabytes | ['*special problem', 'data structures', '*2000'] |
C. Chicken or Fish?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is flying in the airplane. Finally, it is his favorite time β the lunchtime. The BerAvia company stewardess is giving food consecutively to all the passengers from the 1-th one to the last on... | Input23 42 3 2 11 00 05 51 2 1 3 13 00 02 14 0 | OutputYNNYYYYNY | 1 second | 256 megabytes | ['greedy', '*2100'] |
B. Photo to Remembertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together. Simply speaking, the process of taking photos can be described as fo... | Input31 105 510 1 | Output75 110 60 | 2 seconds | 256 megabytes | ['*special problem', 'data structures', 'dp', 'implementation', '*1100'] |
A. Repoststime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friends started reposting Polycarp's joke to their news feed. Some of them reposted the r... | Input5tourist reposted PolycarpPetr reposted TouristWJMZBMR reposted Petrsdya reposted wjmzbmrvepifanov reposted sdya | Output6 | 1 second | 256 megabytes | ['*special problem', 'dfs and similar', 'dp', 'graphs', 'trees', '*1200'] |
E. Cycling Citytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are organizing a cycling race on the streets of the city. The city contains n junctions, some pairs of them are connected by roads; on each road you can move in any direction. No two roads connect th... | Input4 41 22 33 44 1 | OutputNO | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', '*3100'] |
D. Shoptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya plays one very well-known and extremely popular MMORPG game. His game character has k skill; currently the i-th of them equals to ai. Also this game has a common rating table in which the participants are ... | Input2 4 313 201 1 141 2 302 1 63 2 2 | Output32 3 4 | 2 seconds | 256 megabytes | ['greedy', '*2800'] |
E. Pluses everywheretime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is sitting on an extremely boring math class. To have fun, he took a piece of paper and wrote out n numbers on a single line. After that, Vasya began to write out different ways to put pluses ... | Input3 1108 | Output27 | 3 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', 'number theory', '*2200'] |
D. Cubestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce Vasya and Petya assembled a figure of m cubes, each of them is associated with a number between 0 and mβ-β1 (inclusive, each number appeared exactly once). Let's consider a coordinate system such that the ... | Input32 11 00 1 | Output19 | 3 seconds | 256 megabytes | ['games', 'greedy', 'implementation', '*2100'] |
C. DNA Alignmenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya became interested in bioinformatics. He's going to write an article about similar cyclic DNA sequences, so he invented a new method for determining the similarity of cyclic sequences.Let's assume ... | Input1C | Output1 | 2 seconds | 256 megabytes | ['math', 'strings', '*1500'] |
B. Two Buttonstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya has found a strange device. On the front panel of a device there are: a red button, a blue button and a display showing some positive integer. After clicking the red button, device multiplies the di... | Input4 6 | Output2 | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'greedy', 'implementation', 'math', 'shortest paths', '*1400'] |
A. Pangramtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangrams are often used to demonstrate fonts in printing or test th... | Input12toosmallword | OutputNO | 2 seconds | 256 megabytes | ['implementation', 'strings', '*800'] |
E. A and B and Lecture Roomstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.The University where A and B study is a set of rooms connected by corridors. Overall, the University has n rooms connected by nβ-β1 ... | Input41 21 32 412 3 | Output1 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'dfs and similar', 'dp', 'trees', '*2100'] |
D. A and B and Interesting Substringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.After several years of doing sports programming and solving many problems that require calculating all sorts of abstract ob... | Input1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 8 1 1 1 1 1 1xabcab | Output2 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'two pointers', '*1800'] |
C. A and B and Team Trainingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.An important part of preparing for a competition is sharing programming knowledge from the experienced members to those who are just ... | Input2 6 | Output2 | 1 second | 256 megabytes | ['greedy', 'implementation', 'math', 'number theory', '*1300'] |
B. A and B and Compilation Errorstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.B loves to debug his code. But before he runs the solution and starts debugging, he has to first compile the code.Initially, th... | Input51 5 8 123 7123 7 5 15 1 7 | Output8123 | 2 seconds | 256 megabytes | ['data structures', 'implementation', 'sortings', '*1100'] |
A. A and B and Chesstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA and B are preparing themselves for programming contests.To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now st... | Input...QK......................................................rk... | OutputWhite | 1 second | 256 megabytes | ['implementation', '*900'] |
F. Pasha and Pipetime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputOn a certain meeting of a ruling party "A" minister Pavel suggested to improve the sewer system and to create a new pipe in the city.The city is an nβΓβm rectangular squared field. Each square of the f... | Input3 3.....#... | Output3 | 4 seconds | 512 megabytes | ['binary search', 'brute force', 'combinatorics', 'dp', 'implementation', '*2300'] |
E. Arthur and Questionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter bracket sequences Arthur took up number theory. He has got a new favorite sequence of length n (a1,βa2,β...,βan), consisting of integers and integer k, not exceeding n.This sequence had the... | Input3 2? 1 2 | Output0 1 2 | 2 seconds | 256 megabytes | ['greedy', 'implementation', 'math', 'ternary search', '*2200'] |
D. Ilya and Escalatortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIlya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. Let's assume that n people stand in the queue for th... | Input1 0.50 1 | Output0.5 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', 'probabilities', '*1700'] |
C. Anya and Smartphonetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya has bought a new smartphone that uses Berdroid operating system. The smartphone menu has exactly n applications, each application has its own icon. The icons are located on different screens, ... | Input8 3 31 2 3 4 5 6 7 87 8 1 | Output7 | 1 second | 256 megabytes | ['constructive algorithms', 'data structures', 'implementation', '*1600'] |
B. Tanya and Postcardtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle Tanya decided to present her dad a postcard on his Birthday. She has already created a message β string s of length n, consisting of uppercase and lowercase English letters. Tanya can't writ... | InputAbCDCbA | Output3 0 | 2 seconds | 256 megabytes | ['greedy', 'implementation', 'strings', '*1400'] |
A. Vitaly and Stringstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVitaly is a diligent student who never missed a lesson in his five years of studying in the university. He always does his homework on time and passes his exams in time. During the last lesson the t... | Inputac | Outputb | 1 second | 256 megabytes | ['constructive algorithms', 'strings', '*1600'] |
E. Drazil and His Happy Friendstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m g... | Input2 301 0 | Output4 | 4 seconds | 256 megabytes | ['math', 'number theory', '*3100'] |
D. Drazil and Morning Exercisetime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil and Varda are the earthworm couple. They want to find a good place to bring up their children. They found a good ground containing nature hole. The hole contains many rooms, some ... | Input51 2 32 3 44 5 33 4 251 2 3 4 5 | Output13335 | 3.5 seconds | 256 megabytes | ['dfs and similar', 'dp', 'dsu', 'trees', 'two pointers', '*2800'] |
E. Drazil and Parktime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDrazil is a monkey. He lives in a circular park. There are n trees around the park. The distance between the i-th tree and (iβ+β1)-st trees is di, the distance between the n-th tree and the first tree... | Input5 32 2 2 2 23 5 2 1 41 32 24 5 | Output121618 | 2 seconds | 512 megabytes | ['data structures', '*2300'] |
D. Drazil and Tilestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil created a following problem about putting 1βΓβ2 tiles into an nβΓβm grid:"There is a grid with some cells that are empty and some cells that are occupied. You should use 1βΓβ2 tiles to cover a... | Input3 3....*.... | OutputNot unique | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', '*2000'] |
C. Drazil and Factorialtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil 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 ... | Input41234 | Output33222 | 2 seconds | 256 megabytes | ['greedy', 'math', 'sortings', '*1400'] |
B. Drazil and His Happy Friendstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan.There are n boys and m g... | Input2 301 0 | OutputYes | 2 seconds | 256 megabytes | ['brute force', 'dsu', 'meet-in-the-middle', 'number theory', '*1300'] |
A. Drazil and Datetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSomeday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0,β0) and Varda's home is located in point (a,βb). In each step, he can mov... | Input5 5 11 | OutputNo | 1 second | 256 megabytes | ['math', '*1000'] |
E. Darth Vader and Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen Darth Vader gets bored, he sits down on the sofa, closes his eyes and thinks of an infinite rooted tree where each node has exactly n sons, at that for each node, the distance between it an ... | Input3 31 2 3 | Output8 | 2 seconds | 256 megabytes | ['dp', 'matrices', '*2200'] |
D. R2D2 and Droid Armytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn army of n droids is lined up in one row. Each droid is described by m integers a1,βa2,β...,βam, where ai is the number of details of the i-th type in this droid's mechanism. R2-D2 wants to dest... | Input5 2 44 01 22 10 21 3 | Output2 2 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'two pointers', '*2000'] |
C. Watto and Mechanismtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWatto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then... | Input2 3aaaaaacacacaaabaaccacacccaaac | OutputYESNONO | 3 seconds | 256 megabytes | ['binary search', 'data structures', 'hashing', 'string suffix structures', 'strings', '*2000'] |
B. Han Solo and Lazer Guntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (x,βy) on this plane. Han Solo... | Input4 0 01 12 22 0-1 -1 | Output2 | 1 second | 256 megabytes | ['brute force', 'data structures', 'geometry', 'implementation', 'math', '*1400'] |
A. ChewbaΡca and Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLuke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means replacing it with digit 9β-βt. Help Chewbacca to t... | Input27 | Output22 | 1 second | 256 megabytes | ['greedy', 'implementation', '*1200'] |
G3. Inversions problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation of n numbers p1,βp2,β...,βpn. We perform k operations of the following type: choose uniformly at random two indices l and r (lββ€βr) and reverse the order of the element... | Input3 11 2 3 | Output0.833333333333333 | 2 seconds | 256 megabytes | ['dp', '*3100'] |
G2. Inversions problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation of n numbers p1,βp2,β...,βpn. We perform k operations of the following type: choose uniformly at random two indices l and r (lββ€βr) and reverse the order of the element... | Input3 11 2 3 | Output0.833333333333333 | 2 seconds | 256 megabytes | ['dp', 'probabilities', '*2400'] |
G1. Inversions problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation of n numbers p1,βp2,β...,βpn. We perform k operations of the following type: choose uniformly at random two indices l and r (lββ€βr) and reverse the order of the element... | Input3 11 2 3 | Output0.833333333333333 | 2 seconds | 256 megabytes | ['brute force', 'dfs and similar', 'dp', 'meet-in-the-middle', '*1800'] |
F2. Scaygerbosstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCthulhu decided to catch Scaygerboss. Scaygerboss found it out and is trying to hide in a pack of his scaygers. Each scayger except Scaygerboss is either a male or a female. Scaygerboss's gender is "othe... | Input4 4 2 3.....###########2 1 12 1 22 1 22 1 22 1 21 1 2 | Output2 | 3 seconds | 256 megabytes | ['flows', '*2800'] |
F1. Scaygerbosstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCthulhu decided to catch Scaygerboss. Scaygerboss found it out and is trying to hide in a pack of his scaygers. Each scayger except Scaygerboss is either a male or a female. Scaygerboss's gender is "othe... | Input4 4 2 3.....###########2 1 12 1 22 1 22 1 22 1 21 1 2 | Output2 | 3 seconds | 256 megabytes | ['flows', '*2700'] |
E2. Subarray Cutstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array of length n and a number k. Let's pick k non-overlapping non-empty subarrays of the initial array. Let si be the sum of the i-th subarray in order from left to right. Compute the... | Input5 35 2 4 3 1 | Output12 | 2 seconds | 512 megabytes | ['dp', '*2700'] |
E1. Subarray Cutstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array of length n and a number k. Let's pick k non-overlapping non-empty subarrays of the initial array. Let si be the sum of the i-th subarray in order from left to right. Compute the... | Input5 35 2 4 3 1 | Output12 | 2 seconds | 512 megabytes | ['dp', '*2600'] |
D2. Constrained Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou need to find a binary tree of size n that satisfies a given set of c constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For t... | Input3 21 2 LEFT1 3 RIGHT | Output2 1 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', '*2600'] |
D1. Constrained Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou need to find a binary tree of size n that satisfies a given set of c constraints. Suppose that the nodes of the unknown binary tree are labeled using a pre-order traversal starting with 1. For t... | Input3 21 2 LEFT1 3 RIGHT | Output2 1 3 | 2 seconds | 256 megabytes | ['dfs and similar', '*2400'] |
C. Second price auctiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNowadays, most of the internet advertisements are not statically linked to a web page. Instead, what will be shown to the person opening a web page is determined within 100 milliseconds after the... | Input34 78 105 5 | Output5.7500000000 | 2 seconds | 256 megabytes | ['bitmasks', 'probabilities', '*2000'] |
B2. Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of numbers 1,β2,β...,βn. Let's define f(p) as the following sum:Find the lexicographically m-th permutation of length n in the set of permutations having the maximum possib... | Input2 2 | Output2 1 | 2 seconds | 256 megabytes | ['bitmasks', 'divide and conquer', 'math', '*1800'] |
B1. Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of numbers 1,β2,β...,βn. Let's define f(p) as the following sum:Find the lexicographically m-th permutation of length n in the set of permutations having the maximum possib... | Input2 2 | Output2 1 | 2 seconds | 256 megabytes | ['brute force', '*1400'] |
A. Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo players play a simple game. Each player is provided with a box with balls. First player's box contains exactly n1 balls and second player's box contains exactly n2 balls. In one move first player can take fr... | Input2 2 1 2 | OutputSecond | 2 seconds | 256 megabytes | ['constructive algorithms', 'math', '*800'] |
E. Fox And Polygontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel just designed a puzzle game called "Polygon"! It is played using triangulations of a regular n-edge polygon. The goal is to transform one triangulation to another by some tricky rules.Triangu... | Input41 32 4 | Output11 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'divide and conquer', '*2900'] |
D. Fox And Travellingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel is going to travel to New Foxland during this summer.New Foxland has n attractions that are linked by m undirected roads. Two attractions are called adjacent if they are linked by a road. ... | Input3 21 22 3 | Output1244 | 3 seconds | 256 megabytes | ['dp', 'trees', '*2900'] |
E. Fox And Dinnertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel is participating in a party in Prime Kingdom. There are n foxes there (include Fox Ciel). The i-th fox is ai years old.They will have dinner around some round tables. You want to distribute fo... | Input43 4 8 9 | Output14 1 2 4 3 | 2 seconds | 256 megabytes | ['flows', '*2300'] |
D. Fox And Jumpingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.There are also n ca... | Input3100 99 99001 1 1 | Output2 | 2 seconds | 256 megabytes | ['bitmasks', 'brute force', 'dp', 'math', '*1900'] |
C. Fox And Namestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order. After ch... | Input3rivestshamiradleman | Outputbcdefghijklmnopqrsatuvwxyz | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'sortings', '*1600'] |
B. Fox And Two Dotstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size nβΓβm cells, like this:Each cell contains a dot that has some color. We will use different u... | Input3 4AAAAABCAAAAA | OutputYes | 2 seconds | 256 megabytes | ['dfs and similar', '*1500'] |
A. Fox And Snaketime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead.A snake is a pattern on a n by m tabl... | Input3 3 | Output###..#### | 2 seconds | 256 megabytes | ['implementation', '*800'] |
F. Progress Monitoringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputProgramming teacher Dmitry Olegovich is going to propose the following task for one of his tests for students:You are given a tree T with n vertices, specified by its adjacency matrix a[1... n,β1..... | Input31 2 3 | Output2 | 1 second | 256 megabytes | ['dp', 'trees', '*2300'] |
E. Pretty Songtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen Sasha was studying in the seventh grade, he started listening to music a lot. In order to evaluate which songs he likes more, he introduced the notion of the song's prettiness. The title of the song i... | InputIEAIAIO | Output28.0000000 | 1 second | 256 megabytes | ['math', 'strings', '*2000'] |
D. Restoring Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya had two arrays consisting of non-negative integers: a of size n and b of size m. Vasya chose a positive integer k and created an nβΓβm matrix v using the following formula:Vasya wrote down matr... | Input2 31 2 32 3 4 | OutputYES10000000070 1 1 2 3 | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*2200'] |
C. Sums of Digitstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya had a strictly increasing sequence of positive integers a1, ..., an. Vasya used it to build a new sequence b1, ..., bn, where bi is the sum of digits of ai's decimal representation. Then sequence... | Input3123 | Output123 | 2 seconds | 256 megabytes | ['dp', 'greedy', 'implementation', '*2000'] |
B. Painting Pebblestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n piles of pebbles on the table, the i-th pile contains ai pebbles. Your task is to paint each pebble using one of the k given colors so that for each color c and any two piles i and j the d... | Input4 41 2 3 4 | OutputYES11 41 2 41 2 3 4 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', '*1300'] |
A. Maximum in Tabletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn nβΓβn table a is defined as follows: The first row and the first column contain ones, that is: ai,β1β=βa1,βiβ=β1 for all iβ=β1,β2,β...,βn. Each of the remaining numbers in the table is equal to ... | Input1 | Output1 | 2 seconds | 256 megabytes | ['brute force', 'implementation', '*800'] |
E. Arthur and Bracketstime limit per test2 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputNotice that the memory limit is non-standard.Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket seq... | Input41 11 11 11 1 | Output()()()() | 2 seconds | 128 megabytes | ['dp', 'greedy', '*2200'] |
D. Tanya and Passwordtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile dad was at work, a little girl Tanya decided to play with dad's password to his secret database. Dad's password is a string consisting of nβ+β2 characters. She has written all the possible n ... | Input5acaabaabacabbac | OutputYESabacaba | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', '*2500'] |
C. Anya and Ghoststime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya loves to watch horror movies. In the best traditions of horror, she will be visited by m ghosts tonight. Anya has lots of candles prepared for the visits, each candle can produce light for exactl... | Input1 8 310 | Output3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', '*1600'] |
B. Anton and currency you all knowtime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchang... | Input527 | Output572 | 0.5 seconds | 256 megabytes | ['greedy', 'math', 'strings', '*1300'] |
A. Pasha and Pixelstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPasha loves his phone and also putting his hair up... But the hair is now irrelevant.Pasha has installed a new game to his phone. The goal of the game is following. There is a rectangular field consi... | Input2 2 41 11 22 12 2 | Output4 | 2 seconds | 256 megabytes | ['brute force', '*1100'] |
E. Breaking Goodtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBreaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers.Walter William, the main character of the ... | Input2 11 2 0 | Output11 2 1 | 2 seconds | 256 megabytes | ['dfs and similar', 'dp', 'graphs', 'shortest paths', '*2100'] |
D. The Maths Lecturetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr doesn't like Maths as he finds it really boring, so he usually sleeps in Maths lectures. But one day the teacher suspected that Amr is sleeping and asked him a question to make sure he wasn't.Fir... | Input1 2 1000 | Output4 | 1 second | 256 megabytes | ['dp', 'implementation', '*2200'] |
C. Guess Your Way Out!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr bought a new video game "Guess Your Way Out!". The goal of the game is to find an exit from the maze that looks like a perfect binary tree of height h. The player is initially standing at the r... | Input1 2 | Output2 | 1 second | 256 megabytes | ['implementation', 'math', 'trees', '*1700'] |
B. Amr and Pinstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr loves Geometry. One day he came up with a very interesting problem.Amr has a circle of radius r and center in point (x,βy). He wants the circle center to be in new position (x',βy').In one step Amr ca... | Input2 0 0 0 4 | Output1 | 1 second | 256 megabytes | ['geometry', 'math', '*1400'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.