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. LIS?time limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputEntering senior high school life, Tom is attracted by LIS problems, not only the Longest Increasing Subsequence problem, but also the Largest Interval Sum problem. Now he gets a really interesting problem from ... | 5
1 2 3 4 5
| 6 | 5 seconds | 1024 megabytes | ['data structures', 'greedy', 'implementation', '*3500'] |
E. Min-Sum-Maxtime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputTom is waiting for his results of Zhongkao examination. To ease the tense atmosphere, his friend, Daniel, decided to play a game with him. This game is called "Divide the Array".The game is about the arr... | 83-1 5 422023 204361 4 7 -1 5 -45-4 0 3 -18 10199824485310-4 2 5 -10 4 8 2 9 -15 77-7 3 8 -9 -2 2 44-5 5 -2 -5 | 2 1 3 2 1 6 5 3 | 5 seconds | 1024 megabytes | ['constructive algorithms', 'dp', 'greedy', '*3500'] |
D. Flower-like Pseudotreetime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA pseudotree is a connected graph which has exactly one cycle and no self-loops. Note that a pseudotree may contain multiple-edges. It can be shown that a pseudotree with n vertices always cont... | 632 2 241 2 3 474 3 3 1 1 1 161 1 2 2 3 3101 1 5 2 1 1 1 1 1 691 1 3 1 1 4 1 1 5 | Yes 1 2 2 3 3 1 No Yes 1 2 2 3 3 1 1 4 1 5 2 6 3 7 Yes 5 6 6 5 1 3 2 4 3 5 4 6 No Yes 3 6 6 9 9 3 1 3 2 6 4 6 5 9 7 9 8 9 | 3 seconds | 512 megabytes | ['constructive algorithms', 'graphs', 'greedy', 'implementation', 'trees', '*3000'] |
C. Travel Plantime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDuring the summer vacation after Zhongkao examination, Tom and Daniel are planning to go traveling.There are n cities in their country, numbered from 1 to n. And the traffic system in the country is very ... | 53 12 210 943 20154 147 | 6 19 583217643 68816635 714002110 | 2 seconds | 512 megabytes | ['combinatorics', 'dp', 'implementation', 'math', 'trees', '*2400'] |
B2. Candy Party (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 everyone must give candies to no more than one person and receive candies from no more than one person.... | 632 4 351 2 3 4 561 4 7 1 5 4220092043 20092043129 9 8 2 4 4 3 5 1 1 1 162 12 7 16 11 12 | Yes Yes No Yes No Yes | 2 seconds | 256 megabytes | ['bitmasks', 'constructive algorithms', 'dp', 'greedy', 'implementation', 'math', '*2100'] |
B1. Candy Party (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 everyone must give candies to exactly one person and receive candies from exactly one person. Note that... | 632 4 351 2 3 4 561 4 7 1 5 4220092043 20092043129 9 8 2 4 4 3 5 1 1 1 162 12 7 16 11 12 | Yes Yes No Yes No No | 2 seconds | 256 megabytes | ['bitmasks', 'constructive algorithms', 'graphs', 'greedy', 'implementation', 'math', '*1700'] |
A. Fill in the Matrixtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is an empty matrix M of size n\times m.Zhongkao examination is over, and Daniel would like to do some puzzle games. He is going to fill in the matrix M using permutations of length m. That is... | 44 31 166 62 1 | 3 1 0 2 0 2 1 1 0 2 0 2 1 2 14 7 15 4 10 0 8 6 1 2 3 5 9 11 12 13 6 3 0 1 4 2 5 5 2 1 0 4 3 1 3 2 4 5 0 4 1 3 2 5 0 4 2 5 3 0 1 2 4 0 5 1 3 0 0 0 | 2 seconds | 256 megabytes | ['constructive algorithms', 'implementation', '*1300'] |
F. Most Different Treetime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGiven a tree with n vertices rooted at vertex 1, denote it as G. Also denote P(G) as the multiset of subtrees of all vertices in tree G. You need to find a tree G' of size n rooted at vertex 1 suc... | 2
1 2
| 1 2 | 4 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'dfs and similar', 'greedy', 'hashing', '*2700'] |
E2. Salyg1n and Array (hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference between the versions is the limit on the number of queries. In this version, you can make no more than 57 queries. You can... | 2
4 2
6
4
6 6
4 | ? 1 ? 3 ! 2 ? 1 ! 4 | 1 second | 256 megabytes | ['constructive algorithms', 'interactive', '*2200'] |
E1. Salyg1n and Array (simple version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the simple version of the problem. The only difference between the versions is the limit on the number of queries. In this version, you can make no more than 100 queries. Yo... | 2
4 2
6
4
6 6
4 | ? 1 ? 3 ! 2 ? 1 ! 4 | 1 second | 256 megabytes | ['constructive algorithms', 'interactive', 'math', '*2000'] |
D. Cyclic Operationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEgor has an array a of length n, initially consisting of zeros. However, he wanted to turn it into another array b of length n.Since Egor doesn't take easy paths, only the following operation can be ... | 65 32 3 5 3 44 22 4 3 11 113 11 2 35 35 4 3 2 16 11 2 3 1 5 6 | YES NO YES YES NO NO | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'dfs and similar', 'graphs', 'greedy', 'implementation', '*1800'] |
C. Salyg1n and the MEX Gametime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem!salyg1n gave Alice a set S of n distinct integers s_1, s_2, \ldots, s_n (0 \leq s_i \leq 10^9). Alice decided to play a game with this set against Bob. The rule... | 3
5
1 2 3 5 7
7
5
-1
3
0 1 2
0
-1
3
5 7 57
-1 | 8 57 0 3 0 0 | 3 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'games', 'greedy', 'interactive', '*1300'] |
B. XOR Palindromestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a binary string s of length n (a string that consists only of 0 and 1). A number x is good if there exists a binary string l of length n, containing x ones, such that if each symbol s_i i... | 561010115000009100100011310011 | 0010100 111111 0011111100 0110 11 | 1 second | 256 megabytes | ['bitmasks', 'constructive algorithms', 'strings', '*1100'] |
A. green_gold_dog, array and permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputgreen_gold_dog has an array a of length n, and he wants to find a permutation b of length n such that the number of distinct numbers in the element-wise difference between array a... | 3110000021 1310 3 3 | 1 2 1 1 3 2 | 1 second | 256 megabytes | ['constructive algorithms', 'sortings', '*800'] |
M. Mighty Rock Towertime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek comes up with an idea in the midst of boredom to play a game. The game is a rock tower game. There is a big rock that is used as a base. There are also N small identical rocks that Pak Ch... | 2
80 50
| 499122186 | 2 seconds | 512 megabytes | ['brute force', 'combinatorics', 'dp', 'math', 'probabilities', '*2400'] |
L. Lihmuf Ballingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter working at a factory (Lihmuf Sorting), Lihmuf wants to play a game with his good friend, Pak Chanek. There are N boxes numbered from 1 to N. The i-th box contains i balls. Pak Chanek and Lihmuf w... | 3 1
| 1 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'math', '*2400'] |
K. Keen Tree Calculationtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere is a tree of N vertices and N-1 edges. The i-th edge connects vertices U_i and V_i and has a length of W_i.Chaneka, the owner of the tree, asks you Q times. For the j-th question, the foll... | 7
5 1 2
1 4 2
3 4 1
2 5 3
6 1 6
4 7 2
2
4 3
3 2
| 18 11 | 2 seconds | 512 megabytes | ['binary search', 'data structures', 'dp', 'geometry', 'graphs', 'implementation', 'trees', '*2500'] |
J. Jackets and Packetstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek has N jackets that are stored in a wardrobe. Pak Chanek's wardrobe has enough room for two stacks of jackets, namely the left stack and the right stack. Initially, all N jackets are in ... | 8 7 2
4 4 2 4 1 2 2 1
| 38 | 2 seconds | 512 megabytes | ['dp', '*2800'] |
I. Imagination Castletime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGiven a chessboard of size N \times M (N rows and M columns). Each row is numbered from 1 to N from top to bottom and each column is numbered from 1 to M from left to right. The tile in row r and c... | 4 5 3
1 3
4 4
1 5
| Chaneka | 2 seconds | 512 megabytes | ['dp', 'games', 'two pointers', '*2300'] |
H. Happy Setstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDefine a set A as a child of set B if and only if for each element of value x that is in A, there exists an element of value x+1 that is in B.Given integers N and K. In order to make Chaneka happy, you must... | 2 2
| 11 | 1 second | 256 megabytes | ['combinatorics', '*2100'] |
G. Grouped Carriagestime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek observes that the carriages of a train is always full on morning departure hours and afternoon departure hours. Therefore, the balance between carriages is needed so that it is not too cr... | 7
7 4 2 0 5 8 3
4 0 0 1 3 1 3
| 5 | 3 seconds | 512 megabytes | ['binary search', 'data structures', 'dp', 'flows', 'greedy', '*2100'] |
F. Freak Joker Processtime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputAfter the success of the basketball teams formed and trained by Pak Chanek last year (Basketball Together), Pak Chanek wants to measure the performance of each player that is considered as a supe... | 5
3 3 1 3 2
3 7 1 3 1
8
3 1
3 2
2 4 +
1 2 -
3 2
3 3
2 2 -
3 1
| 2 1 2 5 2 | 5 seconds | 1024 megabytes | ['binary search', 'data structures', 'sortings', '*3100'] |
E. Elevators of Tamemtime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere is a building named Taman Membeku (shortened as Tamem). The building has N floors numbered from 1 to N from bottom to top. The only way to move between floors in the building is to use elevat... | 9 8
3 4 4 3 4 2 7 6
1 2 7
1 3 9
2 2
1 4 5
1 3 5
2 2
1 7 3
1 2 1
| 114 | 5 seconds | 512 megabytes | ['dp', '*2700'] |
D. Digital Wallettime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are N arrays, each array has M positive integer elements The j-th element of the i-th array is A_{i,j}.Initially, Chaneka's digital wallet contains 0 money. Given an integer K. Chaneka will do M-... | 3 3 1
10 4 2
8 1 9
4 8 2
| 27 | 2 seconds | 512 megabytes | ['dp', 'greedy', '*2300'] |
C. Completely Searching for Inversionstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPak Chanek has a directed acyclic graph (a directed graph that does not have any cycles) containing N vertices. Vertex i has S_i edges directed away from that vertex. The j-th edge... | 5
2
4 0
3 1
0
1
2 0
2
3 1
5 1
0
| 4 | 2 seconds | 512 megabytes | ['dfs and similar', 'dp', 'graphs', '*1900'] |
B. Battling with Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOn the trip to campus during the mid semester exam period, Chaneka thinks of two positive integers X and Y. Since the two integers can be very big, both are represented using their prime factoris... | 4
2 3 5 7
2 1 1 2
2
3 7
1 1
| 8 | 1 second | 256 megabytes | ['combinatorics', 'math', 'number theory', '*1400'] |
A. Ambitious Kidtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputChaneka, Pak Chanek's child, is an ambitious kid, so Pak Chanek gives her the following problem to test her ambition.Given an array of integers [A_1, A_2, A_3, \ldots, A_N]. In one operation, Chaneka can... | 3
2 -6 5
| 2 | 1 second | 256 megabytes | ['math', '*800'] |
I. Future Dominatorstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDhruvil and amenotiomoi are sitting in different countries and chatting online. Initially, amenotiomoi has an empty board of size n \times n, and Dhruvil has a sequence of integers 1, 2, \ldots, n^2... | 32 41 16 63 01 23 92 18 114 44 42 04 411 101 33 21 11 1 | 4 2 3 1 9 7 6 3 5 8 2 1 4 1 | 4 seconds | 256 megabytes | ['graphs', 'greedy', '*3500'] |
H. Asterism Streamtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBogocubic is playing a game with amenotiomoi. First, Bogocubic fixed an integer n, and then he gave amenotiomoi an integer x which is initially equal to 1.In one move amenotiomoi performs one of the f... | 714815998244353296574916252563317494288321850420024 | 0 499122179 717488133 900515847 93715054 44488799 520723508 | 3 seconds | 256 megabytes | ['dp', 'math', 'matrices', '*3200'] |
G. Magic Squaretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAquamoon has a Rubik's Square which can be seen as an n \times n matrix, the elements of the matrix constitute a permutation of numbers 1, \ldots, n^2.Aquamoon can perform two operations on the matrix: ... | 431 2 34 5 67 8 97 2 31 4 56 8 931 2 34 5 67 8 93 2 16 5 49 7 831 2 34 5 67 8 97 8 12 3 45 6 931 2 34 5 67 8 93 8 45 1 97 6 2 | 1 0 0 4 | 2 seconds | 256 megabytes | ['combinatorics', 'constructive algorithms', 'implementation', '*3100'] |
F. Exotic Queriestime limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputAquaMoon gives RiverHamster a sequence of integers a_1,a_2,\dots,a_n, and RiverHamster gives you q queries. Each query is expressed by two integers l and r. For each query independently, you can take ... | 10 8
1 6 2 3 2 6 3 10 1 2
1 10
2 2
3 3
2 3
1 3
3 6
4 6
5 5
| 8 1 1 3 5 3 1 0 | 4 seconds | 1024 megabytes | ['data structures', 'implementation', 'sortings', '*2300'] |
E. Guess Gametime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCarol has a sequence s of n non-negative integers. She wants to play the "Guess Game" with Alice and Bob.To play the game, Carol will randomly select two integer indices i_a and i_b within the range [1, n]... | 422 330 0 039 9 6834124838 0 113193378 8 321939321 113193378 9463828 99 | 499122179 1 332748120 77987843 | 3 seconds | 256 megabytes | ['bitmasks', 'data structures', 'games', 'math', 'probabilities', 'sortings', 'strings', 'trees', '*2100'] |
D. Matrix Cascadetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere is a matrix of size n \times n which consists of 0s and 1s. The rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. The cell at the intersec... | 35001000111011111111111111131001101106010101111101011110000000111010001110 | 1 2 15 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'data structures', 'dp', 'greedy', 'math', '*1700'] |
C. Divisor Chaintime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer x. Your task is to reduce x to 1.To do that, you can do the following operation: select a divisor d of x, then change x to x-d, i.e. reduce x by d. (We say that d is a divisor o... | 33514 | 3 3 2 1 4 5 4 2 1 6 14 12 6 3 2 1 | 1 second | 256 megabytes | ['bitmasks', 'constructive algorithms', 'math', 'number theory', '*1300'] |
B. Swap and Reversetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n consisting of lowercase English letters, and an integer k. In one step you can perform any one of the two operations below: Pick an index i (1 \le i \le n - 2) an... | 54 2nima5 3panda9 2theforces7 3amirfar6 4rounds | aimn aandp ceefhorst aafmirr dnorsu | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'sortings', 'strings', '*1100'] |
A. Increasing and Decreasingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three integers x, y, and n.Your task is to construct an array a consisting of n integers which satisfies the following conditions: a_1=x, a_n=y; a is strictly increasing (i.e.... | 31 4 31 3 3100 200 4 | 1 3 4 -1 100 150 180 200 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', 'math', '*800'] |
I. Redundant Routestime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a tree with n vertices labeled 1, 2, \ldots, n. The length of a simple path in the tree is the number of vertices in it.You are to select a set of simple paths of length at least 2 eac... | 4
1 2
1 3
1 4
| 3 | 5 seconds | 1024 megabytes | ['constructive algorithms', 'dp', 'trees', '*3500'] |
H. Goldberg Machine 3time limit per test8 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThere is a complete rooted binary tree, that is, a rooted tree in which each vertex has either 0 or 2 children. The root of the tree is vertex 1. A node without children is called a leaf. Each lea... | 5
1 1 2 2
0 0 0 0 0
5
3 1
4 1
5 1
3 4
4 1000000000
| 0 1 2 3 7 7022585 | 8 seconds | 1024 megabytes | ['dp', 'trees', '*3500'] |
G. Swapstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a_1, a_2, \dots, a_n (1 \le a_i \le n). You can perform the following operation several (possibly, zero) times: pick an arbitrary i and perform swap(a_i, a_{a_i}). How many d... | 31 1 2 | 2 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'graphs', 'math', '*2800'] |
F. Divide, XOR, and Conquertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of n integers a_1, a_2, \ldots, a_n.In one operation you split the array into two parts: a non-empty prefix and a non-empty suffix. The value of each part is the bitwis... | 663 2 1 3 7 451 1 1 1 1101 2 4 8 4 1 2 3 4 550 0 0 0 051 2 3 0 11100500 | 111111 10101 0001000000 11111 11001 1 | 2 seconds | 256 megabytes | ['bitmasks', 'dp', 'math', '*2600'] |
E. Speedruntime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing a video game. The game has n quests that need to be completed. However, the j-th quest can only be completed at the beginning of hour h_j of a game day. The game day is k hours long. The hour... | 64 4 2412 16 18 121 21 32 43 44 3 102 6 5 91 42 43 42 1 105 51 25 0 10008 800 555 35 355 0 103 2 5 4 73 2 54 3 21 22 3 | 24 7 0 480 5 8 | 2 seconds | 256 megabytes | ['brute force', 'dfs and similar', 'dp', 'graphs', 'greedy', 'math', 'sortings', 'two pointers', '*2100'] |
D. Two-Colored Dominoestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is an n\times m board divided into cells. There are also some dominoes on this board. Each domino covers two adjacent cells (that is, two cells that share a side), and no two dominoes overla... | 34 6..LR..ULRU..DLRDUU..LRDD5 4.LR..UU.UDDUD..DLR..2 2.... | ..WB.. WWBB.. BBWWWB ..BWBW -1 .. .. | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', '*1400'] |
C. MEX Repetitiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a_1,a_2,\ldots, a_n of pairwise distinct integers from 0 to n. Consider the following operation: consecutively for each i from 1 to n in this order, replace a_i with \operatorna... | 51 213 10 1 32 20 25 51 2 3 4 510 1005 3 0 4 2 1 6 9 10 8 | 1 2 0 1 2 1 2 3 4 5 0 7 5 3 0 4 2 1 6 9 10 | 2 seconds | 256 megabytes | ['implementation', 'math', '*1100'] |
B. Split Sorttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation^{\dagger} p_1, p_2, \ldots, p_n of integers 1 to n.You can change the current permutation by applying the following operation several (possibly, zero) times: choose some x (2 \l... | 51122 166 4 3 5 2 133 1 21910 19 7 1 17 11 8 5 12 9 4 18 14 2 6 15 3 16 13 | 0 1 4 1 7 | 1 second | 256 megabytes | ['greedy', 'math', 'sortings', '*1100'] |
A. Channeltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya is an administrator of a channel in one of the messengers. A total of n people are subscribed to his channel, and Petya is not considered a subscriber.Petya has published a new post on the channel. At th... | 45 5 3--+5 2 3++-5 4 2-+5 0 7++++-++ | YES NO MAYBE YES | 1 second | 256 megabytes | ['greedy', 'implementation', '*800'] |
G. The Great Equalizertime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTema bought an old device with a small screen and a worn-out inscription "The Great Equalizer" on the side.The seller said that the device needs to be given an array a of integers as input, after ... | 432 4 831 62 103 151 2 2 2 215 325 671 21 71 72 51 22 72 252 5 1 10 6101 74 82 51 42 83 41 93 73 43 1 | 10 12 15 4 10 8 8 9 8 12 2 14 12 12 11 11 10 11 10 11 14 | 4 seconds | 256 megabytes | ['binary search', 'data structures', 'math', 'sortings', '*2000'] |
F. Magic Will Save the Worldtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA portal of dark forces has opened at the border of worlds, and now the whole world is under a terrible threat. To close the portal and save the world, you need to defeat n monsters that eme... | 42 332 6 737 58193190 90223 9713 4410 10 2 45 | 3 2 1 5 | 4 seconds | 256 megabytes | ['binary search', 'bitmasks', 'brute force', 'dp', '*1800'] |
E. Kolya and Movie Theatretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently, Kolya found out that a new movie theatre is going to be opened in his city soon, which will show a new movie every day for n days. So, on the day with the number 1 \le i \le n, the m... | 65 2 23 2 5 4 64 3 21 1 1 16 6 6-82 45 1 -77 39 115 2 23 2 5 4 82 1 1-1 26 3 2-8 8 -2 -1 9 0 | 2 0 60 3 0 7 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'greedy', '*1600'] |
D. Ice Cream Ballstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTema decided to improve his ice cream making skills. He has already learned how to make ice cream in a cone using exactly two balls.Before his ice cream obsession, Tema was interested in mathematics. T... | 51361791000000000000000000 | 2 3 4 27 2648956421 | 1 second | 256 megabytes | ['binary search', 'combinatorics', 'constructive algorithms', 'math', '*1300'] |
C. Flower City Fencetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnya lives in the Flower City. By order of the city mayor, she has to build a fence for herself.The fence consists of n planks, each with a height of a_i meters. According to the order, the heights ... | 755 4 3 2 133 1 134 2 11255 3 3 1 155 5 5 3 326 1 | YES YES NO NO YES YES NO | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'implementation', 'sortings', '*1100'] |
B. Sequence Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTema and Vika are playing the following game.First, Vika comes up with a sequence of positive integers a of length m and writes it down on a piece of paper. Then she takes a new piece of paper and write... | 634 6 331 2 351 7 9 5 7114421 151 2 2 1 1 | 6 4 3 2 6 3 3 3 1 2 3 6 1 7 9 3 5 7 1 144 2 1 1 6 1 2 2 1 1 1 | 2 seconds | 256 megabytes | ['constructive algorithms', '*800'] |
A. Gift Carpettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently, Tema and Vika celebrated Family Day. Their friend Arina gave them a carpet, which can be represented as an n \cdot m table of lowercase Latin letters.Vika hasn't seen the gift yet, but Tema knows... | 51 4vika3 3badcarpet4 4vvvviiiikkkkaaaa4 4vkakiiaiavvkviaa4 7vbickdavbickdavbickdavbickda | YES NO YES NO YES | 1 second | 256 megabytes | ['dp', 'greedy', 'implementation', 'strings', '*800'] |
F. Four Suitstime limit per test6 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThe game of Berland poker is played as follows. There are n+1 people: n players, numbered from 1 to n, and the dealer. The dealer has a deck which contains cards of four different suits (the number of car... | 2
3 1 1 1
1 1 1 1
2 2 0 0
| 1 0 | 6 seconds | 1024 megabytes | ['binary search', 'bitmasks', 'flows', 'greedy', '*3200'] |
E. Non-Intersecting Subpermutationstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given two integers n and k.For an array of length n, let's define its cost as the maximum number of contiguous subarrays of this array that can be chosen so that: each eleme... | 10 3
| 71712 | 2 seconds | 512 megabytes | ['combinatorics', 'dp', 'implementation', 'math', '*2300'] |
D. Sorting By Multiplicationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n, consisting of positive integers. You can perform the following operation on this array any number of times (possibly zero): choose three integers l, r... | 351 1 2 2 265 4 3 2 5 131 2 3 | 3 2 0 | 2 seconds | 256 megabytes | ['dp', 'greedy', '*1800'] |
C. Queries for the Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp had an array a consisting of integers. Initially, this array was empty.Monocarp performed three types of queries to this array: choose an integer and append it to the end of the array.... | 7++1+++1--0+00++0-+1-+0++0+-1+-0+1-+0 | YES NO NO NO YES NO NO | 2 seconds | 256 megabytes | ['data structures', 'dfs and similar', 'implementation', 'strings', 'trees', '*1600'] |
B. Two Binary Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two strings a and b of equal length, consisting of only characters 0 and/or 1; both strings start with character 0 and end with character 1. You can perform the following operation an... | 7010100010111010101001010010001010101110000101111011001001001011011010001011011 | YES YES YES NO NO NO YES | 2 seconds | 256 megabytes | ['constructive algorithms', 'dp', 'greedy', '*1000'] |
A. Prime Deletiontime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA prime number is a positive integer that has exactly two different positive divisors: 1 and the integer itself. For example, 2, 3, 13 and 101 are prime numbers; 1, 4, 6 and 42 are not.You are given a ... | 4123456789987654321243567918576318429 | 167 53 3571 57638429 | 2 seconds | 512 megabytes | ['constructive algorithms', 'math', '*800'] |
F. Evaluate RBStime limit per test10 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given 2n tuples of values (a, b, c), where a and b are positive integers and c is a bracket '(' or ')'. Exactly n tuples have c = '(' and the other n tuples have c = ')'.You are asked to choose ... | 411 4 (2 3 )11 2 )3 4 (416 5 (12 3 (19 6 )4 10 )3 10 )19 11 (19 7 )7 14 (416 8 (11 9 )20 10 )20 19 )2 13 (18 7 (15 19 )5 6 ( | YES NO NO YES | 10 seconds | 512 megabytes | ['data structures', 'geometry', 'implementation', 'math', 'sortings', '*2900'] |
E. Fast Travel Text Editortime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a string s, consisting of lowercase Latin letters.There's a cursor, initially placed between two adjacent letters of the string. The cursor can't be placed before the first or af... | codecode
3
1 7
3 5
3 6
| 3 2 2 | 5 seconds | 512 megabytes | ['data structures', 'dfs and similar', 'graphs', 'shortest paths', '*2400'] |
D. Balanced Stringtime 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).Let's call a binary string balanced if the number of subsequences 01 (the number of indices i and j su... | 101
| 0 | 2 seconds | 256 megabytes | ['dp', '*2200'] |
C. Game on Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob are playing a game. They have a permutation p of size n (a permutation of size n is an array of size n where each element from 1 to n occurs exactly once). They also have a chip, whi... | 432 1 322 131 2 342 1 4 3 | 1 0 1 2 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'games', 'greedy', '*1400'] |
B. Fancy Coinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp is going to make a purchase with cost of exactly m burles.He has two types of coins, in the following quantities: coins worth 1 burle: a_1 regular coins and infinitely many fancy coins; coins ... | 411 3 0 011 3 20 2011 3 6 1100000000 2 0 0 | 5 0 1 50000000 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'greedy', 'math', '*1200'] |
A. Not a Substringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA bracket sequence is a string consisting of characters '(' and/or ')'. A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting chara... | 4)((()()))() | YES (()) YES ()()() NO YES ()(()()) | 2 seconds | 256 megabytes | ['constructive algorithms', 'strings', '*900'] |
F. Teleportation in Bytelandtime limit per test8 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n cities in Byteland, some of which are connected by roads, which can be traversed in any direction. The i-th road has its own hardness parameter w_i. Time spent on traversing a ro... | 2
2 3
1 2 1
11
1
1 2
5 3
1 4 5
1 3 8
2 3 8
4 5 10
11001
5
1 5
2 5
5 1
3 4
4 2
| 1 11 14 11 13 15 | 8 seconds | 512 megabytes | ['data structures', 'dfs and similar', 'divide and conquer', 'graphs', 'shortest paths', 'trees', '*3200'] |
E. Maximum Monogonositytime limit per test2.5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n and an array b of length n. The cost of a segment [l, r], 1 \le l \le r \le n, is defined as |b_l - a_r| + |b_r - a_l|.Recall that two segments [l_1, r_1], ... | 54 41 1 1 11 1 1 13 21 3 25 2 35 11 2 3 4 51 2 3 4 57 21 3 7 6 4 7 21 5 3 2 7 4 54 217 3 5 816 2 5 9 | 0 10 0 16 28 | 2.5 seconds | 512 megabytes | ['brute force', 'dp', 'math', '*2500'] |
D. Andrey and Escape from Capygradtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn incident occurred in Capygrad, the capital of Tyagoland, where all the capybaras in the city went crazy and started throwing mandarins. Andrey was forced to escape from the city as ... | 536 17 7 141 12 3 816 24 20 22610 2 23 15 28 1833 14 7 1016 24 20 221 16 3 1492 4 6 8 18 23 11 13 1521 4 2 33 9 6 734 8 1518 24 18 241 8 2 411 16 14 1426 32 28 305 10 6 8915 14 13 27 22 17 31 1 769 22 14 2011 26 13 2421 33 22 2321 33 25 321 6 3 418 29 20 21811 23 16 5 8 33 2 21 | 14 14 23 15 28 22 14 14 14 14 22 23 14 14 15 7 8 7 15 14 14 30 24 17 31 4 8 32 32 32 5 8 33 4 32 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'dp', 'dsu', 'greedy', 'sortings', '*1800'] |
C. Another Permutation Problemtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAndrey is just starting to come up with problems, and it's difficult for him. That's why he came up with a strange problem about permutations^{\dagger} and asks you to solve it. Can you do... | 52431020 | 2 17 7 303 2529 | 3 seconds | 256 megabytes | ['brute force', 'dp', 'greedy', 'math', '*1200'] |
B. Olya and Game with Arraystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputArtem suggested a game to the girl Olya. There is a list of n arrays, where the i-th array contains m_i \ge 2 positive integers a_{i,1}, a_{i,2}, \ldots, a_{i,m_i}.Olya can move at most one (... | 3221 224 313100 1 6341001 7 1007 538 11 622 9 | 5 1 19 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', 'sortings', '*1000'] |
A. United We Standtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an array a of length n, containing integers. And there are two initially empty arrays b and c. You need to add each element of array a to exactly one of the arrays b or c, in order to satisfy the... | 532 2 251 2 3 4 531 3 571 7 7 2 9 1 454 8 12 12 4 | -1 3 2 1 3 5 2 4 1 2 1 3 5 2 5 1 1 2 4 7 7 9 3 2 4 8 4 12 12 | 1 second | 256 megabytes | ['constructive algorithms', 'math', 'number theory', '*800'] |
E2. Rollbacks (Hard Version)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is a hard version of this problem. The only difference between the versions is that you have to solve the hard version in online mode. You can make hacks only if both versions of the pr... | 10
+ 1
+ 2
+ 2
?
!
+ 3
- 2
?
+ 1
?
| 2 1 1 | 3 seconds | 256 megabytes | ['data structures', 'interactive', 'trees', '*2600'] |
E1. Rollbacks (Easy Version)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an easy version of this problem. The only difference between the versions is that you have to solve the hard version in online mode. You can make hacks only if both versions of the p... | 10
+ 1
+ 2
+ 2
?
!
+ 3
- 2
?
+ 1
?
| 2 1 1 | 3 seconds | 256 megabytes | ['brute force', 'data structures', 'dfs and similar', 'trees', '*2500'] |
D. Trees and Segmentstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe teachers of the Summer Informatics School decided to plant n trees in a row, and it was decided to plant only oaks and firs. To do this, they made a plan, which can be represented as a binary s... | 53 01114 101105 0100006 21011017 10001101 | 3 3 3 4 5 7 9 5 9 13 17 21 6 9 13 17 21 25 7 10 13 17 21 25 29 | 3 seconds | 256 megabytes | ['brute force', 'data structures', 'dp', 'greedy', 'two pointers', '*2200'] |
C. Yet Another Permutation Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlex got a new game called "GCD permutations" as a birthday present. Each round of this game proceeds as follows: First, Alex chooses a permutation^{\dagger} a_1, a_2, \ldots, a_n of ... | 452710 | 1 2 4 3 5 1 2 1 2 3 6 4 5 7 1 2 3 4 8 5 10 6 9 7 | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'math', 'number theory', '*1000'] |
B. The Walkwaytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n benches near the Main Walkway in Summer Infomatics School. These benches are numbered by integers from 1 to n in order they follow. Also there are m cookie sellers near the Walkway. The i-th (1... | 86 2 22 58 3 23 5 810 4 92 8 9 1030 5 86 8 15 24 2930 5 86 8 12 20 278 8 31 2 3 4 5 6 7 82 2 21 21000000000 3 2000000057008429 66778899 837653445 | 3 1 4 1 4 4 6 4 5 2 7 7 1 1 51 1 | 1 second | 256 megabytes | ['brute force', 'dp', 'greedy', 'math', 'number theory', '*1500'] |
A. Buttonstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnna and Katie ended up in a secret laboratory.There are a+b+c buttons in the laboratory. It turned out that a buttons can only be pressed by Anna, b buttons can only be pressed by Katie, and c buttons can be ... | 51 1 19 3 31 2 36 6 92 2 8 | First First Second First Second | 1 second | 256 megabytes | ['games', 'greedy', 'math', '*800'] |
G. Counting Graphstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a tree consisting of n vertices. A tree is a connected undirected graph without cycles. Each edge of the tree has its weight, w_i.Your task is to count the number of different graphs that satisf... | 42 51 2 44 51 2 22 3 43 4 35 61 2 31 3 23 4 63 5 110 2001 2 32 3 333 4 2001 5 1325 6 15 7 297 8 1877 9 207 10 4 | 1 8 80 650867886 | 2 seconds | 256 megabytes | ['combinatorics', 'divide and conquer', 'dsu', 'graphs', 'greedy', 'sortings', 'trees', '*2000'] |
F. Sum and Producttime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have an array a of length n.Your task is to answer q queries: given x,y, find the number of pairs i and j (1 \le i < j \le n) that both a_i + a_j = x and a_i \cdot a_j = y.That is, for the array [... | 331 3 243 25 63 15 541 1 1 112 161 4 -2 3 3 332 -8-1 -27 12 | 1 1 0 0 6 1 1 3 | 4 seconds | 256 megabytes | ['binary search', 'data structures', 'math', '*1600'] |
E. Power of Pointstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n points with integer coordinates x_1,\dots x_n, which lie on a number line.For some integer s, we construct segments [s,x_1], [s,x_2], \dots, [s,x_n]. Note that if x_i<s, then the segme... | 331 4 351 2 5 7 141 10 100 1000 | 8 7 6 16 15 18 24 16 1111 1093 1093 2893 | 2 seconds | 256 megabytes | ['math', 'sortings', '*1500'] |
D. Strong Verticestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven two arrays a and b, both of length n. Elements of both arrays indexed from 1 to n. You are constructing a directed graph, where edge from u to v (u\neq v) exists if a_u-a_v \ge b_u-b_v.A vertex ... | 543 1 2 44 3 2 151 2 4 1 25 2 3 3 121 22 130 2 11 3 235 7 4-2 -3 -6 | 1 4 2 3 5 1 2 3 1 2 3 2 2 3 | 2 seconds | 256 megabytes | ['math', 'sortings', 'trees', '*1300'] |
C. Assembly via Minimumstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSasha has an array a of n integers. He got bored and for all i, j (i < j), he wrote down the minimum value of a_i and a_j. He obtained a new array b of size \frac{n\cdot (n-1)}{2}.For example, i... | 531 3 121047 5 3 5 3 352 2 2 2 2 2 2 2 2 253 0 0 -2 0 -2 0 0 -2 -2 | 1 3 3 10 10 7 5 3 12 2 2 2 2 2 0 -2 0 3 5 | 2 seconds | 256 megabytes | ['greedy', 'sortings', '*1200'] |
B. Maximum Roundingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a natural number x. You can perform the following operation: choose a positive integer k and round x to the k-th digit Note that the positions are numbered from right to left, starting from z... | 101599913198020444204456094741986040862016542130810467 | 1 10 100 1000 2000 20444 21000 100000 420000 41000000000000000000 | 2 seconds | 256 megabytes | ['greedy', 'implementation', 'math', '*1100'] |
A. Array Coloringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array consisting of n integers. Your task is to determine whether it is possible to color all its elements in two colors in such a way that the sums of the elements of both colors have ... | 781 2 4 3 2 3 5 424 733 9 821 755 4 3 2 144 3 4 5250 48 | YES NO YES YES NO YES YES | 1 second | 256 megabytes | ['greedy', 'math', '*800'] |
E2. PermuTree (hard version)time limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The differences between the two versions are the constraint on n and the time limit. You can make hacks only if both versions of the problem are solv... | 5
1 1 3 3
| 4 | 3 seconds | 512 megabytes | ['bitmasks', 'dfs and similar', 'dp', 'fft', 'greedy', 'implementation', 'math', 'trees', '*2700'] |
E1. PermuTree (easy version)time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The differences between the two versions are the constraint on n and the time limit. You can make hacks only if both versions of the problem are solv... | 5
1 1 3 3
| 4 | 2 seconds | 512 megabytes | ['dfs and similar', 'dp', 'trees', '*1800'] |
D. More Wrongtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.The jury has hidden a permutation^\dagger p of length n.In one query, you can pick two integers l and r (1 \le l < r \le n) by paying (r - l)^2 coins. In return, you will be ... | 2
4
1
0
2
1 | ? 1 3 ? 3 4 ! 4 ? 1 2 ! 1 | 2 seconds | 256 megabytes | ['divide and conquer', 'interactive', '*2100'] |
C. To Become Maxtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of integers a of length n.In one operation you: Choose an index i such that 1 \le i \le n - 1 and a_i \le a_{i + 1}. Increase a_i by 1. Find the maximum possible value of \max(... | 63 41 3 35 61 3 4 5 14 131 1 3 1795 34 3 2 2 25 66 5 4 1 52 173 5 | 4 7 179 5 7 6 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'data structures', 'dp', '*1600'] |
B. Good Arraystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of positive integers a of length n.Let's call an array of positive integers b of length n good if: a_i \neq b_i for all i from 1 to n, a_1 + a_2 +\ldots + a_n = b_1 + b_2 + \ldots... | 636 1 221 143 1 2 411751 2 1 1 13618343152 819343431 1000000000 | YES NO YES NO NO YES | 1 second | 256 megabytes | ['implementation', 'math', '*900'] |
A. Tales of a Sorttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlphen has an array of positive integers a of length n.Alphen can perform the following operation: For all i from 1 to n, replace a_i with \max(0, a_i - 1). Alphen will perform the above operation un... | 731 2 352 1 2 1 243 1 5 427 754 1 3 2 552 3 1 4 531000000000 1 2 | 0 2 5 0 4 3 1000000000 | 1 second | 256 megabytes | ['implementation', '*800'] |
B. Longest Divisors Intervaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a positive integer n, find the maximum size of an interval [l, r] of positive integers such that, for every i in the interval (i.e., l \leq i \leq r), n is a multiple of i.Given two in... | 1014099099042044745601699589137065729723659882203458280803877017195378264306201968835781298538648023412808056621000000000000000000 | 1 2 3 6 4 22 3 1 2 2 | 2 seconds | 256 megabytes | ['brute force', 'combinatorics', 'greedy', 'math', 'number theory', '*900'] |
A. Dalton the Teachertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDalton is the teacher of a class with n students, numbered from 1 to n. The classroom contains n chairs, also numbered from 1 to n. Initially student i is seated on chair p_i. It is guaranteed that ... | 522 131 2 351 2 5 4 341 2 4 31010 2 1 3 6 5 4 7 9 8 | 0 2 2 1 1 | 1 second | 256 megabytes | ['greedy', 'math', '*800'] |
F. Mark and Spaceshiptime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMark loves to move fast. So he made a spaceship that works in 4-dimensional space. He wants to use the spaceship to complete missions as fast as possible. In each mission, the spaceship starts at (... | 1 0 0 0
| 2 | 3 seconds | 512 megabytes | ['brute force', 'dp', '*3500'] |
E. Game Bundlestime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRishi is developing games in the 2D metaverse and wants to offer game bundles to his customers. Each game has an associated enjoyment value. A game bundle consists of a subset of games whose total enjoym... | 4
| 4 20 20 20 20 | 3 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'dp', 'greedy', 'math', '*3000'] |
D. Michael and Hoteltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMichael and Brian are stuck in a hotel with n rooms, numbered from 1 to n, and need to find each other. But this hotel's doors are all locked and the only way of getting around is by using the telep... | 5
0
1 | ? 3 5 2 2 3 ? 2 5 2 2 3 ! 3 1 3 4 | 2 seconds | 256 megabytes | ['binary search', 'interactive', 'trees', '*3000'] |
C. Expected Destructiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a set S of n distinct integers between 1 and m.Each second you do the following steps: Pick an element x in S uniformly at random. Remove x from S. If x+1 \leq m and x+1 is not in S, ... | 2 3
1 3
| 750000009 | 1 second | 256 megabytes | ['combinatorics', 'dp', 'math', 'probabilities', '*2500'] |
B. Earn or Unlocktime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAndrea is playing the game Tanto Cuore. He has a deck of n cards with values a_1, \ldots, a_n from top to bottom. Each card can be either locked or unlocked. Initially, only the topmost card is unlock... | 2
1 2
| 2 | 3 seconds | 512 megabytes | ['bitmasks', 'brute force', 'dp', '*2200'] |
A2. Dual (Hard Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPopskyy & tiasu - Dual⠀The only difference between the two versions of this problem is the constraint on the maximum number of operations. You can make hacks only if all versions of the problem ar... | 1022 141 2 -10 352 1 1 1 180 0 0 0 0 0 0 051 2 -4 3 -101011 12 13 14 15 -15 -16 -17 -18 -1971 9 3 -4 -3 -2 -1310 9 8201 -14 2 -10 6 -5 10 -13 10 7 -14 19 -5 19 1 18 -16 -7 12 820-15 -17 -13 8 14 -13 10 -4 11 -4 -16 -6 15 -4 -2 7 -9 5 -5 17 | 1 2 1 3 4 4 4 4 3 4 4 2 1 3 1 4 1 5 1 0 7 3 4 3 4 5 4 5 4 5 4 5 4 5 4 15 6 1 6 1 6 1 7 2 7 2 7 2 8 3 8 3 8 3 9 4 9 4 9 4 10 5 10 5 10 5 8 3 4 3 4 2 4 2 4 2 4 2 4 1 4 1 4 3 2 1 3 1 3 1 31 14 1 18 7 13 11 15 11 6 4 5 17 19 6 19 12 10 5 11 12 1 17 15 19 16 10 14 2 16 11 20 7 7 6 9 5 3 6 6 14 17 18 18 14 12 3 17 16 8 18 13... | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*1900'] |
A1. Dual (Easy Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPopskyy & tiasu - Dual⠀The only difference between the two versions of this problem is the constraint on the maximum number of operations. You can make hacks only if all versions of the problem ar... | 1022 141 2 -10 352 1 1 1 180 0 0 0 0 0 0 051 2 -4 3 -101011 12 13 14 15 -15 -16 -17 -18 -1971 9 3 -4 -3 -2 -1310 9 8201 -14 2 -10 6 -5 10 -13 10 7 -14 19 -5 19 1 18 -16 -7 12 820-15 -17 -13 8 14 -13 10 -4 11 -4 -16 -6 15 -4 -2 7 -9 5 -5 17 | 1 2 1 3 4 4 4 4 3 4 4 2 1 3 1 4 1 5 1 0 7 3 4 3 4 5 4 5 4 5 4 5 4 5 4 15 6 1 6 1 6 1 7 2 7 2 7 2 8 3 8 3 8 3 9 4 9 4 9 4 10 5 10 5 10 5 8 3 4 3 4 2 4 2 4 2 4 2 4 1 4 1 4 3 2 1 3 1 3 1 31 14 1 18 7 13 11 15 11 6 4 5 17 19 6 19 12 10 5 11 12 1 17 15 19 16 10 14 2 16 11 20 7 7 6 9 5 3 6 6 14 17 18 18 14 12 3 17 16 8 18 13... | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*1400'] |
B. Fibonaccharsistime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNtarsis has received two integers n and k for his birthday. He wonders how many fibonacci-like sequences of length k can be formed with n as the k-th element of the sequence. A sequence of non-decreasi... | 822 43 955 1142069 669420 469 14341 31 4 | 4 0 1 1052 11571 0 1 0 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'math', '*1200'] |
A. Desortingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCall an array a of length n sorted if a_1 \leq a_2 \leq \ldots \leq a_{n-1} \leq a_n.Ntarsis has an array a of length n. He is allowed to perform one type of operation on it (zero or more times): Choose an... | 421 141 8 10 1331 3 231 9 14 | 1 2 0 3 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', '*800'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.