problem_statement stringlengths 147 8.53k | input stringlengths 1 771 | output stringlengths 1 592 ⌀ | time_limit stringclasses 32
values | memory_limit stringclasses 21
values | tags stringlengths 6 168 |
|---|---|---|---|---|---|
D. Game of Stackstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n stacks r_1,r_2,\ldots,r_n. Each stack contains some positive integers ranging from 1 to n.Define the following functions:function init(pos): stacks := an array that contains n stacks r[1],... | 3
3 1 2 2
3 3 1 2
3 1 2 1
| 1 2 2 | 1 second | 256 megabytes | ['brute force', 'dfs and similar', 'graphs', 'implementation', 'trees', '*3000'] |
C2. Doremy's Drying Plan (Hard Version)time limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThe only differences between the two versions of this problem are the constraint on k, the time limit and the memory limit. You can make hacks only if all versions of the problem... | 62 3 21 21 21 15 3 21 32 43 510 6 41 56 102 23 75 81 4100 6 51 1001 1001 1001 1001 1001 1001000 2 21 11 120 5 39 203 310 1111 136 18 | 1 2 6 0 1000 17 | 4 seconds | 1024 megabytes | ['data structures', 'dp', '*2600'] |
C1. Doremy's Drying Plan (Easy Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only differences between the two versions of this problem are the constraint on k, the time limit and the memory limit. You can make hacks only if all versions of the problem a... | 62 3 21 21 21 15 3 21 32 43 510 6 21 56 102 23 75 81 4100 6 21 1001 1001 1001 1001 1001 1001000 2 21 11 120 5 29 203 310 1111 136 18 | 1 2 3 0 1000 15 | 1 second | 256 megabytes | ['brute force', 'data structures', 'dp', 'greedy', 'sortings', '*2000'] |
B. Doremy's Connecting Plantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy lives in a country consisting of n cities numbered from 1 to n, with a_i people living in the i-th city. It can be modeled as an undirected graph with n nodes.Initially, there are no ed... | 74 100 20 15 102 11 15 10 1 0 4 1995 21 1 3 1 15 55 6 1 10 25 10000001000000000000 1000000000000 1000000000000 1000000000000 10000000000003 10 0 2 | Yes Yes Yes No No Yes No | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', 'sortings', '*1700'] |
A. Qingshan Loves Strings 2time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputQingshan has a string s which only contains \texttt{0} and \texttt{1}.A string a of length k is good if and only if a_i \ne a_{k-i+1} for all i=1,2,\ldots,k. For Div. 2 contestants, note that... | 620130004111160011101001110011003001 | 0 -1 -1 2 6 7 1 10 -1 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', '*1300'] |
F. Minimum Segmentstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou had a sequence a_1, a_2, \ldots, a_n consisting of integers from 1 to n, not necessarily distinct. For some unknown reason, you decided to calculate the following characteristic of the sequence: ... | 532 3 452 3 5 4 61131 3 483 6 6 6 8 9 9 9 | Yes 1 2 1 No Yes 1 No Yes 1 3 5 3 5 1 1 3 | 1 second | 256 megabytes | ['constructive algorithms', '*3400'] |
E. Good Coloringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice suggested Bob to play a game. Bob didn't like this idea, but he couldn't refuse Alice, so he asked you to write a program that would play instead of him.The game starts with Alice taking out a gr... | 2
3
1 2
1 3
2 1
2 3
3 1
3 2
1
OK
3
1 1
1 2
1 3
2 1
2 2
2 3
OK | ? 1 1 ! 1 2 1 3 ! 1 2 1 2 | 2 seconds | 256 megabytes | ['binary search', 'constructive algorithms', 'graphs', 'interactive', '*3100'] |
D. Splittime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call an array b_1, b_2, \ldots, b_m (m \ge 2) good if it can be split into two parts such that all elements in the left part are strictly smaller than all elements in the right part. In other words, there... | 5
3 2 1 4 5
5
1 5
1 3
1 4
1 2
2 5
| Yes No Yes No Yes | 3 seconds | 256 megabytes | ['binary search', 'data structures', 'divide and conquer', 'dsu', 'math', 'trees', 'two pointers', '*2700'] |
C. Minimum Arraytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an array a of length n consisting of integers. Then the following operation is sequentially applied to it q times: Choose indices l and r (1 \le l \le r \le n) and an integer x; Add x to all eleme... | 241 2 3 421 4 01 3 -10052 1 2 5 432 4 32 5 -21 3 1 | -99 -98 -97 4 2 1 2 5 4 | 3 seconds | 256 megabytes | ['binary search', 'brute force', 'constructive algorithms', 'data structures', 'greedy', 'hashing', 'two pointers', '*2400'] |
B. Time Traveltime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBerland is a country with ancient history, where roads were built and destroyed for centuries. It is known that there always were n cities in Berland. You also have records of t key moments in the history... | 5 241 22 33 44 522 33 562 1 2 1 2 1 | 5 | 2 seconds | 512 megabytes | ['binary search', 'graphs', 'shortest paths', '*1900'] |
F. Diamond Thefttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp is the most famous thief in Berland. This time, he decided to steal two diamonds. Unfortunately for Monocarp, there are n cameras monitoring the diamonds. Each camera has two parameters, t_i an... | 4
2 6
1 2
1 2
2 1
| 6 | 2 seconds | 256 megabytes | ['data structures', 'greedy', '*3300'] |
E. I Wanna be the Team Leadertime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMonocarp is a team leader in a massive IT company.There are m projects his team of programmers has to complete, numbered from 1 to m. The i-th project has a difficulty level b_i.There are n... | 5 3
4 6 100 5 1
50 1 12
| YES 1 3 1 5 3 2 4 1 | 2 seconds | 512 megabytes | ['bitmasks', 'constructive algorithms', 'dp', 'greedy', 'math', 'sortings', 'two pointers', '*2400'] |
D. Monocarp and the Settime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp has n numbers 1, 2, \dots, n and a set (initially empty). He adds his numbers to this set n times in some order. During each step, he adds a new number (which has not been present in the... | 6 4
<?>?>
1 ?
4 <
5 <
1 >
| 3 0 0 0 1 | 2 seconds | 256 megabytes | ['combinatorics', 'data structures', 'math', '*2100'] |
C. Decreasing Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecall that string a is lexicographically smaller than string b if a is a prefix of b (and a \ne b), or there exists an index i (1 \le i \le \min(|a|, |b|)) such that a_i < b_i, and for any index j ... | 3cab6abcd9x1 | abx | 2 seconds | 256 megabytes | ['implementation', 'strings', '*1600'] |
B. Fear of the Darktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp tries to get home from work. He is currently at the point O = (0, 0) of a two-dimensional plane; his house is at the point P = (P_x, P_y).Unfortunately, it is late in the evening, so it is v... | 23 31 0-1 63 3-1 -14 3 | 3.6055512755 3.2015621187 | 2 seconds | 256 megabytes | ['binary search', 'geometry', 'math', '*1200'] |
A. Sum of Threetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp has an integer n.He wants to represent his number as a sum of three distinct positive integers x, y, and z. Additionally, Monocarp wants none of the numbers x, y, and z to be divisible by 3.Your... | 4104159 | YES 4 5 1 NO YES 2 8 5 NO | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'math', '*800'] |
A. Deterministic Scheduling for Extended Reality over 5G and Beyondtime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputBackground Extended reality (XR) service is a promising application for future communications. In wireless communications, XR data are transmitted ove... | 2
2
2
1
1.3865 11.3865
1.3865 11.3865
2.3865 2.3865
2.3865 2.3865
0 -2
-2 0
0 -2
-2 0
2
0 250 0 0 2
1 25 1 0 2
| 0.000000 0.004950 0.000000 0.004950 0.245039 0.000000 0.245039 0.000000 | 2 seconds | 1024 megabytes | ['*special problem'] |
E. Hard Designtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider an array of integers b_0, b_1, \ldots, b_{n-1}. Your goal is to make all its elements equal. To do so, you can perform the following operation several (possibly, zero) times: Pick a pair of indic... | 51131 3 253 2 4 5 186 5 6 4 2 6 2 2410 10 10 10 | 0 0 3 3 2 5 2 5 7 18 7 16 6 22 5 28 5 28 9 27 9 27 9 27 9 27 11 23 9 27 9 27 13 19 0 0 0 0 0 0 0 0 | 3 seconds | 256 megabytes | ['greedy', 'implementation', 'math', '*2800'] |
D. Counting Rhymetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \ldots, a_n.A pair of integers (i, j), such that 1 \le i < j \le n, is called good, if there does not exist an integer k (1 \le k \le n) such that a_i is di... | 642 4 4 442 3 4 496 8 9 4 6 8 9 4 997 7 4 4 9 9 6 2 91810 18 18 15 14 4 5 6 8 9 10 12 15 16 18 17 13 112112 19 19 18 18 12 2 18 19 12 12 3 12 12 12 18 19 16 18 19 12 | 0 3 26 26 124 82 | 2 seconds | 256 megabytes | ['dp', 'math', 'number theory', '*2100'] |
C. Medium Designtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe array a_1, a_2, \ldots, a_m is initially filled with zeroes. You are given n pairwise distinct segments 1 \le l_i \le r_i \le m. You have to select an arbitrary subset of these segments (in particul... | 61 32 23 82 43 54 66 31 11 21 32 22 33 37 62 21 61 25 61 54 43 66 276 265 172 320 211 2212 244 10000000002 9999999993 1000000000123456789 9876543219274 123456789 | 1 3 2 3 4 4 | 3 seconds | 256 megabytes | ['brute force', 'data structures', 'dp', 'greedy', 'sortings', '*1700'] |
B. Haunted Housetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a number in binary representation consisting of exactly n bits, possibly, with leading zeroes. For example, for n = 5 the number 6 will be given as 00110, and for n = 4 the number 9 will be... | 61120130105101017000011112001011000110 | -1 1 -1 0 1 -1 1 3 -1 -1 -1 3 6 9 12 -1 -1 -1 0 2 4 6 10 15 20 -1 -1 -1 -1 -1 | 1 second | 256 megabytes | ['binary search', 'greedy', 'math', 'two pointers', '*1100'] |
A. Simple Designtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA positive integer is called k-beautiful, if the digit sum of the decimal representation of this number is divisible by k^{\dagger}. For example, 9272 is 5-beautiful, since the digit sum of 9272 is 9 + 2... | 61 510 837 9777 31235 101 10 | 5 17 45 777 1243 19 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*800'] |
G2. Dances (Hard Version)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference is that in this version m \leq 10^9.You are given two arrays of integers a_1, a_2, \ldots, a_n and b_1, b_2, \ldots, b_n. Before app... | 42 413 24 75 1 53 8 3 38 44 3 3 2 2 1 11 1 1 1 3 3 3 39 19 2 8 3 7 4 6 51 2 3 2 1 4 5 6 5 | 2 12 16 4 | 3 seconds | 256 megabytes | ['binary search', 'greedy', 'sortings', 'two pointers', '*1900'] |
G1. Dances (Easy version)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference is that in this version m = 1.You are given two arrays of integers a_1, a_2, \ldots, a_n and b_1, b_2, \ldots, b_n. Before applying ... | 42 113 24 15 1 53 8 3 38 14 3 3 2 2 1 11 1 1 1 3 3 3 39 19 2 8 3 7 4 6 51 2 3 2 1 4 5 6 5 | 0 1 4 4 | 3 seconds | 256 megabytes | ['binary search', 'greedy', 'two pointers', '*1400'] |
F. You Are So Beautifultime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \ldots, a_n. Calculate the number of subarrays of this array 1 \leq l \leq r \leq n, such that: The array b = [a_l, a_{l+1}, \ldots, a_r] occurs in the... | 61121 131 2 142 3 2 154 5 4 5 4101 7 7 2 3 4 3 2 1 100 | 1 1 4 7 4 28 | 1 second | 256 megabytes | ['data structures', '*1400'] |
E. Look Backtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \ldots, a_n. You need to make it non-decreasing with the minimum number of operations. In one operation, you do the following: Choose an index 1 \leq i \leq n, Se... | 91122 133 2 147 1 5 3511 2 15 7 1061 8 2 16 8 162624323799 708290323122 1 1 3 3 11 12 22 45 777 777 15001212 11 10 9 8 7 6 5 4 3 2 1 | 0 1 3 6 10 3 0 2 66 | 1 second | 256 megabytes | ['bitmasks', 'greedy', '*1700'] |
D. In Lovetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputInitially, you have an empty multiset of segments. You need to process q operations of two types: + l r — Add the segment (l, r) to the multiset, - l r — Remove exactly one segment (l, r) from the multiset. I... | 12+ 1 2+ 3 4+ 2 3+ 2 2+ 3 4- 3 4- 3 4- 1 2+ 3 4- 2 2- 2 3- 3 4 | NO YES YES YES YES YES NO NO YES NO NO NO | 2 seconds | 256 megabytes | ['data structures', 'greedy', '*1500'] |
C. Raspberriestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \ldots, a_n and a number k (2 \leq k \leq 5). In one operation, you can do the following: Choose an index 1 \leq i \leq n, Set a_i = a_i + 1.Find the minimum n... | 152 57 33 37 4 15 29 7 7 3 95 55 4 1 2 37 49 5 1 5 9 5 13 46 3 63 46 1 53 41 5 94 41 4 1 13 43 5 34 58 9 9 32 51 62 510 104 51 6 1 12 57 7 | 2 2 1 0 2 0 1 2 0 1 1 4 0 4 3 | 2 seconds | 256 megabytes | ['dp', 'math', '*1000'] |
B. Chemistrytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n, consisting of lowercase Latin letters, and an integer k.You need to check if it is possible to remove exactly k characters from the string s in such a way that the rema... | 141 0a2 0ab2 1ba3 1abb3 2abc6 2bacacd6 2fagbza6 2zwaafa7 2taagaak14 3ttrraakkttoorr5 3debdb5 4ecadc5 3debca5 3abaac | YES NO YES YES YES YES NO NO YES YES YES YES NO YES | 2 seconds | 256 megabytes | ['strings', '*900'] |
A. Morningtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a four-digit pin code consisting of digits from 0 to 9 that needs to be entered. Initially, the cursor points to the digit 1. In one second, you can perform exactly one of the following two acti... | 101111123610101920927300007492854302948361 | 4 9 31 27 28 13 25 16 33 24 | 2 seconds | 256 megabytes | ['math', '*800'] |
E2. Two Permutations (Hard Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The difference between the two versions is that you have to minimize the number of operations in this version. You can make hacks only if both... | 3 5
2 1 3
5 2 1 4 3
| 2 3 4 2 4 | 2 seconds | 256 megabytes | ['constructive algorithms', '*3100'] |
E1. Two Permutations (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The difference between the two versions is that you do not have to minimize the number of operations in this version. You can make hacks only ... | 3 5
2 1 3
5 2 1 4 3
| 2 3 4 2 4 | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'number theory', '*2400'] |
D. Tree XORtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a tree with n vertices labeled from 1 to n. An integer a_{i} is written on vertex i for i = 1, 2, \ldots, n. You want to make all a_{i} equal by performing some (possibly, zero) spells.Suppose ... | 243 2 1 01 22 32 41100 | 8 6 12 10 0 | 3 seconds | 512 megabytes | ['bitmasks', 'dfs and similar', 'dp', 'greedy', 'trees', '*1900'] |
C. Card Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cards stacked in a deck. Initially, a_{i} is written on the i-th card from the top. The value written on a card does not change.You will play a game. Initially your score is 0. In each turn, you... | 44-4 1 -3 541 -2 3 -43-1 3 -51-1 | 5 4 2 0 | 2 seconds | 256 megabytes | ['brute force', 'greedy', '*1500'] |
B. Sets and Uniontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n sets of integers S_{1}, S_{2}, \ldots, S_{n}. We call a set S attainable, if it is possible to choose some (possibly, none) of the sets S_{1}, S_{2}, \ldots, S_{n} so that S is equal to thei... | 433 1 2 32 4 52 3 444 1 2 3 43 2 5 63 3 5 63 4 5 651 13 3 6 101 92 1 33 5 8 912 4 28 | 4 5 6 0 | 2 seconds | 256 megabytes | ['bitmasks', 'brute force', 'constructive algorithms', 'greedy', '*1300'] |
A. Increasing Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a sequence a_{1}, a_{2}, \ldots, a_{n}. A sequence b_{1}, b_{2}, \ldots, b_{n} is called good, if it satisfies all of the following conditions: b_{i} is a positive integer for i = 1... | 351 3 2 6 742 3 4 511 | 8 4 2 | 1 second | 256 megabytes | ['greedy', '*800'] |
G. Anya and the Mysterious Stringtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya received a string s of length n brought from Rome. The string s consists of lowercase Latin letters and at first glance does not raise any suspicions. An instruction was attached t... | 512 8tedubcyyxopz2 2 51 4 8 22 1 71 3 5 401 9 11 31 10 10 92 4 102 10 1210 4ubnxwwgzjt2 4 102 10 101 6 10 82 7 711 3hntcxfxyhtu1 4 6 12 4 101 4 10 2113 2yxhlmzfhqctir1 5 9 31 8 13 152 3bp1 1 2 151 1 2 181 2 2 1000000000 | YES NO NO YES NO YES YES YES | 3 seconds | 256 megabytes | ['binary search', 'data structures', '*2000'] |
F. Minimum Maximum Distancetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a tree with n vertices, some of which are marked. A tree is a connected undirected graph without cycles.Let f_i denote the maximum distance from vertex i to any of the marked vertice... | 67 32 6 71 21 32 42 53 63 74 41 2 3 41 22 33 45 111 21 31 41 55 24 51 22 31 44 510 81 2 3 4 5 8 9 102 1010 55 33 11 77 44 98 96 110 91 2 4 5 6 7 8 9 101 33 99 44 1010 66 77 22 55 8 | 2 2 0 1 4 5 | 2 seconds | 256 megabytes | ['dfs and similar', 'dp', 'graphs', 'shortest paths', 'trees', '*1700'] |
E. Block Sequencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a sequence of integers a of length n.A sequence is called beautiful if it has the form of a series of blocks, each starting with its length, i.e., first comes the length of the block, and then it... | 773 3 4 5 2 6 145 6 3 263 4 1 6 7 731 4 351 2 3 4 551 2 3 1 254 5 5 1 5 | 0 4 1 1 2 1 0 | 2 seconds | 256 megabytes | ['dp', '*1500'] |
D. Divide and Equalizetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n positive integers. You can perform the following operation on it: Choose a pair of elements a_i and a_j (1 \le i, j \le n and i \neq j); Choose one of t... | 75100 2 50 10 131 1 148 2 4 2430 50 27 20275 4024 432 3 1 | YES YES NO YES NO YES NO | 2 seconds | 256 megabytes | ['math', 'number theory', '*1300'] |
C. Perfect Squaretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKristina has a matrix of size n by n, filled with lowercase Latin letters. The value of n is even.She wants to change some characters so that her matrix becomes a perfect square. A matrix is called a p... | 54abbabcbbbccbabba2abba6codeforcescodeforcescodeforcescodefo4baaaabbabababaab4bbaaabbaaabaabba | 1 2 181 5 9 | 2 seconds | 256 megabytes | ['brute force', 'implementation', '*1200'] |
B. Three Threadletstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce upon a time, bartender Decim found three threadlets and a pair of scissors.In one operation, Decim chooses any threadlet and cuts it into two threadlets, whose lengths are positive integers and ... | 151 3 25 5 56 36 127 8 76 3 34 4 1212 6 81000000000 1000000000 10000000003 7 19 9 19 3 62 8 25 3 108 4 82 8 4 | YES YES NO NO YES YES NO YES NO NO YES YES NO YES NO | 2 seconds | 256 megabytes | ['math', '*900'] |
A. Don't Try to Counttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a string x of length n and a string s of length m (n \cdot m \le 25), consisting of lowercase Latin letters, you can apply any number of operations to the string x.In one operation, you appen... | 121 5aaaaaa5 5eforcforce2 5abababa3 5abaababa4 3babbbbb5 1aaaaaa4 2aabbba2 8bkkbkbkbkb12 2fjdgmujlconttf2 2aaaa3 5abbbabba1 19mmmmmmmmmmmmmmmmmmmm | 3 1 2 -1 1 0 1 3 1 0 2 5 | 2 seconds | 256 megabytes | ['brute force', 'strings', '*800'] |
F. Last Man Standingtime limit per test7 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n heroes in a videogame. Each hero has some health value h and initial armor value a. Let the current value of armor be a_{\mathit{cur}}, initially equal to a.When x points of damage are i... | 333 1 23 11 5110020045 9 5 19 2 9 10 | 1 1 1 20000 0 4 0 0 | 7 seconds | 512 megabytes | ['brute force', 'data structures', 'number theory', '*2800'] |
E. Interactive Game with Coloringtime limit per test2 secondsmemory limit per test512 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()... | 5
1 1 1 1
0
1
1 | 1 1 1 1 1 1 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'dfs and similar', 'graphs', 'implementation', 'interactive', 'trees', '*2400'] |
D. Sum of XOR Functionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n consisting of non-negative integers.You have to calculate the value of \sum_{l=1}^{n} \sum_{r=l}^{n} f(l, r) \cdot (r - l + 1), where f(l, r) is a_l \oplus a_... | 3
1 3 2
| 12 | 2 seconds | 256 megabytes | ['bitmasks', 'combinatorics', 'divide and conquer', 'dp', 'math', '*1700'] |
C. Make it Alternatingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a binary string s. A binary string is a string consisting of characters 0 and/or 1.You can perform the following operation on s any number of times (even zero): choose an integer i ... | 3100101110101 | 1 2 2 6 0 1 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'greedy', '*1300'] |
B. Chips on the Boardtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a board of size n \times n (n rows and n colums) and two arrays of positive integers a and b of size n.Your task is to place the chips on this board so that the following condition is... | 431 4 13 2 214524 52 355 2 4 5 33 4 2 1 5 | 10 9 13 24 | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', '*900'] |
A. Rigged!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp organizes a weightlifting competition. There are n athletes participating in the competition, the i-th athlete has strength s_i and endurance e_i. The 1-st athlete is Monocarp's friend Polycarp, and ... | 347 49 34 62 224 6100 10021337 31337 3 | 5 -1 -1 | 2 seconds | 256 megabytes | ['greedy', '*800'] |
G. wxhtzdy ORO Treetime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter (finally) qualifying for the IOI 2023, wxhtzdy was very happy, so he decided to do what most competitive programmers do: trying to guess the problems that will be on IOI. During this process, h... | 341 2 3 41 31 21 431 11 31 437 6 33 12 141 11 21 32 31411 1 | 2 4 3 6 6 6 6 2 | 5 seconds | 256 megabytes | ['binary search', 'bitmasks', 'brute force', 'data structures', 'dfs and similar', 'implementation', 'trees', '*2300'] |
F. Vasilije Loves Number Theorytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVasilije is a smart student and his discrete mathematics teacher Sonja taught him number theory very well.He gave Ognjen a positive integer n.Denote d(n) as the number of positive integer... | 71 51 11 221 81 920 41 321 71 1216 101 61 61 101 91 11 91 71 31 21 109 11 38 11 28 31 51 81 1011 51 81 21 11 31 1 | YES YES YES YES YES NO YES YES NO YES YES YES NO YES NO YES YES NO NO YES NO NO YES NO NO NO NO | 2 seconds | 256 megabytes | ['brute force', 'math', 'number theory', '*1900'] |
E. Iva & Pavtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIva and Pav are a famous Serbian competitive programming couple. In Serbia, they call Pav "papuca" and that's why he will make all of Iva's wishes come true.Iva gave Pav an array a of n elements.Let's defin... | 3515 14 17 42 3431 72 154 557 5 3 1 741 75 72 32 2719 20 15 12 21 7 1141 154 47 125 7 | 2 -1 5 1 5 2 2 2 6 -1 5 | 5 seconds | 256 megabytes | ['binary search', 'bitmasks', 'data structures', 'greedy', '*1400'] |
D. Reverse Madnesstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n, containing lowercase Latin letters. Next you will be given a positive integer k and two arrays, l and r of length k.It is guaranteed that the following conditions ... | 54 2abcd1 32 421 35 3abcde1 2 31 2 531 2 33 1gaf1322 210 1aghcdegdij11051 2 3 4 21 1a1111 | badc abedc gaf jihgedcdga a | 1 second | 256 megabytes | ['data structures', 'greedy', '*1600'] |
C. Vasilije in Cacaktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAca and Milovan, two fellow competitive programmers, decided to give Vasilije a problem to test his skills.Vasilije is given three positive integers: n, k, and x, and he has to determine if he can ch... | 125 3 105 3 310 10 556 5 202 1 26187856 87856 2609202300200000 190000 1900000000028 5 20042 2 20069 6 4047202 32455 613407217185977 145541 15770805980 | YES NO YES YES NO NO YES NO NO NO YES YES | 1 second | 256 megabytes | ['math', '*900'] |
B. Aleksa and Stacktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter the Serbian Informatics Olympiad, Aleksa was very sad, because he didn't win a medal (he didn't know stack), so Vasilije came to give him an easy problem, just to make his day better.Vasilije g... | 3367 | 6 8 12 7 11 14 20 22 100 9 15 18 27 36 90 120 | 2 seconds | 256 megabytes | ['constructive algorithms', 'math', '*800'] |
A. How Much Does Daytona Cost?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe define an integer to be the most common on a subsegment, if its number of occurrences on that subsegment is larger than the number of occurrences of any other integer in that subsegment.... | 75 41 4 3 4 14 12 3 4 45 643 5 60 4 22 51 54 15 3 3 11 335 33 4 1 5 5 | YES NO NO YES YES YES YES | 1 second | 256 megabytes | ['greedy', '*800'] |
C. Joyboardtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputChaneka, a gamer kid, invented a new gaming controller called joyboard. Interestingly, the joyboard she invented can only be used to play one game.The joyboard has a screen containing n+1 slots numbered from ... | 44 6 32 0 1265 265 2653 10 2 | 2 1 0 5 | 1 second | 256 megabytes | ['math', 'number theory', '*1200'] |
A. Goals of Victorytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n teams in a football tournament. Each pair of teams match up once. After every match, Pak Chanek receives two integers as the result of the match, the number of goals the two teams score du... | 243 -4 511-30 12 -57 7 0 -81 -68 41 -89 0 | -4 265 | 1 second | 256 megabytes | ['math', '*800'] |
G. Clubsteptime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThere is an extremely hard video game that is one of Chaneka's favourite video games. One of the hardest levels in the game is called Clubstep. Clubstep consists of n parts, numbered from 1 to n. Chaneka ha... | 5
1 3 2 1 2
3
1 5 5
2 4 5
3 3 1
| 15 11 0 | 3 seconds | 1024 megabytes | ['binary search', 'brute force', 'data structures', 'greedy', 'trees', '*3500'] |
F. Indefinite Clownfishtime limit per test3.5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek has just bought an empty fish tank and he has been dreaming to fill it with his favourite kind of fish, clownfish. Pak Chanek likes clownfish because of their ability to change their... | 9 6
2 4 2 3 2 4 1 3 4
| 6 | 3.5 seconds | 512 megabytes | ['binary search', 'graphs', '*3500'] |
E. Ball-Stackabletime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputWith a problem title like that, there is no way this is going to be a graph problem.Chaneka has a graph with n vertices and n-1 edges. Some of the edges are directed and some of the edges are undirecte... | 5
2 5 1
1 3 0
5 4 0
1 5 1
| 3 1 5 2 5 4 1 2 5 2 3 1 3 | 2 seconds | 512 megabytes | ['constructive algorithms', 'data structures', 'dp', 'trees', '*3300'] |
D. Lexichromatographytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek loves his faculty, the Faculty of Computer Science, University of Indonesia (Fasilkom). He wants to play with the colours of the faculty's logo, blue and red.There is an array a consisti... | 8
1 3 1 2 3 2 3 3
| 3 | 2 seconds | 512 megabytes | ['combinatorics', 'dfs and similar', 'dsu', 'graphs', 'two pointers', '*2500'] |
C. Autosynthesistime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChaneka writes down an array a of n positive integer elements. Initially, all elements are not circled. In one operation, Chaneka can circle an element. It is possible to circle the same element more th... | 5
3 4 2 2 3
| 3 3 2 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'greedy', 'sortings', '*2100'] |
B. Effects of Anti Pimplestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChaneka has an array [a_1,a_2,\ldots,a_n]. Initially, all elements are white. Chaneka will choose one or more different indices and colour the elements at those chosen indices black. Then, she... | 4
19 14 19 9
| 265 | 2 seconds | 256 megabytes | ['combinatorics', 'number theory', 'sortings', '*1500'] |
A. Helmets in Night Lighttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPak Chanek is the chief of a village named Khuntien. On one night filled with lights, Pak Chanek has a sudden and important announcement that needs to be notified to all of the n residents in Kh... | 36 32 3 2 1 1 34 3 2 6 3 61 10000010000014 941 4 2 3103 96 86 57 | 16 100000 265 | 1 second | 256 megabytes | ['greedy', 'sortings', '*1000'] |
D. Jellyfish and Mextime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of n nonnegative integers a_1, a_2, \dots, a_n. Let m be a variable that is initialized to 0, Jellyfish will perform the following operation n times: select an index i (1 \leq... | 485 2 1 0 3 0 4 021 251 0 2 114514 080 1 2 0 1 2 0 3 | 3 0 2 7 | 1 second | 256 megabytes | ['dp', '*1600'] |
C. Jellyfish and Green Appletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJellyfish has n green apple pieces. Each green apple piece weighs 1~\text{kg}. Jellyfish wants to divide these green apple pieces equally among m people.Jellyfish has a magic knife. Each time... | 410 51 510 43 4 | 0 -1 2 5 | 1 second | 256 megabytes | ['bitmasks', 'greedy', 'math', 'number theory', '*1400'] |
A. Jellyfish and Undertaletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFlowey has planted a bomb in Snowdin!The bomb has a timer that is initially set to b. Every second, the timer will decrease by 1. When the timer reaches 0, the bomb will explode! To give the re... | 25 3 31 1 77 1 51 2 5 6 8 | 9 21 | 1 second | 256 megabytes | ['brute force', 'greedy', '*900'] |
G. Jellyfish and Inscryptiontime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputJellyfish loves playing a game called "Inscryption" which is played on a directed acyclic graph with n vertices and m edges. All edges a \to b satisfy a < b.You need to move from vertex 1 t... | 6 8
0
1 2 10
1 6 6
2 8
3 10
0
1 2
1 3
2 4
2 5
3 4
3 5
4 6
5 6
| 100000000000 | 2 seconds | 1024 megabytes | ['dp', '*3500'] |
F. Jellyfish and OEIStime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputJellyfish always uses OEIS to solve math problems, but now she finds a problem that cannot be solved by OEIS:Count the number of permutations p of [1, 2, \dots, n] such that for all (l, r) such tha... | 3
1 2 3
| 2 | 2 seconds | 512 megabytes | ['dp', '*3500'] |
E. Jellyfish and Hacktime limit per test8 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIt is well known that quick sort works by randomly selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or gre... | 4 10
| 8 | 8 seconds | 512 megabytes | ['dp', 'math', '*3000'] |
D. Jellyfish and Mikutime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n + 1 cities with numbers from 0 to n, connected by n roads. The i-th (1 \leq i \leq n) road connects city i-1 and city i bi-directionally. After Jellyfish flew back to city 0, she found ... | 3 8
| 5.200000000000 | 2 seconds | 512 megabytes | ['divide and conquer', 'dp', 'math', 'probabilities', '*2800'] |
C. Jellyfish and EVAtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMonsters have invaded the town again! Asuka invites her good friend, Jellyfish, to drive EVA with her.There are n cities in the town. All the monsters are in city n. Jellyfish and Asuka are currentl... | 33 21 21 37 81 21 31 41 52 63 64 66 710 201 21 31 41 51 62 62 72 82 93 43 73 83 104 64 84 106 107 87 97 10 | 0.500000000000 0.625000000000 0.491666666667 | 2 seconds | 512 megabytes | ['dp', 'graphs', 'greedy', 'math', 'probabilities', '*2300'] |
B. Jellyfish and Mathtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputJellyfish is given the non-negative integers a, b, c, d and m. Initially (x,y)=(a,b). Jellyfish wants to do several operations so that (x,y)=(c,d).For each operation, she can do one of the followin... | 101 0 1 1 13 3 1 2 11 6 0 7 12 4 4 9 821 4 0 17 2850 50 0 0 3995 33 1 33 110138 202 174 64 10878 340 68 340 461457 291 491 566 766 | 1 -1 2 -1 -1 2 1 4 1 3 | 2 seconds | 512 megabytes | ['bitmasks', 'brute force', 'dfs and similar', 'dp', 'graphs', 'shortest paths', '*2400'] |
A. Jellyfish and Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJellyfish has n green apples with values a_1, a_2, \dots, a_n and Gellyfish has m green apples with values b_1,b_2,\ldots,b_m.They will play a game with k rounds. For i=1,2,\ldots,k in this order, t... | 42 2 11 23 41 1 10000124 5 110371 1 4 51 9 1 9 81 1 121 | 6 1 19 2 | 1 second | 256 megabytes | ['brute force', 'games', 'greedy', 'implementation', '*1200'] |
H. Mad Citytime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMarcel and Valeriu are in the mad city, which is represented by n buildings with n two-way roads between them. Marcel and Valeriu start at buildings a and b respectively. Marcel wants to catch Valeriu, in ot... | 63 2 12 13 21 34 1 41 41 21 32 34 1 21 22 32 43 47 1 14 12 15 34 64 27 53 48 5 38 35 12 66 81 24 85 76 710 6 11 24 35 87 810 41 92 48 16 23 1 | YES NO YES NO NO YES | 4 seconds | 256 megabytes | ['dfs and similar', 'dsu', 'games', 'graphs', 'shortest paths', 'trees', '*1700'] |
G. ABBC or BACBtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s made up of characters \texttt{A} and \texttt{B}. Initially you have no coins. You can perform two types of operations: Pick a substring^\dagger \texttt{AB}, change it to \texttt... | 8ABBAABABAABAABBAAAAAABBABABAAA | 2 1 3 1 6 2 0 0 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', '*1500'] |
F. Money Treestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLuca is in front of a row of n trees. The i-th tree has a_i fruit and height h_i.He wants to choose a contiguous subarray of the array [h_l, h_{l+1}, \dots, h_r] such that for each i (l \leq i < r), h_i i... | 55 123 2 4 1 84 4 2 4 14 85 4 1 26 2 3 13 127 9 102 2 41 101117 102 6 3 1 5 10 672 24 24 12 4 4 2 | 3 2 1 0 3 | 2 seconds | 256 megabytes | ['binary search', 'greedy', 'math', 'two pointers', '*1300'] |
E. Building an Aquariumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou love fish, that's why you have decided to build an aquarium. You have a piece of coral made of n columns, the i-th of which is a_i units tall. Afterwards, you will build a tank around the cor... | 57 93 1 2 4 6 2 53 101 1 14 11 4 3 46 19842 6 5 9 1 81 10000000001 | 4 4 2 335 1000000001 | 2 seconds | 256 megabytes | ['binary search', 'sortings', '*1100'] |
D. 1D Erasertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a strip of paper s that is n cells long. Each cell is either black or white. In an operation you can take any k consecutive cells and make them all white.Find the minimum number of operations n... | 86 3WBWWWB7 3WWBWBWW5 4BWBWB5 5BBBBB8 2BWBWBBBB10 2WBBWBBWBBW4 1BBBB3 2WWW | 2 1 2 1 4 3 4 0 | 1 second | 256 megabytes | ['greedy', 'implementation', 'two pointers', '*800'] |
C. Target Practicetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA 10 \times 10 target is made out of five "rings" as shown. Each ring has a different point value: the outermost ring — 1 point, the next ring — 2 points, ..., the center ring — 5 points. Vlad fired s... | 4X..........................X.......X..........X......................X..X..........................X................................................................................................................................................X.......................................................XXXXXXXXXXXXXXXXXXX... | 17 0 5 220 | 1 second | 256 megabytes | ['implementation', 'math', '*800'] |
B. Good Kidtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSlavic is preparing a present for a friend's birthday. He has an array a of n digits and the present will be the product of all these digits. Because Slavic is a good kid who wants to make the biggest product... | 442 2 1 230 1 254 3 2 3 499 9 9 9 9 9 9 9 9 | 16 2 432 430467210 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*800'] |
A. Short Sorttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are three cards with letters \texttt{a}, \texttt{b}, \texttt{c} placed in a row in some order. You can do the following operation at most once: Pick two cards, and swap them. Is it possible that th... | 6abcacbbacbcacabcba | YES YES YES NO NO YES | 1 second | 256 megabytes | ['brute force', 'implementation', '*800'] |
G. Replace With Producttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an array a of n positive integers. You need to perform the following operation exactly once: Choose 2 integers l and r (1 \le l \le r \le n) and replace the subarray a[l \ldots r] with the s... | 941 3 1 341 1 2 351 1 1 1 1510 1 10 1 101122 232 1 242 1 1 362 1 2 1 1 3 | 2 4 3 4 1 1 1 5 1 1 1 2 2 2 4 4 1 6 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*2000'] |
F. Selling a Menagerietime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are the owner of a menagerie consisting of n animals numbered from 1 to n. However, maintaining the menagerie is quite expensive, so you have decided to sell it!It is known that each animal is... | 832 3 26 6 182 1 4 3 6 5 8 71 2 1 2 2 1 2 152 1 1 1 19 8 1 1 122 11000000000 99999999972 3 2 6 4 4 31 2 3 4 5 6 753 4 4 1 33 4 5 6 732 1 11 2 242 1 4 11 1 1 1 | 1 2 3 2 4 5 1 6 3 7 8 3 4 5 1 2 1 2 7 5 1 3 2 6 4 5 3 2 4 1 3 2 1 3 4 1 2 | 2 seconds | 256 megabytes | ['dfs and similar', 'dsu', 'graphs', 'implementation', 'math', '*1800'] |
E. Data Structures Fantime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \ldots, a_n, as well as a binary string^{\dagger} s consisting of n characters.Augustin is a big fan of data structures. Therefore, he asked you to imp... | 551 2 3 4 50100072 02 11 2 42 02 11 1 32 1612 12 14 14 5 500100132 11 2 42 147 7 7 777111132 01 2 32 021000000000 9961791791112 151 42 20 47 70001151 3 41 1 11 3 41 2 42 0 | 3 2 6 7 7 11 7 0 0 16430827 47 | 2 seconds | 256 megabytes | ['binary search', 'bitmasks', 'data structures', 'dp', '*1500'] |
D. Plus Minus Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given 3 integers — n, x, y. Let's call the score of a permutation^\dagger p_1, \ldots, p_n the following value:(p_{1 \cdot x} + p_{2 \cdot x} + \ldots + p_{\lfloor \frac{n}{x} \rfloor \c... | 87 2 312 6 39 1 92 2 2100 20 5024 4 61000000000 5575 254504 4 1 | 12 -3 44 0 393 87 179179179436104 -6 | 1 second | 256 megabytes | ['math', '*1200'] |
C. Non-coprime Splittime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers l \le r. You need to find positive integers a and b such that the following conditions are simultaneously satisfied: l \le a + b \le r \gcd(a, b) \neq 1or report that they ... | 1111 151 318 1941 43777 7778000000 100000002000 20231791791 17917911 42 39840769 9840769 | 6 9 -1 14 4 36 6 111 666 4000000 5000000 2009 7 -1 2 2 -1 6274 9834495 | 1 second | 256 megabytes | ['math', 'number theory', '*1100'] |
B. The Corridor or There and Back Againtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are in a corridor that extends infinitely to the right, divided into square rooms. You start in room 1, proceed to room k, and then return to room 1. You can choose the value ... | 712 232 84 35 21200 20041 205 93 179100 1210 11 1821 11 231 31 11 3 | 2 5 299 9 9 1 1 | 2 seconds | 256 megabytes | ['greedy', 'implementation', '*900'] |
A. Two Vesselstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have two vessels with water. The first vessel contains a grams of water, and the second vessel contains b grams of water. Both vessels are very large and can hold any amount of water.You also have an e... | 63 7 217 4 317 17 117 21 1001 100 197 4 3 | 1 3 0 1 50 16 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*800'] |
H. Standard Graph Problemtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a weighted directed graph with n vertices and m edges. Each vertex in the graph can be either highlighted or normal. Initially, all vertices are normal. The cost of the graph is d... | 4 5 61 2 12 3 53 2 34 1 82 1 4+ 1- 1+ 3+ 1+ 4+ 2 | 15 -1 14 12 4 0 | 2 seconds | 512 megabytes | ['data structures', 'graphs', 'greedy', 'trees', '*3500'] |
G. MEXanizationtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet's define f(S). Let S be a multiset (i.e., it can contain repeated elements) of non-negative integers. In one operation, you can choose any non-empty subset of S (which can also contain repeated eleme... | 48179 57 2 0 2 3 2 31031 0 381 0 1 2 4 3 0 2 | 179 2 3 3 3 4 4 5 1 1 2 2 1 2 2 3 3 5 5 5 | 2 seconds | 512 megabytes | ['data structures', '*3300'] |
F. Lazy Numberstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given positive integers n and k. For each number from 1 to n, we write its representation in the number system with base k (without leading zeros) and then sort the resulting array in lexicograph... | 82 24 26 433 2532 13780011804570805480 3788366364720306464627 4702032149561577293940402103595405 2 | 2 2 1 3 1 3789 1 7 | 3 seconds | 256 megabytes | ['binary search', 'math', '*2900'] |
E. Another MEX Problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a of size n. You can choose a set of non-overlapping subarrays of the given array (note that some elements may be not included in any subarray, this is allowed). ... | 421 0101 2 0 7 1 2 0 2 4 3102 1 0 7 1 2 0 2 4 331 2 1 | 2 6 7 0 | 1 second | 256 megabytes | ['bitmasks', 'brute force', 'dp', 'shortest paths', '*2300'] |
D. Prefix Purchasetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have an array a of size n, initially filled with zeros (a_1 = a_2 = \ldots = a_n = 0). You also have an array of integers c of size n.Initially, you have k coins. By paying c_i coins, you can add 1... | 431 2 3523 4733 2 12610 6 4 6 3 47 | 5 0 0 2 1 2 2 2 2 2 2 2 2 1 | 1 second | 256 megabytes | ['greedy', 'implementation', 'sortings', '*1800'] |
C. Colorful Tabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers n and k. You are also given an array of integers a_1, a_2, \ldots, a_n of size n. It is known that for all 1 \leq i \leq n, 1 \leq a_i \leq k.Define a two-dimensional array b ... | 52 11 12 21 23 53 2 44 21 2 1 25 31 2 3 2 1 | 4 4 2 0 6 6 2 0 8 6 10 6 2 | 1 second | 256 megabytes | ['binary search', 'data structures', 'dp', 'implementation', 'math', 'two pointers', '*1300'] |
B. Friendly Arraystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two arrays of integers — a_1, \ldots, a_n of length n, and b_1, \ldots, b_m of length m. You can choose any element b_j from array b (1 \leq j \leq m), and for all 1 \leq i \leq n perfor... | 22 30 11 2 33 11 1 21 | 0 1 2 3 | 2 seconds | 256 megabytes | ['bitmasks', 'greedy', 'math', '*1200'] |
A. MEXanized Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three non-negative integers n, k, and x. Find the maximum possible sum of elements in an array consisting of non-negative integers, which has n elements, its MEX is equal to k, and all it... | 95 3 34 7 54 2 2812 10 657 51 122200 1 2002 2 13 2 14 7 10 | 7 -1 57 -1 2007 39800 1 2 -1 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', '*800'] |
B. 2D Travelingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPiggy lives on an infinite plane with the Cartesian coordinate system on it.There are n cities on the plane, numbered from 1 to n, and the first k cities are defined as major cities. The coordinates of th... | 56 2 3 50 01 -2-2 1-1 32 -2-3 -32 0 1 2-1000000000 -10000000001000000000 10000000007 5 4 2154 147-154 -147123 45620 2343 20998 244353 1003 1 3 10 101 202 304 3 2 40 0-100 100-1 -1-1 0 | 4 4000000000 0 22 1 | 1 second | 256 megabytes | ['geometry', 'math', 'shortest paths', 'sortings', '*1100'] |
A. Make It Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring Zhongkao examination, Reycloer met an interesting problem, but he cannot come up with a solution immediately. Time is running out! Please help him.Initially, you are given an array a consisting of ... | 641 2 3 083 1 4 1 5 9 2 661 5 4 1 4 750 0 0 0 071 1 9 9 0 1 83100 100 0 | 1 1 4 2 4 7 1 8 6 1 2 3 4 5 6 1 3 4 6 1 6 0 4 1 2 6 7 3 4 6 7 1 1 2 | 1 second | 256 megabytes | ['constructive algorithms', '*900'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.