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 |
|---|---|---|---|---|---|
F. Phoenix and Earthquaketime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPhoenix's homeland, the Fire Nation had n cities that were connected by m roads, but the roads were all destroyed by an earthquake. The Fire Nation wishes to repair n-1 of these roads so that a... | 5 4 1
0 0 0 4 0
1 2
2 3
3 4
4 5
| YES 3 2 1 4 | 3 seconds | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'dsu', 'graphs', 'greedy', 'trees', '*2600'] |
E. Phoenix and Computerstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n computers in a row, all originally off, and Phoenix wants to turn all of them on. He will manually turn on computers one at a time. At any point, if computer i-1 and computer i+1 are... | 3 100000007
| 6 | 3 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', '*2200'] |
D. Phoenix and Sockstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTo satisfy his love of matching socks, Phoenix has brought his n socks (n is even) to the sock store. Each of his socks has a color c_i and is either a left sock or right sock. Phoenix can pay one d... | 4
6 3 3
1 2 3 2 2 2
6 2 4
1 1 2 2 2 2
6 5 1
6 5 4 3 2 1
4 0 4
4 4 4 3
| 2 3 5 3 | 2 seconds | 256 megabytes | ['greedy', 'sortings', 'two pointers', '*1500'] |
C. Phoenix and Towerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPhoenix has n blocks of height h_1, h_2, \dots, h_n, and all h_i don't exceed some value x. He plans to stack all n blocks into m separate towers. The height of a tower is simply the sum of the hei... | 2
5 2 3
1 2 3 1 2
4 3 3
1 1 2 3
| YES 1 1 1 2 2 YES 1 2 2 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'greedy', '*1400'] |
B. Phoenix and Puzzletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPhoenix is playing with a new puzzle, which consists of n identical puzzle pieces. Each puzzle piece is a right isosceles triangle as shown below. A puzzle piece The goal of the puzzle is to creat... | 3
2
4
6
| YES YES NO | 2 seconds | 256 megabytes | ['brute force', 'geometry', 'math', 'number theory', '*1000'] |
A. Phoenix and Goldtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPhoenix has collected n pieces of gold, and he wants to weigh them together so he can feel rich. The i-th piece of gold has weight w_i. All weights are distinct. He will put his n pieces of gold on a... | 3
3 2
3 2 1
5 3
1 2 3 4 8
1 5
5
| YES 3 2 1 YES 8 1 2 3 4 NO | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'math', '*800'] |
E. Baby Ehab's Hyper Apartmenttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Baby Ehab loves crawling around his apartment. It has n rooms numbered from 0 to n-1. For every pair of rooms, a and b, there's either a direct passage from r... | 1
4
0
0
1
1
1 | 2 3 3 0 1 2 1 0 1 1 0 2 2 2 1 1 3 1111 1111 1111 0001 | 1 second | 256 megabytes | ['binary search', 'graphs', 'interactive', 'sortings', 'two pointers', '*2700'] |
D. Cut and Sticktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBaby Ehab has a piece of Cut and Stick with an array a of length n written on it. He plans to grab a pair of scissors and do the following to it: pick a range (l, r) and cut out every element a_l, a_{l... | 6 2
1 3 2 3 3 2
1 6
2 5
| 1 2 | 3 seconds | 512 megabytes | ['binary search', 'data structures', 'greedy', 'implementation', 'sortings', '*2000'] |
C. Product 1 Modulo Ntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNow you get Baby Ehab's first words: "Given an integer n, find the longest subsequence of [1,2, \ldots, n-1] whose product is 1 modulo n." Please solve the problem.A sequence b is a subsequence of a... | 5
| 3 1 2 3 | 1 second | 256 megabytes | ['greedy', 'number theory', '*1600'] |
B. AND 0, Sum Bigtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBaby Badawy's first words were "AND 0 SUM BIG", so he decided to solve the following problem. Given two integers n and k, count the number of arrays of length n such that: all its elements are integer... | 2
2 2
100000 20
| 4 226732710 | 2 seconds | 256 megabytes | ['bitmasks', 'combinatorics', 'math', '*1200'] |
A. Perfectly Imperfect Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an array a of length n, tell us whether it has a non-empty subsequence such that the product of its elements is not a perfect square.A sequence b is a subsequence of an array a if b can... | 2
3
1 5 4
2
100 10000
| YES NO | 1 second | 256 megabytes | ['math', 'number theory', '*800'] |
F. Swapping Problemtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given 2 arrays a and b, both of size n. You can swap two elements in b at most once (or leave it as it is), and you are required to minimize the value \sum_{i}|a_{i}-b_{i}|.Find the minimum p... | 5
5 4 3 2 1
1 2 3 4 5
| 4 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'data structures', 'sortings', '*2500'] |
E. Cost Equilibriumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is called beautiful if all the elements in the array are equal.You can transform an array using the following steps any number of times: Choose two indices i and j (1 \leq i,j \leq n), and ... | 3
1 2 3
| 6 | 1 second | 256 megabytes | ['combinatorics', 'constructive algorithms', 'math', 'sortings', '*2300'] |
D. GCD and MSTtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of n (n \geq 2) positive integers and an integer p. Consider an undirected weighted graph of n vertices numbered from 1 to n for which the edges between the vertices i and j (i<j)... | 4
2 5
10 10
2 5
3 3
4 5
5 2 4 9
8 8
5 3 3 6 10 100 9 15
| 5 3 12 46 | 2 seconds | 256 megabytes | ['constructive algorithms', 'dsu', 'graphs', 'greedy', 'number theory', 'sortings', '*2000'] |
C. Add Onetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n. You have to apply m operations to it.In a single operation, you must replace every digit d of the number with the decimal representation of integer d + 1. For example, 1912 becomes ... | 5
1912 1
5 6
999 1
88 2
12 100
| 5 2 6 4 2115 | 1 second | 256 megabytes | ['dp', 'matrices', '*1600'] |
B. AND Sequencestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of n non-negative integers (n \ge 2) a_1, a_2, \dots, a_n is called good if for all i from 1 to n-1 the following condition holds true: a_1 \: \& \: a_2 \: \& \: \dots \: \& \: a_i = a_{i+1} ... | 4
3
1 1 1
5
1 2 3 4 5
5
0 2 0 3 0
4
1 3 5 1
| 6 0 36 4 | 2 seconds | 256 megabytes | ['bitmasks', 'combinatorics', 'constructive algorithms', 'math', '*1400'] |
A. Array and Peakstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of n integers is called a permutation if it contains all integers from 1 to n exactly once.Given two integers n and k, construct a permutation a of numbers from 1 to n which has exactly k pe... | 5
1 0
5 2
6 6
2 1
6 1
| 1 2 4 1 5 3 -1 -1 1 3 6 5 4 2 | 1 second | 256 megabytes | ['constructive algorithms', 'implementation', '*800'] |
G. Short Tasktime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet us denote by d(n) the sum of all divisors of the number n, i.e. d(n) = \sum\limits_{k | n} k.For example, d(1) = 1, d(4) = 1+2+4=7, d(6) = 1+2+3+6=12.For a given number c, find the minimum n such that ... | 12
1
2
3
4
5
6
7
8
9
10
39
691
| 1 -1 2 3 -1 5 4 7 -1 -1 18 -1 | 2 seconds | 512 megabytes | ['brute force', 'dp', 'math', 'number theory', '*1700'] |
F. Educationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is wondering about buying a new computer, which costs c tugriks. To do this, he wants to get a job as a programmer in a big company.There are n positions in Polycarp's company, numbered starting fr... | 3
4 15
1 3 10 11
1 2 7
4 100
1 5 10 50
3 14 12
2 1000000000
1 1
1
| 6 13 1000000000 | 2 seconds | 256 megabytes | ['brute force', 'dp', 'greedy', 'implementation', '*1900'] |
E. Permutation by Sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA permutation is a sequence of n integers from 1 to n, in which all the numbers occur exactly once. For example, [1], [3, 5, 2, 1, 4], [1, 3, 2] are permutations, and [2, 3, 2], [4, 3, 1], [0] are ... | 5
5 2 3 5
5 3 4 1
3 1 2 4
2 2 2 2
2 1 1 3
| 1 2 3 4 5 -1 1 3 2 1 2 -1 | 2 seconds | 256 megabytes | ['brute force', 'greedy', 'math', '*1600'] |
D. Corrupted Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a number n and an array b_1, b_2, \ldots, b_{n+2}, obtained according to the following algorithm: some array a_1, a_2, \ldots, a_n was guessed; array a was written to array b, i.e. b_... | 4
3
2 3 7 12 2
4
9 1 7 1 6 5
5
18 2 2 3 2 9 2
3
2 6 9 2 1
| 2 3 7 -1 2 2 2 3 9 1 2 6 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'greedy', '*1200'] |
C. A-B Palindrometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s consisting of the characters '0', '1', and '?'. You need to replace all the characters with '?' in the string s by '0' or '1' so that the string becomes a palindrome and has ex... | 9
4 4
01?????0
3 3
??????
1 0
?
2 2
0101
2 2
01?0
0 1
0
0 3
1?1
2 2
?00?
4 3
??010?0
| 01011010 -1 0 -1 0110 -1 111 1001 0101010 | 2 seconds | 256 megabytes | ['constructive algorithms', 'implementation', 'strings', '*1200'] |
B. Almost Rectangletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a square field of size n \times n in which two cells are marked. These cells can be in the same row or column.You are to mark two more cells so that they are the corners of a rectangle with ... | 6
4
..*.
....
*...
....
2
*.
.*
2
.*
.*
3
*.*
...
...
5
.....
..*..
.....
.*...
.....
4
....
....
*...
*...
| *.*. .... *.*. .... ** ** ** ** *.* *.* ... ..... .**.. ..... .**.. ..... .... .... **.. **.. | 2 seconds | 256 megabytes | ['implementation', '*800'] |
A. Spy Detected!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n (n \ge 3) positive integers. It is known that in this array, all the numbers except one are the same (for example, in the array [4, 11, 4, 4] all numbers except ... | 4
4
11 13 11 11
5
1 4 4 4 4
10
3 3 3 3 10 3 3 3 3 3
3
20 20 10
| 2 1 5 3 | 2 seconds | 256 megabytes | ['brute force', 'implementation', '*800'] |
G. Chips on a Boardtime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice and Bob have a rectangular board consisting of n rows and m columns. Each row contains exactly one chip.Alice and Bob play the following game. They choose two integers l and r such that 1 \le l... | 8 10
1 3 3 7 4 2 6 9
7
2 3
1 3
1 4
1 10
5 10
8 10
9 10
| BAAAAAB | 5 seconds | 512 megabytes | ['bitmasks', 'brute force', 'data structures', 'dp', 'games', 'two pointers', '*2700'] |
F. Chainwordtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA chainword is a special type of crossword. As most of the crosswords do, it has cells that you put the letters in and some sort of hints to what these letters should be.The letter cells in a chainword are ... | 3 5
ababa
ab
a
| 11 | 3 seconds | 256 megabytes | ['brute force', 'data structures', 'dp', 'matrices', 'string suffix structures', 'strings', '*2700'] |
E. Colorings and Dominoestime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou have a large rectangular board which is divided into n \times m cells (the board has n rows and m columns). Each cell is either white or black.You paint each white cell either red or blue. ... | 3 4
**oo
oo*o
**oo
| 144 | 3 seconds | 512 megabytes | ['combinatorics', 'dp', 'greedy', 'math', '*2100'] |
D. Min Cost Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's define the cost of a string s as the number of index pairs i and j (1 \le i < j < |s|) such that s_i = s_j and s_{i+1} = s_{j+1}.You are given two positive integers n and k. Among all strings wi... | 9 4
| aabacadbb | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'graphs', 'greedy', 'strings', '*1600'] |
C. Yet Another Card Decktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1 and bottom card — index n. Each card has its color: the i-th card has color a_i.You should process q ... | 7 5
2 1 1 4 3 3 1
3 2 1 1 4
| 5 2 3 1 5 | 2 seconds | 256 megabytes | ['brute force', 'data structures', 'implementation', 'trees', '*1100'] |
B. GCD Lengthtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three integers a, b and c.Find two positive integers x and y (x > 0, y > 0) such that: the decimal representation of x without leading zeroes consists of a digits; the decimal representati... | 4
2 3 1
2 2 2
6 6 2
1 1 1
| 11 492 13 26 140133 160776 1 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'math', 'number theory', '*1100'] |
A. Review Sitetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are an upcoming movie director, and you have just released your first movie. You have also launched a simple review site with two buttons to press — upvote and downvote.However, the site is not so sim... | 4
1
2
3
1 2 3
5
1 1 1 1 1
3
3 3 2
| 0 2 5 2 | 2 seconds | 256 megabytes | ['greedy', '*800'] |
K. King's Tasktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe brave Knight came to the King and asked permission to marry the princess. The King knew that the Knight was brave, but he also wanted to know if he was smart enough. So he asked him to solve the follo... | 3
6 3 2 5 4 1
| 3 | 3 seconds | 512 megabytes | ['brute force', 'graphs', 'implementation', '*1200'] |
J. Japanese Gametime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputJoseph really likes the culture of Japan. Last year he learned Japanese traditional clothes and visual arts and now he is trying to find out the secret of the Japanese game called Nonogram.In the one-di... | __#_____
| 2 3 2 | 3 seconds | 512 megabytes | ['constructive algorithms', 'math', '*2700'] |
I. Is It Rated?time limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe popular improv website Interpretation Impetus hosts regular improv contests and maintains a rating of the best performers. However, since improv can often go horribly wrong, the website is notorious ... | 3 4
000
1
100
1
001
0
111
1
| 0 0 1 1 | 3 seconds | 512 megabytes | ['greedy', 'interactive', 'math', 'probabilities', '*2700'] |
H. Hard Optimizationtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a set of n segments on a line [L_i; R_i]. All 2n segment endpoints are pairwise distinct integers.The set is laminar — any two segments are either disjoint or one of them contains the ... | 4
1 10
2 3
5 9
6 7
| 7 3 6 2 3 7 9 6 7 | 3 seconds | 512 megabytes | ['dp', '*3200'] |
F. Fiber Shapetime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputImagine a board with n pins put into it, the i-th pin is located at (x_i, y_i). For simplicity, we will restrict the problem to the case where the pins are placed in vertices of a convex polygon.Then, tak... | 3 4
0 0
1 0
0 1
| 3.012712585980357 | 3 seconds | 512 megabytes | ['*2800'] |
D. Digitstime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDiana loves playing with numbers. She's got n cards with positive integer numbers a_i written on them. She spends her free time multiplying the numbers on the cards. She picks a non-empty subset of the cards a... | 6 4
4 11 8 2 1 13
| 5 1 2 4 11 13 | 3 seconds | 512 megabytes | ['dp', 'math', 'number theory', '*2100'] |
C. Cactus Not Enoughtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere was no problem about a cactus at the NERC 2020 online round. That's a bad mistake, so judges decided to fix it. You shall not pass to the World Finals 2021 without solving a problem about a ca... | 6 1
7 1 2 5 6 2 3 4
3 1
4 1 2 3 1
5 2
3 1 3 5
3 1 2 4
7 2
6 1 2 3 4 5 3
3 6 5 7
0 0
| 1 1 4 0 1 5 4 2 1 3 6 7 | 3 seconds | 512 megabytes | ['dfs and similar', 'graph matchings', 'graphs', '*2900'] |
B. Button Locktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are standing in front of the room with great treasures. The only thing stopping you is the door with a push-button combination lock. This lock has d buttons with digits from 0 to d - 1. Whenever you p... | 2 2
10
11
| 2 0 1 | 3 seconds | 512 megabytes | ['flows', 'graph matchings', 'graphs', '*2600'] |
C. The Sports Festivaltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe student council is preparing for the relay race at the sports festival.The council consists of n members. They will run one after the other in the race, the speed of member i is s_i. The discre... | 3
3 1 2
| 3 | 1 second | 256 megabytes | ['dp', 'greedy', '*1800'] |
B. TMT Documenttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe student council has a shared document file. Every day, some members of the student council write the sequence TMT (short for Towa Maji Tenshi) in it.However, one day, the members somehow entered the s... | 5
3
TMT
3
MTT
6
TMTMTT
6
TMTTTT
6
TTMMTT
| YES NO YES NO YES | 1 second | 256 megabytes | ['greedy', '*1100'] |
A. Average Heighttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSayaka Saeki is a member of the student council, which has n other members (excluding Sayaka). The i-th member has a height of a_i millimeters.It's the end of the school year and Sayaka wants to take a ... | 4
3
1 1 2
3
1 1 1
8
10 9 13 15 3 16 9 13
2
18 9
| 1 1 2 1 1 1 13 9 13 15 3 9 16 10 9 18 | 1 second | 256 megabytes | ['constructive algorithms', '*800'] |
F. Optimal Encodingtime limit per test7 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputTouko's favorite sequence of numbers is a permutation a_1, a_2, \dots, a_n of 1, 2, \dots, n, and she wants some collection of permutations that are similar to her favorite permutation.She has a col... | 4 3
2 4 1 3
1 3
2 4
1 4
| 2 4 3 | 7 seconds | 1024 megabytes | ['brute force', 'data structures', '*3500'] |
E. Tree Calendartime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYuu Koito and Touko Nanami are newlyweds! On the wedding day, Yuu gifted Touko a directed tree with n nodes and rooted at 1, and a labeling a which is some DFS order of the tree. Every edge in this tree... | 7
4 5 2 1 7 6 3
1 5
7 6
1 2
2 7
3 4
1 3
| YES 5 1 4 2 3 7 6 5 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'data structures', 'dfs and similar', 'sortings', 'trees', '*3100'] |
D. Swap Passtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBased on a peculiar incident at basketball practice, Akari came up with the following competitive programming problem!You are given n points on the plane, no three of which are collinear. The i-th point ini... | 5
-1 -2 2
3 0 5
1 3 4
4 -3 3
5 2 1
| 5 1 2 5 3 4 5 1 5 1 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'geometry', 'sortings', '*3000'] |
C. Complete the MSTtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs a teacher, Riko Hakozaki often needs to help her students with problems from various subjects. Today, she is asked a programming task which goes as follows.You are given an undirected complete gra... | 4 4
2 1 14
1 4 14
3 2 15
4 3 8
| 15 | 3 seconds | 256 megabytes | ['bitmasks', 'brute force', 'data structures', 'dfs and similar', 'dsu', 'graphs', 'greedy', 'trees', '*2500'] |
B. Almost Sortedtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSeiji Maki doesn't only like to observe relationships being unfolded, he also likes to observe sequences of numbers, especially permutations. Today, he has his eyes on almost sorted permutations.A permu... | 5
1 1
1 2
3 3
6 5
3 4
| 1 -1 2 1 3 1 2 4 3 5 6 3 2 1 | 2 seconds | 256 megabytes | ['binary search', 'combinatorics', 'constructive algorithms', 'implementation', '*1800'] |
A. Binary Literaturetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA bitstring is a string that contains only the characters 0 and 1.Koyomi Kanou is working hard towards her dream of becoming a writer. To practice, she decided to participate in the Binary Novel Writ... | 2
1
00
11
01
3
011001
111010
010001
| 010 011001010 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', 'strings', 'two pointers', '*1900'] |
G. Maximize the Remaining Stringtime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s, consisting of lowercase Latin letters. While there is at least one character in the string s that is repeated at least twice, you perform the following operat... | 6
codeforces
aezakmi
abacaba
convexhull
swflldjgpaxs
myneeocktxpqjpz
| odfrces ezakmi cba convexhul wfldjgpaxs myneocktxqjpz | 2.5 seconds | 256 megabytes | ['brute force', 'data structures', 'dp', 'greedy', 'strings', '*2000'] |
F. Triangular Pathstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider an infinite triangle made up of layers. Let's number the layers, starting from one, from the top of the triangle (from top to bottom). The k-th layer of the triangle contains k points, numbe... | 4
3
1 4 2
1 3 1
2
2 4
2 3
2
1 1000000000
1 1000000000
4
3 10 5 8
2 5 2 4
| 0 1 999999999 2 | 2 seconds | 256 megabytes | ['constructive algorithms', 'graphs', 'math', 'shortest paths', 'sortings', '*2000'] |
E. Restoring the Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA permutation is a sequence of n integers from 1 to n, in which all numbers occur exactly once. For example, [1], [3, 5, 2, 1, 4], [1, 3, 2] are permutations, and [2, 3, 2], [4, 3, 1], [0] a... | 4
7
3 3 4 4 7 7 7
4
1 2 3 4
7
3 4 5 5 5 7 7
1
1
| 3 1 4 2 7 5 6 3 2 4 1 7 6 5 1 2 3 4 1 2 3 4 3 4 5 1 2 7 6 3 4 5 2 1 7 6 1 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'implementation', '*1500'] |
D. Epic Transformationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n consisting of integers. You can apply the following operation, consisting of several steps, on the array a zero or more times: you select two different numbe... | 5
6
1 6 1 1 4 4
2
1 2
2
1 1
5
4 5 4 5 4
6
2 3 2 1 3 1
| 0 0 2 1 0 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'greedy', '*1400'] |
C. Double-ended Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the strings a and b, consisting of lowercase Latin letters. You can do any number of the following operations in any order: if |a| > 0 (the length of the string a is greater than ... | 5
a
a
abcd
bc
hello
codeforces
hello
helo
dhjakjsnasjhfksafasd
adjsnasjhfksvdafdser
| 0 2 13 3 20 | 2 seconds | 256 megabytes | ['brute force', 'implementation', 'strings', '*1000'] |
B. Partial Replacementtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a number k and a string s of length n, consisting of the characters '.' and '*'. You want to replace some of the '*' characters with 'x' characters so that the following conditions a... | 5
7 3
.**.***
5 1
..*..
5 2
*.*.*
3 2
*.*
1 1
*
| 3 1 3 2 1 | 2 seconds | 256 megabytes | ['greedy', 'implementation', '*1100'] |
A. Strange Tabletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp found a rectangular table consisting of n rows and m columns. He noticed that each cell of the table has its number, obtained by the following algorithm "by columns": cells are numbered start... | 5
1 1 1
2 2 3
3 5 11
100 100 7312
1000000 1000000 1000000000000
| 1 2 9 1174 1000000000000 | 2 seconds | 256 megabytes | ['math', '*800'] |
G. Encoded messagetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe first line of the input contains a single integer N (1 \le N \le 24). The next N lines contain 5 space-separated integers each. The first three integers will be between 0 and 2, inclusive. The... | 1
1 0 0 1 0
| a | 1 second | 256 megabytes | ['*special problem', 'implementation', '*2600'] |
F. Mathtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output *The two images are equivalent, feel free to use either one.InputThe input contains a single integer a (-100 \le a \le 100).OutputOutput the result – an integer number.ExampleInput
1
Output
1
| 1
| 1 | 1 second | 256 megabytes | ['*special problem', 'math', '*2200'] |
E. Cakewalktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA mouse encountered a nice big cake and decided to take a walk across it, eating the berries on top of the cake on its way. The cake is rectangular, neatly divided into squares; some of the squares have a ber... | 4 3
*..
.*.
..*
...
| 3 | 1 second | 256 megabytes | ['*special problem', 'greedy', 'implementation', 'shortest paths', '*1800'] |
D. Xenolith? Hippodrome?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe input contains two integers N, M (1 \le N \le 1024, 2 \le M \le 16), separated by a single space.OutputOutput "YES" or "NO".ExamplesInput
2 3
Output
YES
Input
3 2
Output
NO
Input
33 16
O... | 2 3
| YES | 1 second | 256 megabytes | ['*special problem', 'number theory', '*1800'] |
C. Fibonacci Wordstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.OutputOutput "YES" or "NO".ExamplesInput
HELP
Output
YES
Input
AI... | HELP
| YES | 1 second | 256 megabytes | ['*special problem', 'implementation', '*1400'] |
B. DMCAtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMany people are aware of DMCA – Digital Millennium Copyright Act. But another recently proposed DMCA – Digital Millennium Calculation Act – is much less known.In this problem you need to find a root of a number a... | 1
| 1 | 1 second | 256 megabytes | ['*special problem', 'implementation', 'number theory', '*1600'] |
A. Is it rated - 2time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInteractionThis is an interactive problem. You need to read participants' queries from standard input and print your responses to standard output. You don't know the number of queries upfront, so you'l... | Is it rated?
Is it rated?
Is it rated?
| NO NO NO | 1 second | 256 megabytes | ['*special problem', 'implementation', 'interactive', '*900'] |
B. Flip the Bitstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a binary string a of length n. In one operation, you can select any prefix of a with an equal number of 0 and 1 symbols. Then all symbols in the prefix are inverted: each 0 becomes 1 and each 1 ... | 5
10
0111010000
0100101100
4
0000
0000
3
001
000
12
010101010101
100110011010
6
000111
110100
| YES YES NO YES NO | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', 'math', '*1200'] |
A. Déjà Vutime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA palindrome is a string that reads the same backward as forward. For example, the strings "z", "aaa", "aba", and "abccba" are palindromes, but "codeforces" and "ab" are not. You hate palindromes because they... | 6
cbabc
ab
zza
ba
a
nutforajaroftuna
| YES cbabac YES aab YES zaza YES baa NO YES nutforajarofatuna | 1 second | 256 megabytes | ['constructive algorithms', 'strings', '*800'] |
F. Balance the Cardstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA balanced bracket sequence is defined as an integer sequence that can be built with the following rules: The empty sequence is balanced. If [a_1,\ldots,a_n] and [b_1,\ldots, b_m] are balanced, th... | 5
1 3
-3 -5
4 -3
2 2
-1 -4
-2 5
3 -1
5 1
-4 4
-5 -2
| YES 1 3 4 -3 -4 4 -1 -4 5 1 3 -1 2 2 -2 5 -3 -5 -5 -2 | 3 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'divide and conquer', 'geometry', 'graphs', 'implementation', '*3500'] |
E. 2-Coloringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a grid with n rows and m columns. Every cell of the grid should be colored either blue or yellow.A coloring of the grid is called stupid if every row has exactly one segment of blue cells and ever... | 2 2
| 2 | 3 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', '*3100'] |
D. Flip the Cardstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a deck of n cards. The i-th card has a number a_i on the front and a number b_i on the back. Every integer between 1 and 2n appears exactly once on the cards.A deck is called sorted if the fro... | 5
3 10
6 4
1 9
5 8
2 7
| 2 | 2 seconds | 256 megabytes | ['2-sat', 'constructive algorithms', 'data structures', 'greedy', 'sortings', 'two pointers', '*2600'] |
C. Travelling Salesman Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cities numbered from 1 to n, and city i has beauty a_i.A salesman wants to start at city 1, visit every city exactly once, and return to city 1.For all i\ne j, a flight from ci... | 3
1 9
2 1
4 1
| 11 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'dp', 'greedy', 'shortest paths', 'sortings', 'two pointers', '*2200'] |
B. 3-Coloringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Alice and Bob are playing a game. There is n\times n grid, initially empty. We refer to the cell in row i and column j by (i, j) for 1\le i, j\le n. There is an infinite supp... | 2
1
2
1
3
| 2 1 1 3 1 2 3 2 1 1 2 2 | 3 seconds | 256 megabytes | ['constructive algorithms', 'games', 'interactive', '*1700'] |
A. Balance the Bitstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters '+' and '1'. For example, sequences '(())()', '()', and '(()(()))' are balanced, while ')... | 3
6
101101
10
1001101101
4
1100
| YES ()()() ((())) YES ()()((())) (())()()() NO | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', '*1600'] |
B. Napoleon Caketime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis week Arkady wanted to cook some pancakes (to follow ancient traditions) and make a problem about that. But then he remembered that one can't make a problem about stacking pancakes without working at... | 3
6
0 3 0 0 1 3
10
0 0 0 1 0 5 0 0 0 2
3
0 0 0
| 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 | 1 second | 256 megabytes | ['dp', 'implementation', 'sortings', '*900'] |
A. Alexey and Traintime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlexey is travelling on a train. Unfortunately, due to the bad weather, the train moves slower that it should!Alexey took the train at the railroad terminal. Let's say that the train starts from the t... | 2
2
2 4
10 12
0 2
5
1 4
7 8
9 10
13 15
19 20
1 2 3 4 5
| 12 32 | 1 second | 256 megabytes | ['implementation', '*800'] |
F. Cupboards Jumpstime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIn the house where Krosh used to live, he had n cupboards standing in a line, the i-th cupboard had the height of h_i. Krosh moved recently, but he wasn't able to move the cupboards with him. Now he w... | 7 20
4 8 12 16 20
| YES 4 8 8 16 20 4 0 | 6 seconds | 512 megabytes | ['dp', '*3500'] |
E. Subset Tricktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVanya invented an interesting trick with a set of integers.Let an illusionist have a set of positive integers S. He names a positive integer x. Then an audience volunteer must choose some subset (possibl... | 3 11
1 2 3
2 1
1 5
1 6
1 7
2 6
2 2
2 3
1 10
2 5
2 7
2 10
| 4 1 6 12 19 13 8 2 10 3 0 0 | 3 seconds | 512 megabytes | ['binary search', 'data structures', '*3300'] |
D. Tiles for Bathroomtime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputKostya is extremely busy: he is renovating his house! He needs to hand wallpaper, assemble furniture throw away trash.Kostya is buying tiles for bathroom today. He is standing in front of a large s... | 3 4
1 2 3
4 5 6
7 8 9
| 9 4 0 | 5 seconds | 512 megabytes | ['data structures', 'sortings', 'two pointers', '*2900'] |
C. Matrix Sortingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two tables A and B of size n \times m. We define a sorting by column as the following: we choose a column and reorder the rows of the table by the value in this column, from the rows with... | 2 2
2 2
1 2
1 2
2 2
| 1 1 | 2 seconds | 256 megabytes | ['bitmasks', 'brute force', 'constructive algorithms', 'greedy', 'two pointers', '*2600'] |
B. Two chandelierstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his... | 4 2 4
4 2 3 1
2 1
| 5 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'chinese remainder theorem', 'math', 'number theory', '*2200'] |
A. Going Hometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt was the third month of remote learning, Nastya got sick of staying at dormitory, so she decided to return to her hometown. In order to make her trip more entertaining, one of Nastya's friend presented h... | 6
2 1 5 2 7 4
| YES 2 3 1 6 | 2 seconds | 256 megabytes | ['brute force', 'hashing', 'implementation', 'math', '*1800'] |
G. Graph Coloringtime limit per test7 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a bipartite graph consisting of n_1 vertices in the first part, n_2 vertices in the second part, and m edges, numbered from 1 to m. You have to color each edge into one of two colors, re... | 3 4 2
1 2
3 4
10
1 1 3
1 2 3
2
1 3 3
2
1 2 4
2
1 2 1
1 1 1
2
| 8 8 1 3 40 2 3 5 104 3 5 6 3 104 360 4 5 6 3 8 | 7 seconds | 1024 megabytes | ['data structures', 'graphs', 'interactive', '*3100'] |
F. Diameter Cutstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer k and an undirected tree, consisting of n vertices.The length of a simple path (a path in which each vertex appears at most once) between some pair of vertices is the number of ... | 4 3
1 2
1 3
1 4
| 8 | 2 seconds | 256 megabytes | ['combinatorics', 'dfs and similar', 'dp', 'trees', '*2400'] |
E. Chaotic Mergetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings x and y, both consist only of lowercase Latin letters. Let |s| be the length of string s.Let's call a sequence a a merging sequence if it consists of exactly |x| zeros and exac... | aaa
bb
| 24 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', 'strings', '*2400'] |
D. The Number of Pairstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given three positive (greater than zero) integers c, d and x. You have to find the number of pairs of positive integers (a, b) such that equality c \cdot lcm(a, b) - d \cdot gcd(a, b) = x ... | 4
1 1 3
4 2 6
3 3 7
2 7 25
| 4 3 0 8 | 2 seconds | 512 megabytes | ['dp', 'math', 'number theory', '*2100'] |
C. Minimum Grid Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's say you are standing on the XY-plane at point (0, 0) and you want to reach point (n, n).You can move only in two directions: to the right, i. e. horizontally and in the direction that increa... | 3
2
13 88
3
2 3 1
5
4 3 2 1 4
| 202 13 19 | 2 seconds | 256 megabytes | ['brute force', 'data structures', 'greedy', 'math', '*1500'] |
B. Binary Removalstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s, consisting only of characters '0' or '1'. Let |s| be the length of s.You are asked to choose some integer k (k > 0) and find a sequence a of length k such that: 1 \le a_1 <... | 5
10101011011
0000
11111
110
1100
| YES YES YES YES NO | 2 seconds | 256 megabytes | ['brute force', 'dp', 'greedy', 'implementation', '*1000'] |
A. Domino on Windowsilltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a board represented as a grid with 2 \times n cells.The first k_1 cells on the first row and first k_2 cells on the second row are colored in white. All other cells are colored in black.Y... | 5
1 0 1
1 0
1 1 1
0 0
3 0 0
1 3
4 3 1
2 2
5 4 3
3 1
| NO YES NO YES YES | 1 second | 256 megabytes | ['combinatorics', 'constructive algorithms', 'math', '*800'] |
F. Christmas Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob are going to celebrate Christmas by playing a game with a tree of presents. The tree has n nodes (numbered 1 to n, with some node r as its root). There are a_i presents are hanging from t... | 5 1
1 2
1 3
5 2
4 3
0 3 2 4 4
| 1 0 0 1 1 | 2 seconds | 256 megabytes | ['bitmasks', 'data structures', 'dfs and similar', 'dp', 'games', 'math', 'trees', '*2500'] |
E. Two Housestime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flus... | 3
1 1 1
Yes | ? 1 2 ! 1 2 | 3.5 seconds | 256 megabytes | ['brute force', 'graphs', 'greedy', 'interactive', 'sortings', '*2200'] |
D. Bananas in a Microwavetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a malfunctioning microwave in which you want to put some bananas. You have n time-steps before the microwave stops working completely. At each time-step, it displays a new operation.Le... | 3 20
1 300000 2
2 400000 2
1 1000000 3
| -1 -1 1 -1 -1 1 -1 -1 -1 3 -1 2 3 -1 -1 3 -1 -1 -1 3 | 3 seconds | 256 megabytes | ['dfs and similar', 'dp', 'graphs', 'implementation', '*2200'] |
C. Planar Reflectionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGaurang has grown up in a mystical universe. He is faced by n consecutive 2D planes. He shoots a particle of decay age k at the planes.A particle can pass through a plane directly, however, every pl... | 4
2 3
2 2
3 1
1 3
| 4 3 1 2 | 1 second | 256 megabytes | ['brute force', 'data structures', 'dp', '*1600'] |
B. Box Fittingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n rectangles, each of height 1. Each rectangle's width is a power of 2 (i. e. it can be represented as 2^x for some non-negative integer x). You are also given a two-dimensional box of width ... | 2
5 16
1 2 8 4 8
6 10
2 8 8 2 2 8
| 2 3 | 1 second | 256 megabytes | ['binary search', 'bitmasks', 'data structures', 'greedy', '*1300'] |
A. GCD Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe \text{gcdSum} of a positive integer is the gcd of that integer with its sum of digits. Formally, \text{gcdSum}(x) = gcd(x, \text{ sum of digits of } x) for a positive integer x. gcd(a, b) denotes the great... | 3
11
31
75
| 12 33 75 | 1 second | 256 megabytes | ['brute force', 'math', '*800'] |
E2. Square-Free Division (hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference is that in this version 0 \leq k \leq 20.There is an array a_1, a_2, \ldots, a_n of n positive integers. You should di... | 35 218 6 2 4 111 46 2 2 8 9 1 3 6 3 9 71 01 | 1 2 1 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'greedy', 'math', 'number theory', 'two pointers', '*2500'] |
E1. Square-Free Division (easy version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference is that in this version k = 0.There is an array a_1, a_2, \ldots, a_n of n positive integers. You should divide it int... | 35 018 6 2 4 15 06 8 1 24 81 01 | 3 2 1 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'greedy', 'math', 'number theory', 'two pointers', '*1700'] |
D. Geniustime limit per test2 secondsmemory limit per test32 megabytesinputstandard inputoutputstandard outputPlease note the non-standard memory limit.There are n problems numbered with integers from 1 to n. i-th problem has the complexity c_i = 2^i, tag tag_i and score s_i.After solving the problem i it's allowed to ... | 5
4
1 2 3 4
5 10 15 20
4
1 2 1 2
5 10 15 20
4
2 2 4 1
2 8 19 1
2
1 1
6 9
1
1
666
| 35 30 42 0 0 | 2 seconds | 32 megabytes | ['bitmasks', 'dp', 'graphs', 'number theory', '*2500'] |
C2. k-LCM (hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is the hard version of the problem. The only difference is that in this version 3 \le k \le n.You are given a positive integer n. Find k positive integers a_1, a_2, \ldots, a_k, such that: a_... | 2
6 4
9 5
| 1 2 2 1 1 3 3 1 1 | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*1600'] |
C1. k-LCM (easy version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is the easy version of the problem. The only difference is that in this version k = 3.You are given a positive integer n. Find k positive integers a_1, a_2, \ldots, a_k, such that: a_1 + a_2 ... | 3
3 3
8 3
14 3
| 1 1 1 4 2 2 2 6 6 | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*1200'] |
B. M-arraystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a_1, a_2, \ldots, a_n consisting of n positive integers and a positive integer m.You should divide elements of this array into some arrays. You can order the elements in the new arrays ... | 4
6 4
2 2 8 6 9 4
10 8
1 1 1 5 2 4 4 8 6 7
1 1
666
2 2
2 4
| 3 6 1 1 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', '*1200'] |
A. Meximizationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n and an array a_1, a_2, \ldots, a_n. You should reorder the elements of the array a in such way that the sum of \textbf{MEX} on prefixes (i-th prefix is a_1, a_2, \ldots, a_i) is... | 3
7
4 2 0 1 3 3 7
5
2 2 8 6 9
1
0
| 0 1 2 3 4 7 3 2 6 8 9 2 0 | 1 second | 256 megabytes | ['brute force', 'data structures', 'greedy', 'sortings', '*800'] |
B. Max and Mextime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a multiset S initially consisting of n distinct non-negative integers. A multiset is a set, that can contain some elements multiple times.You will perform the following operation k times: A... | 5
4 1
0 1 3 4
3 1
0 1 4
3 0
0 1 4
3 2
0 1 2
3 2
1 2 3
| 4 4 3 5 3 | 1 second | 256 megabytes | ['math', '*1100'] |
A. Split it!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKawashiro Nitori is a girl who loves competitive programming.One day she found a string and an integer. As an advanced problem setter, she quickly thought of a problem.Given a string s and a parameter k, you... | 7
5 1
qwqwq
2 1
ab
3 1
ioi
4 2
icpc
22 0
dokidokiliteratureclub
19 8
imteamshanghaialice
6 3
aaaaaa
| YES NO YES NO YES NO NO | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'strings', '*900'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.