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. Hossam and (sub-)palindromic treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam has an unweighted tree G with letters in vertices.Hossam defines s(v, \, u) as a string that is obtained by writing down all the letters on the unique simple path from the vert... | 25abaca1 21 33 44 59caabadedb1 22 32 41 55 65 75 88 9 | 3 5 | 1 second | 256 megabytes | ['brute force', 'data structures', 'dfs and similar', 'dp', 'strings', 'trees', '*2100'] |
C. Hossam and Traineestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam has n trainees. He assigned a number a_i for the i-th trainee. A pair of the i-th and j-th (i \neq j) trainees is called successful if there is an integer x (x \geq 2), such that x divides ... | 2332 48 7314 5 9 | YES NO | 3 seconds | 256 megabytes | ['greedy', 'math', 'number theory', '*1600'] |
B. Hossam and Friendstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam makes a big party, and he will invite his friends to the party.He has n friends numbered from 1 to n. They will be arranged in a queue as follows: 1, 2, 3, \ldots, n.Hossam has a list of m p... | 23 21 32 34 21 22 3 | 4 5 | 2 seconds | 256 megabytes | ['binary search', 'constructive algorithms', 'dp', 'two pointers', '*1400'] |
A. Hossam and Combinatoricstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam woke up bored, so he decided to create an interesting array with his friend Hazem.Now, they have an array a of n positive integers, Hossam will choose a number a_i and Hazem will choos... | 256 2 3 8 167 2 8 3 2 10 | 2 4 | 2 seconds | 256 megabytes | ['combinatorics', 'math', 'sortings', '*900'] |
H. Koxia, Mahiru and Winter Festivaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWow, what a big face!Kagura MahiruKoxia and Mahiru are enjoying the Winter Festival. The streets of the Winter Festival can be represented as a n \times n undirected grid graph. Form... | 3
3 2 1
3 1 2
| 5 1 1 2 1 2 2 3 2 3 3 3 1 2 2 2 3 2 5 1 3 1 2 1 1 2 1 3 1 5 1 1 1 2 1 3 2 3 3 3 4 2 1 2 2 2 3 1 3 4 3 1 3 2 3 3 2 3 | 2 seconds | 256 megabytes | ['constructive algorithms', '*3500'] |
G. Koxia and Brackettime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChiyuu has a bracket sequence^\dagger s of length n. Let k be the minimum number of characters that Chiyuu has to remove from s to make s balanced^\ddagger.Now, Koxia wants you to count the number o... | ())(()
| 4 | 5 seconds | 256 megabytes | ['divide and conquer', 'fft', 'math', '*3400'] |
F. Koxia and Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMari has three integers n, x, and y.Call an array a of n non-negative integers good if it satisfies the following conditions: a_1+a_2+\ldots+a_n=x, and a_1 \, | \, a_2 \, | \, \ldots \, | \, a_n=y... | 3 5 3
| 2 | 1 second | 256 megabytes | ['bitmasks', 'combinatorics', 'dp', 'math', 'number theory', '*3100'] |
E. Koxia and Treetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputImi has an undirected tree with n vertices where edges are numbered from 1 to n-1. The i-th edge connects vertices u_i and v_i. There are also k butterflies on the tree. Initially, the i-th butterfly i... | 3 2
1 3
1 2
2 3
| 748683266 | 3 seconds | 256 megabytes | ['combinatorics', 'dfs and similar', 'dp', 'dsu', 'math', 'probabilities', 'trees', '*2400'] |
D. Koxia and Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKoxia and Mahiru are playing a game with three arrays a, b, and c of length n. Each element of a, b and c is an integer between 1 and n inclusive.The game consists of n rounds. In the i-th round, they ... | 231 2 21 3 353 3 1 3 44 5 2 5 5 | 6 0 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'dfs and similar', 'dsu', 'flows', 'games', 'graph matchings', 'graphs', 'implementation', '*2000'] |
C. Koxia and Number Theorytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJoi has an array a of n positive integers. Koxia wants you to determine whether there exists a positive integer x > 0 such that \gcd(a_i+x,a_j+x)=1 for all 1 \leq i < j \leq n.Here \gcd(y, z) d... | 235 7 1033 3 4 | YES NO | 1 second | 256 megabytes | ['brute force', 'chinese remainder theorem', 'math', 'number theory', '*1700'] |
B. Koxia and Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputReve has two integers n and k.Let p be a permutation^\dagger of length n. Let c be an array of length n - k + 1 such that c_i = \max(p_i, \dots, p_{i+k-1}) + \min(p_i, \dots, p_{i+k-1}). Let the ... | 35 35 16 6 | 5 1 2 3 4 1 2 3 4 5 3 2 4 1 6 5 | 1 second | 256 megabytes | ['constructive algorithms', '*1000'] |
A. Koxia and Whiteboardstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKiyora has n whiteboards numbered from 1 to n. Initially, the i-th whiteboard has the integer a_i written on it.Koxia performs m operations. The j-th operation is to choose one of the whiteboards... | 43 21 2 34 52 31 23 4 51 110015 31 1 1 1 11000000000 1000000000 1000000000 | 12 9 1 3000000002 | 1 second | 256 megabytes | ['brute force', 'greedy', '*1000'] |
D3. Игра в Девятку IIIограничение по времени на тест5 секундограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи нужно найти 26 раскладов с различными значениями важности первого хода.Алиса и Боб решили сыграть в карточную игру «Девятка». Пожалуйста, внимательно прочит... | Входные данные
2
| Выходные данные KS QD 8D QC 8S 8C JD 9H AC TH 9S 9D QH 7H 8H TS 7S 9C 6D JS 7D KH QS TC AD AS KC 6C 7C TD AH KD 6S JC JH 6H JC JS 8S TD JD KH 7D 9C KC TH QD 8D 7H TC KD 9H 8C 6D 7S AC QH AD 8H TS 6H JH 6C AH 7C 6S 9D QC AS QS KS 9S | ограничение по времени на тест5 секунд | ограничение по памяти на тест512 мегабайт | ['*special problem', 'brute force', '*2300'] |
D2. Игра в Девятку IIограничение по времени на тест5 секундограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи игроки начинают играть не только на победу, но и на оптимизацию результата игры для них. Вводится понятие величины важности первого хода, и нужно найти 13 ра... | Входные данные
2
| Выходные данные KS QD 8D QC 8S 8C JD 9H AC TH 9S 9D QH 7H 8H TS 7S 9C 6D JS 7D KH QS TC AD AS KC 6C 7C TD AH KD 6S JC JH 6H JC JS 8S TD JD KH 7D 9C KC TH QD 8D 7H TC KD 9H 8C 6D 7S AC QH AD 8H TS 6H JH 6C AH 7C 6S 9D QC AS QS KS 9S | ограничение по времени на тест5 секунд | ограничение по памяти на тест512 мегабайт | ['*special problem', 'brute force', '*2200'] |
D1. Игра в Девятку Iограничение по времени на тест5 секундограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи нужно определить, кто выиграет в карточной игре для двух игроков в заданном раскладе при оптимальной игре обоих соперников.Алиса и Боб решили сыграть в карточ... | Входные данные
JD 7S 9S JS 8S 9D 6D 8C 8D TH KS QD QH TD 6C AD KD AC
KH QC 9H 6H KC 9C JC TS 6S QS TC JH 7D 7H AS AH 7C 8H
| Выходные данные Alice | ограничение по времени на тест5 секунд | ограничение по памяти на тест512 мегабайт | ['*special problem', 'brute force', 'dp', '*1800'] |
C2. Подкрутка IIограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи n \le 2 \cdot 10^5 и a_i \le 10^6 (а также есть ограничение на сумму n по наборам входных данных внутри одного теста).Вика за время работы в компании VK уже сдел... | Входные данные
391 1 3 4 6 6 6 8 1061 2 3 4 5 6510 10 10 10 10 | Выходные данные 5 6 2 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'dp', '*1300'] |
C1. Подкрутка Iограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи n \le 50 и a_i \le 100.Вика за время работы в компании VK уже сделала n коммитов в системе контроля версий. i-й коммит был сделан в a_i-й день работы Вики в компа... | Входные данные
391 1 3 4 6 6 6 8 1061 2 3 4 5 6510 10 10 10 10 | Выходные данные 5 6 2 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'brute force', 'dp', 'greedy', '*1200'] |
B2. Копирование файлов IIограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи размеры копируемых файлов не превышают 10^{10} байт.Вы копируете с одного сервера на другой n файлов размером a_1, a_2, \ldots, a_n байт. Файлы копируют... | Входные данные
1
6
| Выходные данные 0 16 33 50 66 83 100 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'binary search', 'brute force', 'math', '*1400'] |
B1. Копирование файлов Iограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВ этой версии задачи размеры копируемых файлов не превышают 1000 байт.Вы копируете с одного сервера на другой n файлов размером a_1, a_2, \ldots, a_n байт. Файлы копируются п... | Входные данные
1
6
| Выходные данные 0 16 33 50 66 83 100 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'brute force', 'implementation', 'math', '*1000'] |
A. Узкая дорогаограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводКолонна из n самокатов едет по узкой односторонней дороге в пункт Б. Самокаты пронумерованы от 1 до n. Для каждого самоката i известно, что текущее расстояние от него до пункта Б равн... | Входные данные
4
20
30
50
100
| Выходные данные 19 28 47 96 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'math', '*800'] |
F. Wonderful Jumptime limit per test4 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputYou are given an array of positive integers a_1,a_2,\ldots,a_n of length n. In one operation you can jump from index i to index j (1 \le i \le j \le n) by paying \min(a_i, a_{i + 1}, \ldots, a_j) \cdot... | 3
2 1 3
| 0 1 2 | 4 seconds | 128 megabytes | ['dp', 'greedy', '*2900'] |
E. Partial Sortingtime limit per test1.5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputConsider a permutation^\dagger p of length 3n. Each time you can do one of the following operations: Sort the first 2n elements in increasing order. Sort the last 2n elements in increasing order.... | 1 100009067
| 9 | 1.5 seconds | 1024 megabytes | ['combinatorics', 'math', 'number theory', '*2300'] |
D. Lucky Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation^\dagger p of length n.In one operation, you can choose two indices 1 \le i < j \le n and swap p_i with p_j.Find the minimum number of operations needed to have exactly one... | 422 121 243 4 1 242 4 3 1 | 0 1 3 1 | 1 second | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'greedy', '*1800'] |
C. Elemental Decompresstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of n integers.Find two permutations^\dagger p and q of length n such that \max(p_i,q_i)=a_i for all 1 \leq i \leq n or report that such p and q do not exist.^\dagger A pe... | 31155 3 4 2 521 1 | YES 1 1 YES 1 3 4 2 5 5 2 3 1 4 NO | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', 'sortings', '*1300'] |
B. Quick Sorttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation^\dagger p of length n and a positive integer k \le n.In one operation, you: Choose k distinct elements p_{i_1}, p_{i_2}, \ldots, p_{i_k}. Remove them and then add them sorted ... | 43 21 2 33 13 1 24 21 3 2 44 22 3 1 4 | 0 1 1 2 | 1 second | 256 megabytes | ['greedy', 'math', '*900'] |
A. Greatest Convextime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer k. Find the largest integer x, where 1 \le x < k, such that x! + (x - 1)!^\dagger is a multiple of ^\ddagger k, or determine that no such x exists.^\dagger y! denotes the facto... | 436810 | 2 5 7 9 | 1 second | 256 megabytes | ['greedy', 'math', 'number theory', '*800'] |
F. Two Subtreestime limit per test9 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a rooted tree consisting of n vertices. The vertex 1 is the root. Each vertex has an integer written on it; this integer is val_i for the vertex i.You are given q queries to the tree. The ... | 8
2 1 3 2 3 3 2 4
1 2
1 3
2 4
3 5
3 6
3 7
7 8
6
2 7
3 7
2 3
1 1
5 6
1 3
| 2 3 3 2 3 3 | 9 seconds | 1024 megabytes | ['data structures', 'trees', '*3100'] |
E. Algebra Flashtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output Algebra Flash 2.2 has just been released!Changelog: New gamemode! Thank you for the continued support of the game! Huh, is that it? Slightly disappointed, you boot up the game and click on the new gam... | 5 3
1 3 2 3 1
1 10 100
| 11 | 2 seconds | 256 megabytes | ['bitmasks', 'brute force', 'dp', 'graphs', 'math', 'meet-in-the-middle', 'trees', '*2500'] |
D. Playofftime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output2^n teams participate in a playoff tournament. The tournament consists of 2^n - 1 games. They are held as follows: in the first phase of the tournament, the teams are split into pairs: team 1 plays against te... | 3
101
| 4 5 6 7 | 2 seconds | 256 megabytes | ['combinatorics', 'constructive algorithms', 'dp', 'greedy', 'math', '*1500'] |
C. Count Binary Stringstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an integer n. You have to calculate the number of binary (consisting of characters 0 and/or 1) strings s meeting the following constraints.For every pair of integers (i, j) such tha... | 3
1 0 2
1 0
1
| 6 | 2 seconds | 512 megabytes | ['data structures', 'dp', '*2100'] |
B. Block Towerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n block towers, numbered from 1 to n. The i-th tower consists of a_i blocks.In one move, you can move one block from tower i to tower j, but only if a_i > a_j. That move increases a_j by 1 and ... | 431 2 331 2 221 1000000000103 8 6 7 4 1 2 4 10 1 | 3 2 500000001 9 | 2 seconds | 256 megabytes | ['data structures', 'greedy', 'sortings', '*800'] |
A. Cut the Triangletime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a non-degenerate triangle (a non-degenerate triangle is a triangle with positive area). The vertices of the triangle have coordinates (x_1, y_1), (x_2, y_2) and (x_3, y_3).You want to d... | 44 76 83 54 54 76 85 81 82 53 66 66 3 | YES YES YES NO | 2 seconds | 512 megabytes | ['implementation', '*800'] |
F. MCFtime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a graph consisting of n vertices and m directed arcs. The i-th arc goes from the vertex x_i to the vertex y_i, has capacity c_i and weight w_i. No arc goes into the vertex 1, and no arc goes from th... | 3 3
1 2 3 -10
1 2 3 -15
2 3 2 0
| Possible 1 1 2 | 4 seconds | 512 megabytes | ['flows', '*2800'] |
E. Decompositiontime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputFor a sequence of integers [x_1, x_2, \dots, x_k], let's define its decomposition as follows:Process the sequence from the first element to the last one, maintaining the list of its subsequences. When y... | 8
1 3 2 0 1 3 2 1
| 71 | 4 seconds | 512 megabytes | ['binary search', 'brute force', 'data structures', 'divide and conquer', 'dp', 'two pointers', '*2300'] |
D. Lucky Chainstime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet's name a pair of positive integers (x, y) lucky if the greatest common divisor of them is equal to 1 (\gcd(x, y) = 1).Let's define a chain induced by (x, y) as a sequence of pairs (x, y), (x + 1, y +... | 4
5 15
13 37
8 9
10009 20000
| 0 1 -1 79 | 4 seconds | 512 megabytes | ['math', 'number theory', '*1600'] |
C. Hamiltonian Walltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSir Monocarp Hamilton is planning to paint his wall. The wall can be represented as a grid, consisting of 2 rows and m columns. Initially, the wall is completely white.Monocarp wants to paint a black... | 63WBBBBW1BB5BWBWBBBBBB2BWWB5BBBBWBWBBB6BWBBWBBBBBBB | YES YES NO NO NO YES | 2 seconds | 256 megabytes | ['dp', 'implementation', '*1300'] |
B. Notepad#time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou want to type the string s, consisting of n lowercase Latin letters, using your favorite text editor Notepad#.Notepad# supports two kinds of operations: append any letter to the end of the string; copy... | 610codeforces8labacaba5uohhh16isthissuffixtree1x4momo | NO YES NO YES NO YES | 3 seconds | 256 megabytes | ['implementation', '*1000'] |
A. Extremely Roundtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet's call a positive integer extremely round if it has only one non-zero digit. For example, 5000, 4, 1, 10, 200 are extremely round integers; 42, 13, 666, 77, 101 are not.You are given an integer n.... | 594213100111 | 9 13 10 19 19 | 3 seconds | 512 megabytes | ['brute force', 'implementation', '*800'] |
N. Number Reductiontime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a positive integer x.You can apply the following operation to the number: remove one occurrence of any digit in such a way that the resulting number does not contain any leading zeroes ... | 510000413370987654321666837494128578086523 | 1 1337 321 344128 7052 | 2 seconds | 512 megabytes | ['greedy', '*1500'] |
M. Minimum LCMtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an integer n.Your task is to find two positive (greater than 0) integers a and b such that a+b=n and the least common multiple (LCM) of a and b is the minimum among all possible values of a ... | 429510 | 1 1 3 6 1 4 5 5 | 2 seconds | 512 megabytes | ['math', 'number theory', '*1000'] |
L. Project Managertime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n employees at Bersoft company, numbered from 1 to n. Each employee works on some days of the week and rests on the other days. You are given the lists of working days of the week for each e... | 3 5 4
2 Saturday Sunday
2 Tuesday Thursday
4 Monday Wednesday Friday Saturday
4 7 13 14 15
5 1 1 3 3 2
3 2 3 2
5 3 3 3 1 1
8 3 3 3 3 3 3 3 3
| 25 9 27 27 | 4 seconds | 512 megabytes | ['brute force', 'data structures', 'implementation', '*2400'] |
K. Torus Pathtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a square grid with n rows and n columns, where each cell has a non-negative integer written in it. There is a chip initially placed at the top left cell (the cell with coordinates (1, 1)). Yo... | 2
1 2
3 4
| 8 | 2 seconds | 512 megabytes | ['greedy', 'math', '*1500'] |
J. Hero to Zerotime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are no heroes in this problem. I guess we should have named it "To Zero".You are given two arrays a and b, each of these arrays contains n non-negative integers.Let c be a matrix of size n \times n... | 3
1 2 3
2 2 2
| 2 | 4 seconds | 512 megabytes | ['graph matchings', 'math', '*2900'] |
I. Infinite Chesstime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe black king lives on a chess board with an infinite number of columns (files) and 8 rows (ranks). The columns are numbered with all integer numbers (including negative). The rows are numbered from 1... | 1 8
7 8
2
N 4 8
B 4 6
| 10 | 3 seconds | 512 megabytes | ['implementation', 'shortest paths', '*2800'] |
H. Hospital Queuetime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n people (numbered from 1 to n) signed up for a doctor's appointment. The doctor has to choose in which order he will appoint these people. The i-th patient should be appointed among the firs... | 4 1
2 3 2 4
3 1
| 2 3 1 4 | 3 seconds | 512 megabytes | ['binary search', 'graphs', 'greedy', 'implementation', '*2200'] |
G. Guess the Stringtime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is an interactive problem. You have to use flush operation right after printing each line. For example, in C++ you should use the function fflush(stdout), in Java or Kotlin — System.out.flush(),... | 2 // 2 test cases
6 // n = 6
0 // p[3] = 0
1 // q[2] = 1
4 // q[6] = 4
1 // p[4] = 1
1 // answer is correct
5 // n = 5
1 // p[2] = 1
2 // q[4] = 2
2 // q[5] = 2
1 // answer is correct
| 1 3 // what is p[3]? 2 2 // what is q[2]? 2 6 // what is q[6]? 1 4 // what is p[4]? 0 011001 // the guess is 011001 1 2 // what is p[2]? 2 4 // what is q[4]? 2 5 // what is q[5]? 0 00111 // the guess is 00111 | 6 seconds | 512 megabytes | ['constructive algorithms', 'interactive', 'probabilities', '*2600'] |
F. Chemistry Labtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMonocarp is planning on opening a chemistry lab. During the first month, he's going to distribute solutions of a certain acid.First, he will sign some contracts with a local chemistry factory. Each cont... | 2 10
0 10 20
100 15 20
| 175.000000000000000 | 2 seconds | 512 megabytes | ['dp', 'geometry', 'probabilities', '*2200'] |
E. Exchangetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMonocarp is playing a MMORPG. There are two commonly used types of currency in this MMORPG — gold coins and silver coins. Monocarp wants to buy a new weapon for his character, and that weapon costs n silver ... | 4100 25 309999997 25 5052 50 4849 50 1 | 4 400000 1 1 | 2 seconds | 512 megabytes | ['brute force', 'math', '*1000'] |
D. Watch the Videostime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputMonocarp wants to watch n videos. Each video is only one minute long, but its size may be arbitrary. The i-th video has the size a_i megabytes. All videos are published on the Internet. A video should... | 5 6
1 2 3 4 5
| 16 | 1 second | 512 megabytes | ['binary search', 'constructive algorithms', 'two pointers', '*1700'] |
C. Card Guessingtime limit per test15 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputConsider a deck of cards. Each card has one of 4 suits, and there are exactly n cards for each suit — so, the total number of cards in the deck is 4n. The deck is shuffled randomly so that each of (4n... | 1 1
| 748683266 | 15 seconds | 1024 megabytes | ['combinatorics', 'dp', 'probabilities', '*2600'] |
B. Broken Keyboardtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputRecently, Mishka started noticing that his keyboard malfunctions — maybe it's because he was playing rhythm games too much. Empirically, Mishka has found out that every other time he presses a key, it ... | 44ossu2aa6addonn3qwe | YES NO YES NO | 1 second | 512 megabytes | ['greedy', '*800'] |
A. Access Levelstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBerSoft is the biggest IT corporation in Berland, and Monocarp is the head of its security department. This time, he faced the most difficult task ever. Basically, there are n developers working at BerS... | 3 2
01
11
10
| 2 1 2 2 2 1 2 2 2 2 1 | 2 seconds | 512 megabytes | ['bitmasks', 'dsu', 'flows', 'graph matchings', '*2400'] |
H. Doremy's Paint 2time limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy has n buckets of paint which is represented by an array a of length n. Bucket i contains paint with color a_i. Initially, a_i=i.Doremy has m segments [l_i,r_i] (1 \le l_i \le r_i \le n). Each ... | 7 5 5
3 5
2 3
4 6
5 7
1 2
| 3 3 3 3 2 | 4 seconds | 256 megabytes | ['data structures', '*3400'] |
G3. Doremy's Perfect DS Class (Hard Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between this problem and the other two versions is the maximum number of queries. In this version, you are allowed to ask at most \mathbf{20} queries. You ... | 5
2
2
1
3 | ? 1 3 4 ? 3 5 3 ? 3 4 5 ? 3 5 2 ! 4 | 1 second | 256 megabytes | ['binary search', 'interactive', '*3300'] |
G2. Doremy's Perfect DS Class (Medium Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between this problem and the other two versions is the maximum number of queries. In this version, you are allowed to ask at most \mathbf{25} queries. Yo... | 5
2
2
1
3 | ? 1 3 4 ? 3 5 3 ? 3 4 5 ? 3 5 2 ! 4 | 1 second | 256 megabytes | ['binary search', 'interactive', '*3000'] |
G1. Doremy's Perfect DS Class (Easy Version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between this problem and the other two versions is the maximum number of queries. In this version, you are allowed to ask at most \mathbf{30} queries. You ... | 5
2
2
1
3 | ? 1 3 4 ? 3 5 3 ? 3 4 5 ? 3 5 2 ! 4 | 1 second | 256 megabytes | ['binary search', 'interactive', '*2900'] |
F. Doremy's Experimental Treetime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy has an edge-weighted tree with n vertices whose weights are integers between 1 and 10^9. She does \frac{n(n+1)}{2} experiments on it.In each experiment, Doremy chooses vertices i a... | 3
7
3 5
0 2 8
| 2 3 3 1 2 2 | 2.5 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'dfs and similar', 'dsu', 'sortings', 'trees', '*2500'] |
E. Doremy's Number Linetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy has two arrays a and b of n integers each, and an integer k.Initially, she has a number line where no integers are colored. She chooses a permutation p of [1,2,\ldots,n] then performs n mo... | 64 165 38 1210 715 14 168 1210 715 15 34 1610 715 15 38 124 1615 15 38 1210 71 1000000000500000000 5000000002 10000000001 9999999991 1 | NO YES YES YES NO YES | 2 seconds | 256 megabytes | ['dp', 'greedy', 'sortings', '*2400'] |
D. Doremy's Pegging Gametime limit per test1.5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDoremy has n+1 pegs. There are n red pegs arranged as vertices of a regular n-sided polygon, numbered from 1 to n in anti-clockwise order. There is also a blue peg of slightly smaller diameter... | 4 100000007
| 16 | 1.5 seconds | 512 megabytes | ['combinatorics', 'dp', 'math', '*2000'] |
C. Doremy's City Constructiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy's new city is under construction! The city can be regarded as a simple undirected graph with n vertices. The i-th vertex has altitude a_i. Now Doremy is deciding which pairs of vertic... | 442 2 3 165 2 3 1 5 2127 2 4 9 1 4 6 3 7 4 2 341000000 1000000 1000000 1000000 | 3 9 35 2 | 1 second | 256 megabytes | ['graphs', 'greedy', '*1400'] |
B. Doremy's Perfect Math Classtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output"Everybody! Doremy's Perfect Math Class is about to start! Come and do your best if you want to have as much IQ as me!" In today's math class, Doremy is teaching everyone subtraction. Now s... | 221 235 10 25 | 2 5 | 1 second | 256 megabytes | ['math', 'number theory', '*900'] |
A. Doremy's Painttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDoremy has n buckets of paint which is represented by an array a of length n. Bucket i contains paint with color a_i. Let c(l,r) be the number of distinct elements in the subarray [a_l,a_{l+1},\ldots,a_... | 751 3 2 2 451 2 3 4 542 1 2 132 3 322 21199 8 5 2 1 1 2 3 3 | 2 4 1 5 1 4 2 3 1 2 1 1 3 9 | 1 second | 256 megabytes | ['greedy', '*800'] |
F. Edge Queriestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an undirected, connected graph of n nodes and m edges. All nodes u of the graph satisfy the following: Let S_u be the set of vertices in the longest simple cycle starting and ending at u. ... | 10 11
1 2
2 3
3 4
4 5
5 3
2 7
7 9
9 10
10 6
6 7
1 8
5
1 4
5 10
3 5
2 8
7 10
| 3 7 3 0 4 | 3 seconds | 256 megabytes | ['data structures', 'dfs and similar', 'dp', 'dsu', 'graphs', 'trees', '*3000'] |
E. Node Pairstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call an ordered pair of nodes (u, v) in a directed graph unidirectional if u \neq v, there exists a path from u to v, and there are no paths from v to u.A directed graph is called p-reachable if it c... | 3
| 3 0 | 2 seconds | 256 megabytes | ['dp', 'graphs', 'math', 'number theory', '*2200'] |
D. Valid Bitonic Permutationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given five integers n, i, j, x, and y. Find the number of bitonic permutations B, of the numbers 1 to n, such that B_i=x, and B_j=y. Since the answer can be large, compute it modulo ... | 73 1 3 2 33 2 3 3 24 3 4 3 15 2 5 2 45 3 4 5 49 3 7 8 620 6 15 8 17 | 0 1 1 1 3 0 4788 | 1 second | 256 megabytes | ['combinatorics', 'dp', 'implementation', 'math', 'number theory', '*2200'] |
C. Another Array Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of n integers. You are allowed to perform the following operation on it as many times as you want (0 or more times): Choose 2 indices i,j where 1 \le i < j \le n and r... | 331 1 129 134 9 5 | 3 16 18 | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'greedy', '*2000'] |
B. Incineratetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTo destroy humanity, The Monster Association sent n monsters to Earth's surface. The i-th monster has health h_i and power p_i.With his last resort attack, True Spiral Incineration Cannon, Genos can deal k ... | 36 718 5 13 9 10 12 7 2 1 2 63 45 5 54 4 43 22 1 31 1 1 | YES NO YES | 1 second | 256 megabytes | ['binary search', 'brute force', 'data structures', 'implementation', 'math', 'sortings', '*1200'] |
A. Absolute Maximizationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n. You can perform the following operation several (possibly, zero) times: Choose i, j, b: Swap the b-th digit in the binary representation of a_i and a_j. Fin... | 431 0 145 5 5 551 2 3 4 5720 85 100 41 76 49 36 | 1 0 7 125 | 1 second | 256 megabytes | ['bitmasks', 'constructive algorithms', 'greedy', 'math', '*800'] |
G. Unequal Adjacent Elementstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n positive integers. Find any permutation p of [1,2,\dots,n] such that: p_{i-2} < p_i for all i, where 3 \leq i \leq n, and a_{p_{i-1}} \neq a_{p_i} ... | 431 2 141 2 3 431 1 171 2 1 1 3 1 4 | YES 1 2 3 YES 3 1 4 2 NO YES 1 2 3 5 4 7 6 | 2 seconds | 256 megabytes | ['constructive algorithms', 'sortings', '*3100'] |
F. Good Pairs time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers and an integer k.A pair (l,r) is good if there exists a sequence of indices i_1, i_2, \dots, i_m such that i_1=l and i_m=r; i_j < i_{j+1} for all 1 \le... | 43 01 1 14 24 8 6 86 47 2 5 8 3 820 23110 57 98 14 20 1 60 82 108 37 82 73 8 46 38 35 106 115 58 112 | 6 9 18 92 | 3 seconds | 256 megabytes | ['binary search', 'data structures', 'dp', '*2600'] |
E. Tree Sumtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet us call an edge-weighted tree with n vertices numbered from 1 to n good if the weight of each edge is either 1 or -1 and for each vertex i, the product of the edge weights of all edges having i as one en... | 2
| 998244352 | 3 seconds | 256 megabytes | ['combinatorics', 'math', 'trees', '*2600'] |
D. GCD Queries time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.There is a secret permutation p of [0,1,2,\ldots,n-1]. Your task is to find 2 indices x and y (1 \leq x, y \leq n, possibly x=y) such that p_x=0 or p_y=0. In order to find ... | 2
2
1
1
5
2
4
1
| ? 1 2 ! 1 2 ? 1 2 ? 2 3 ! 3 3 | 3 seconds | 256 megabytes | ['constructive algorithms', 'interactive', 'number theory', '*2100'] |
C. Binary Strings are Funtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA binary string^\dagger b of odd length m is good if b_i is the median^\ddagger of b[1,i]^\S for all odd indices i (1 \leq i \leq m).For a binary string a of length k, a binary string b of lengt... | 6111021130109101101111371011011111011010000011011111111011111 | 1 1 3 3 21 365 | 1 second | 256 megabytes | ['combinatorics', 'math', '*1400'] |
B. Make Array Goodtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array b of m positive integers is good if for all pairs i and j (1 \leq i,j \leq m), \max(b_i,b_j) is divisible by \min(b_i,b_j).You are given an array a of n positive integers. You can perform the ... | 442 3 5 524 853 4 343 5 6331 5 17 | 4 1 2 1 1 2 2 3 0 0 5 1 3 1 4 2 1 5 4 3 7 3 1 29 2 5 3 3 | 1 second | 256 megabytes | ['constructive algorithms', 'implementation', 'number theory', 'sortings', '*1100'] |
A. Divide and Conquertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array b is good if the sum of elements of b is even. You are given an array a consisting of n positive integers. In one operation, you can select an index i and change a_i := \lfloor \frac{a_i}{2... | 441 1 1 127 431 2 4115 | 0 2 1 4 | 1 second | 256 megabytes | ['greedy', 'math', 'number theory', '*800'] |
G. Centroid Guesstime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis in an interactive problem.There is an unknown tree consisting of n nodes, which has exactly one centroid. You only know n at first, and your task is to find the centroid of the tree.You can ask th... | 5
2
1
2
3
1
1
1
| ? 1 2 ? 1 3 ? 1 4 ? 1 5 ? 2 3 ? 3 4 ? 4 5 ! 3 | 4 seconds | 512 megabytes | ['interactive', 'probabilities', 'trees', '*3500'] |
F2. Anti-median (Hard Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference between the two versions is the constraint on n. You can make hacks only if all versions of the problem are solved.Let's call a... | 52-1 -13-1 -1 -141 2 3 46-1 -1 3 4 -1 -18-1 -1 -1 -1 -1 -1 -1 -1 | 2 4 0 1 316 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', '*3500'] |
F1. Anti-median (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference between the two versions is the constraint on n. You can make hacks only if all versions of the problem are solved.Let's call a... | 52-1 -13-1 -1 -141 2 3 46-1 -1 3 4 -1 -18-1 -1 -1 -1 -1 -1 -1 -1 | 2 4 0 1 316 | 2 seconds | 256 megabytes | ['dp', 'math', '*3100'] |
E. Make It Connectedtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a simple undirected graph consisting of n vertices. The graph doesn't contain self-loops, there is at most one edge between each pair of vertices. Your task is simple: make the graph co... | 430111001003000001010401001000000100106001100000011100100101000010001010010 | 0 1 1 2 3 4 3 2 5 6 | 1 second | 512 megabytes | ['binary search', 'brute force', 'constructive algorithms', 'dsu', 'graphs', 'greedy', 'matrices', 'trees', 'two pointers', '*2400'] |
D. Carry Bittime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet f(x,y) be the number of carries of x+y in binary (i. e. f(x,y)=g(x)+g(y)-g(x+y), where g(x) is the number of ones in the binary representation of x).Given two integers n and k, find the number of ordered... | 3 1
| 15 | 1 second | 256 megabytes | ['combinatorics', 'math', '*2100'] |
C. Set Constructiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a binary matrix b (all elements of the matrix are 0 or 1) of n rows and n columns.You need to construct a n sets A_1, A_2, \ldots, A_n, for which the following conditions are satisfied: ... | 2
4
0001
1001
0001
0000
3
011
001
000
| 3 1 2 3 2 1 3 2 2 4 4 1 2 3 4 1 1 2 1 2 3 1 2 3 | 1 second | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'greedy', '*1400'] |
B. Elimination of a Ringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDefine a cyclic sequence of size n as an array s of length n, in which s_n is adjacent to s_1.Muxii has a ring represented by a cyclic sequence a of size n.However, the ring itself hates equal ad... | 341 2 3 241 2 1 211 | 4 3 1 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', '*1000'] |
A. Two Permutationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three integers n, a, and b. Determine if there exist two permutations p and q of length n, for which the following conditions hold: The length of the longest common prefix of p and q is... | 41 1 12 1 23 1 14 1 1 | Yes No No Yes | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', '*800'] |
G. SlavicG's Favorite Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a weighted tree with n vertices. Recall that a tree is a connected graph without any cycles. A weighted tree is a tree in which each edge has a certain weight. The tree is und... | 35 1 41 3 12 3 24 3 33 5 12 1 21 2 26 2 31 2 12 3 13 4 14 5 35 6 5 | YES NO YES | 2 seconds | 256 megabytes | ['bitmasks', 'dfs and similar', 'graphs', '*1700'] |
F. Queststime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n quests. If you complete the i-th quest, you will gain a_i coins. You can only complete at most one quest per day. However, once you complete a quest, you cannot do the same quest again for k days. ... | 62 5 41 22 20 10100 103 100 37 2 64 20 34 5 6 74 100000000000 20228217734 927368 26389746 6278969742 20 45 1 | 2 Infinity Impossible 1 12 0 | 3 seconds | 256 megabytes | ['binary search', 'greedy', 'sortings', '*1500'] |
E. Binary Inversionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a binary array^{\dagger} of length n. You are allowed to perform one operation on it at most once. In an operation, you can choose any element and flip it: turn a 0 into a 1 or vice-ve... | 541 0 1 060 1 0 0 1 020 081 0 1 1 0 0 0 131 1 1 | 3 7 1 13 2 | 2 seconds | 256 megabytes | ['data structures', 'greedy', 'math', '*1100'] |
D. Challenging Valleystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a[0 \dots n-1] of n integers. This array is called a "valley" if there exists exactly one subarray a[l \dots r] such that: 0 \le l \le r \le n-1, a_l = a_{l+1} = a_{l+2} =... | 673 2 2 1 2 2 3111 1 1 2 3 3 4 5 6 6 671 2 3 4 3 2 179 7 4 6 9 9 101100000000089 4 4 5 9 4 9 10 | YES YES NO YES YES NO | 2 seconds | 256 megabytes | ['implementation', 'two pointers', '*1000'] |
C. Advantagetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n participants in a competition, participant i having a strength of s_i. Every participant wonders how much of an advantage they have over the other best participant. In other words, each particip... | 544 7 3 521 251 2 3 4 534 9 444 4 4 4 | -3 2 -4 -2 -1 1 -4 -3 -2 -1 1 -5 5 -5 0 0 0 0 | 2 seconds | 256 megabytes | ['data structures', 'implementation', 'sortings', '*800'] |
B. Atilla's Favorite Problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn order to write a string, Atilla needs to first learn all letters that are contained in the string.Atilla needs to write a message which can be represented as a string s. He asks you what i... | 51a4down10codeforces3bcf5zzzzz | 1 23 19 6 26 | 1 second | 256 megabytes | ['greedy', 'implementation', 'strings', '*800'] |
A. Medium Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven three distinct integers a, b, and c, find the medium number between all of them.The medium number is the number that is neither the minimum nor the maximum of the given three numbers. For example, ... | 95 2 614 3 420 2 11 2 311 19 1210 8 206 20 34 1 319 8 4 | 5 4 2 2 12 10 6 3 8 | 1 second | 256 megabytes | ['implementation', 'sortings', '*800'] |
G. Restore the Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of n numbers is called permutation if it contains all numbers from 1 to n exactly once. For example, the sequences [3, 1, 4, 2], [1] and [2,1] are permutations, but [1,2,1], [0,1] an... | 664 3 642 488 7 2 366 4 244 488 7 4 5 | 1 4 2 3 5 6 1 2 3 4 -1 5 6 3 4 1 2 -1 1 8 6 7 2 4 3 5 | 1 second | 256 megabytes | ['binary search', 'constructive algorithms', 'data structures', 'greedy', 'math', '*1900'] |
F. All Possible Digitstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA positive number x of length n in base p (2 \le p \le 10^9) is written on the blackboard. The number x is given as a sequence a_1, a_2, \dots, a_n (0 \le a_i < p) — the digits of x in order from ... | 112 31 24 21 1 1 16 61 2 3 4 5 05 21 0 1 0 13 101 2 35 10004 1 3 2 53 52 3 44 43 2 3 01 325 51 2 2 2 43 41 0 1 | 1 1 0 0 7 995 2 1 1 1 2 | 3 seconds | 256 megabytes | ['binary search', 'data structures', 'greedy', 'math', 'number theory', '*1800'] |
E. The Humanoidtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n astronauts working on some space station. An astronaut with the number i (1 \le i \le n) has power a_i.An evil humanoid has made his way to this space station. The power of this humanoid is e... | 84 12 1 8 93 36 2 604 55 1 100 53 238 6 31 1124 612 12 36 1004 12 1 1 153 515 1 13 | 4 3 3 3 0 4 4 3 | 2 seconds | 256 megabytes | ['brute force', 'dp', 'sortings', '*1500'] |
D. Make It Roundtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInflation has occurred in Berlandia, so the store needs to change the price of goods.The current price of good n is given. It is allowed to increase the price of the good by k times, with 1 \le k \le m, ... | 106 115 4313 54 1610050 123452 64 3025 102 811 7 | 60 200 65 60 120600000 10 100 200 100 7 | 1 second | 256 megabytes | ['brute force', 'number theory', '*1400'] |
C. Thermostattime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVlad came home and found out that someone had reconfigured the old thermostat to the temperature of a.The thermostat can only be set to a temperature from l to r inclusive, the temperature cannot change by ... | 103 5 63 30 15 54 50 10 53 73 5 63 4-10 10 11-5 6-3 3 41 0-5 10 89 21 5 12 5-1 4 30 2-6 3 6-1 -4 | 0 2 3 -1 1 -1 3 1 3 -1 | 1 second | 256 megabytes | ['greedy', 'math', 'shortest paths', '*1100'] |
B. Lost Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA sequence of n numbers is called a permutation if it contains all integers from 1 to n exactly once. For example, the sequences [3, 1, 4, 2], [1] and [2,1] are permutations, but [1,2,1], [0,1] and [1... | 53 133 1 41 113 31 4 22 14 35 61 2 3 4 5 | YES NO YES NO YES | 1 second | 256 megabytes | ['math', '*800'] |
A. Yes-Yes?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou talked to Polycarp and asked him a question. You know that when he wants to answer "yes", he repeats Yes many times in a row.Because of the noise, you only heard part of the answer — some substring of it.... | 12YESesYescodeforcesesseYesYesYesYesYesYesYesYeseYYesssYoYes | NO YES NO YES NO YES YES NO NO YES NO YES | 1 second | 256 megabytes | ['implementation', 'strings', '*800'] |
F. Decent Divisiontime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA binary string is a string where every character is \texttt{0} or \texttt{1}. Call a binary string decent if it has an equal number of \texttt{0}s and \texttt{1}s.Initially, you have an infinite bina... | 5
1
6
5
5
6
| 0 1 1 2 0 1 5 6 1 5 6 2 6 7 4 5 1 4 5 0 1 6 7 0 | 5 seconds | 256 megabytes | ['constructive algorithms', 'data structures', '*3000'] |
E. Tick, Tocktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTannhaus, the clockmaker in the town of Winden, makes mysterious clocks that measure time in h hours numbered from 0 to h-1. One day, he decided to make a puzzle with these clocks. The puzzle consists of an... | 52 3 41 0 -1-1 -1 22 2 101 23 54 5 10241 -1 -1 -1 -1-1 -1 -1 1000 -1-1 -1 -1 -1 69420 -1 -1 999 -13 3 3-1 -1 12 -1 12 -1 23 3 31 -1 2-1 0 -1-1 1 0 | 4 0 73741817 0 1 | 1 second | 256 megabytes | ['combinatorics', 'dfs and similar', 'dsu', 'graphs', '*2500'] |
D. Range = √Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n. Find a sequence of n distinct integers a_1, a_2, \dots, a_n such that 1 \leq a_i \leq 10^9 for all i and \max(a_1, a_2, \dots, a_n) - \min(a_1, a_2, \dots, a_n)= \sqrt{a_1 + a_... | 3254 | 3 1 20 29 18 26 28 25 21 23 31 | 1 second | 256 megabytes | ['binary search', 'brute force', 'constructive algorithms', 'math', 'two pointers', '*1800'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.