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 |
|---|---|---|---|---|---|
E1. Chiori and Doll Picking (easy version)time limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference between easy and hard versions is the constraint of m. You can make hacks only if both versions are solved.Chiori l... | 4 4
3 5 8 14
| 2 2 6 6 0 | 3 seconds | 512 megabytes | ['bitmasks', 'brute force', 'combinatorics', 'math', '*2700'] |
D. Yui and Mahjong Settime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Yui is a girl who enjoys playing Mahjong. She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between 1 and n, an... | 5
1 6
2 9
5 12
5 24
6 24
| + 1 + 1 + 2 + 5 ! 2 1 3 0 2 | 1 second | 256 megabytes | ['constructive algorithms', 'interactive', '*3200'] |
C. Kaavi and Magic Spelltime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputKaavi, the mysterious fortune teller, deeply believes that one's fate is inevitable and unavoidable. Of course, she makes her living by predicting others' future. While doing divination, Kaavi b... | abab
ba
| 12 | 2 seconds | 512 megabytes | ['dp', 'strings', '*2200'] |
B. Xenia and Colorful Gemstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputXenia is a girl being born a noble. Due to the inflexibility and harshness of her family, Xenia has to find some ways to amuse herself. Recently Xenia has bought n_r red gems, n_g green gems a... | 5
2 2 3
7 8
6 3
3 1 4
1 1 1
1
1
1000000000
2 2 2
1 2
5 4
6 7
2 2 2
1 2
3 4
6 7
3 4 1
3 2 1
7 3 3 4
6
| 14 1999999996000000002 24 24 14 | 3 seconds | 256 megabytes | ['binary search', 'greedy', 'math', 'sortings', 'two pointers', '*1700'] |
A. Linova and Kingdomtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWriting light novels is the most important thing in Linova's life. Last night, Linova dreamed about a fantastic kingdom. She began to write a light novel for the kingdom as soon as she woke up, and... | 7 4
1 2
1 3
1 4
3 5
3 6
4 7
| 7 | 2 seconds | 256 megabytes | ['dfs and similar', 'dp', 'greedy', 'sortings', 'trees', '*1600'] |
F. Robots on a Gridtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a rectangular grid of size n \times m. Each cell of the grid is colored black ('0') or white ('1'). The color of the cell (i, j) is c_{i, j}. You are also given a map of directions: for each... | 3
1 2
01
RL
3 3
001
101
110
RLL
DLD
ULL
3 3
000
000
000
RRD
RLD
ULL
| 2 1 4 3 2 2 | 3 seconds | 256 megabytes | ['data structures', 'dfs and similar', 'dsu', 'graphs', 'greedy', 'matrices', '*2200'] |
E2. Three Blocks Palindrome (hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between easy and hard versions is constraints.You are given a sequence a consisting of n positive integers.Let's define a three blocks palindrome as the seq... | 6
8
1 1 2 2 3 2 1 1
3
1 3 3
4
1 10 10 1
1
26
2
2 1
3
1 1 1
| 7 2 4 1 1 3 | 2 seconds | 256 megabytes | ['brute force', 'data structures', 'dp', 'two pointers', '*1800'] |
E1. Three Blocks Palindrome (easy version)time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between easy and hard versions is constraints.You are given a sequence a consisting of n positive integers.Let's define a three blocks palindrome as the seq... | 6
8
1 1 2 2 3 2 1 1
3
1 3 3
4
1 10 10 1
1
26
2
2 1
3
1 1 1
| 7 2 4 1 1 3 | 3 seconds | 256 megabytes | ['binary search', 'brute force', 'data structures', 'dp', 'two pointers', '*1700'] |
D. Anti-Sudokutime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a correct solution of the sudoku puzzle. If you don't know what is the sudoku, you can read about it here.The picture showing the correct sudoku solution:Blocks are bordered with bold black ... | 1
154873296
386592714
729641835
863725149
975314628
412968357
631457982
598236471
247189563
| 154873396 336592714 729645835 863725145 979314628 412958357 631457992 998236471 247789563 | 2 seconds | 256 megabytes | ['constructive algorithms', 'implementation', '*1300'] |
C. Two Teams Composingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the i-th student skill is denoted by an... | 4
7
4 2 4 1 4 3 4
5
2 1 5 4 3
1
1
4
1 1 1 3
| 3 1 0 2 | 2 seconds | 256 megabytes | ['binary search', 'greedy', 'implementation', 'sortings', '*1100'] |
B. Construct the Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three positive integers n, a and b. You have to construct a string s of length n consisting of lowercase Latin letters such that each substring of length a has exactly b distinct le... | 4
7 5 3
6 1 1
6 6 1
5 2 2
| tleelte qwerty vvvvvv abcde | 2 seconds | 256 megabytes | ['constructive algorithms', '*900'] |
A. Candies and Two Sisterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are two sisters Alice and Betty. You have n candies. You want to distribute these n candies between two sisters in such a way that: Alice will get a (a > 0) candies; Betty will get b (b... | 6
7
1
2
3
2000000000
763243547
| 3 0 0 1 999999999 381621773 | 1 second | 256 megabytes | ['math', '*800'] |
G. Substring Searchtime limit per test1.25 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a permutation p consisting of exactly 26 integers from 1 to 26 (since it is a permutation, each integer from 1 to 26 occurs in p exactly once) and two strings s and t consisting of l... | 2 3 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
abc
abcaaba
| 11001 | 1.25 seconds | 512 megabytes | ['bitmasks', 'brute force', 'fft', '*2900'] |
F. Strange Functiontime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's denote the following function f. This function takes an array a of length n and returns an array. Initially the result is an empty array. For each integer i from 1 to n we add element a_i to th... | 11
4 1 3 3 7 8 7 9 10 7 11
3 5 0 -2 5 3 6 7 8 2 4
3
3 7 10
| YES 20 | 3 seconds | 256 megabytes | ['binary search', 'data structures', 'dp', 'greedy', '*2500'] |
E. Divisor Pathstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a positive integer D. Let's build the following graph from it: each vertex is a divisor of D (not necessarily prime, 1 and D itself are also included); two vertices x and y (x > y) have... | 12
3
4 4
12 1
3 4
| 1 3 1 | 3 seconds | 256 megabytes | ['combinatorics', 'graphs', 'greedy', 'math', 'number theory', '*2200'] |
D. Minimum Euler Cycletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a complete directed graph K_n with n vertices: each pair of vertices u \neq v in K_n have both directed edges (u, v) and (v, u); there are no self-loops.You should find such a cycle ... | 3
2 1 3
3 3 6
99995 9998900031 9998900031
| 1 2 1 1 3 2 3 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'graphs', 'greedy', 'implementation', '*1800'] |
C. Circle of Monsterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing another computer game, and now you have to slay n monsters. These monsters are standing in a circle, numbered clockwise from 1 to n. Initially, the i-th monster has a_i health.You ma... | 1
3
7 15
2 14
5 3
| 6 | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'math', '*1600'] |
B. Middle Classtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMany years ago Berland was a small country where only n people lived. Each person had some savings: the i-th one had a_i burles.The government considered a person as wealthy if he had at least x burles. ... | 4
4 3
5 1 2 1
4 10
11 9 11 9
2 5
4 3
3 7
9 4 9
| 2 4 0 3 | 2 seconds | 256 megabytes | ['greedy', 'sortings', '*1100'] |
A. Level Statisticstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has recently created a new level in this cool new game Berlio Maker 85 and uploaded it online. Now players from all over the world can try his level.All levels in this game have two stats to... | 6
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
| NO YES NO YES NO YES | 2 seconds | 256 megabytes | ['implementation', 'math', '*1200'] |
F. Kate and imperfectiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputKate has a set S of n integers \{1, \dots, n\} . She thinks that imperfection of a subset M \subseteq S is equal to the maximum of gcd(a, b) over all pairs (a, b) such that both a and b are in M ... | 2
| 1 | 1 second | 256 megabytes | ['greedy', 'implementation', 'math', 'number theory', 'sortings', 'two pointers', '*2200'] |
E. Road to 1600time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEgor wants to achieve a rating of 1600 points on the well-known chess portal ChessForces and he needs your help!Before you start solving the problem, Egor wants to remind you how the chess pieces move. Ch... | 1
| -1 | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', '*2400'] |
D. Challenges in school №41time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n children, who study at the school №41. It is well-known that they are good mathematicians. Once at a break, they arranged a challenge for themselves. All children arranged in a ro... | 2 1
RL
| 1 1 | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'games', 'graphs', 'greedy', 'implementation', 'sortings', '*2100'] |
C. Eugene and an arraytime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEugene likes working with arrays. And today he needs your help in solving one challenging task.An array c is a subarray of an array b if c can be obtained from b by deletion of several (possibly... | 3
1 2 -3
| 5 | 1.5 seconds | 256 megabytes | ['binary search', 'data structures', 'implementation', 'two pointers', '*1700'] |
B. Kind Antontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOnce again, Boris needs the help of Anton in creating a task. This time Anton needs to solve the following problem:There are two arrays of integers a and b of length n. It turned out that array a contains o... | 5
3
1 -1 0
1 1 -2
3
0 1 1
0 2 2
2
1 0
1 41
2
-1 0
-1 -41
5
0 1 -1 1 -1
1 1 -1 1 -1
| YES NO YES YES NO | 1 second | 256 megabytes | ['greedy', 'implementation', '*1100'] |
A. Little Artemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYoung boy Artem tries to paint a picture, and he asks his mother Medina to help him. Medina is very busy, that's why she asked for your help.Artem wants to paint an n \times m board. Each cell of the boar... | 2
3 2
3 3
| BW WB BB BWB BWW BWB | 1 second | 256 megabytes | ['constructive algorithms', '*1000'] |
G. No Monotone Triplestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputGiven a sequence of integers a of length n, a tuple (i,j,k) is called monotone triples if 1 \le i<j<k\le n; a_i \le a_j \le a_k or a_i \ge a_j \ge a_k is satisfied. For example, a=[5,3,4,5], th... | 6 2
3 1 4 1 5 9
1 3
4 6
| 3 1 2 3 0 | 2 seconds | 512 megabytes | ['data structures', '*3100'] |
F. Independent Settime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputEric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph.Given a graph G=(V,E), an independent set is a subset of vertices V' \subset V such that for ev... | 2
2 1
| 3 | 2 seconds | 512 megabytes | ['dfs and similar', 'dp', 'trees', '*2500'] |
E. Height All the Sametime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice has got addicted to a game called Sirtet recently.In Sirtet, player is given an n \times m grid. Initially a_{i,j} cubes are stacked up in the cell (i,j). Two cells are called adjacent if th... | 2 2 1 1
| 1 | 2 seconds | 512 megabytes | ['combinatorics', 'constructive algorithms', 'math', 'matrices', '*2100'] |
D. Walk on Matrixtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBob is playing a game named "Walk on Matrix".In this game, player is given an n \times m matrix A=(a_{i,j}), i.e. the element in the i-th row in the j-th column is a_{i,j}. Initially, player is located... | 0
| 1 1 300000 | 2 seconds | 512 megabytes | ['bitmasks', 'constructive algorithms', 'math', '*1700'] |
C. K-Complete Wordtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputWord s of length n is called k-complete if s is a palindrome, i.e. s_i=s_{n+1-i} for all 1 \le i \le n; s has a period of k, i.e. s_i=s_{k+i} for all 1 \le i \le n-k. For example, "abaaba" is a 3-c... | 4
6 2
abaaba
6 3
abaaba
36 9
hippopotomonstrosesquippedaliophobia
21 7
wudixiaoxingxingheclp
| 2 0 23 16 | 2 seconds | 512 megabytes | ['dfs and similar', 'dsu', 'greedy', 'implementation', 'strings', '*1500'] |
B. Composite Coloringtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA positive integer is called composite if it can be represented as a product of two positive integers, both greater than 1. For example, the following numbers are composite: 6, 4, 120, 27. The foll... | 3
3
6 10 15
2
4 9
23
437 519 865 808 909 391 194 291 237 395 323 365 511 497 781 737 871 559 731 697 779 841 961
| 1 1 1 1 2 2 1 11 4 7 8 10 7 3 10 7 7 8 3 1 1 5 5 9 2 2 3 3 4 11 6 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'math', 'number theory', '*1400'] |
A. Exercising Walktime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice has a cute cat. To keep her cat fit, Alice wants to design an exercising walk for her cat! Initially, Alice's cat is located in a cell (x,y) of an infinite grid. According to Alice's theory, cat... | 6
3 2 2 2
0 0 -2 -2 2 2
3 1 4 1
0 0 -1 -1 1 1
1 1 1 1
1 1 1 1 1 1
0 0 0 1
0 0 0 0 0 1
5 1 1 1
0 0 -100 -100 0 100
1 1 5 1
0 0 -100 -100 100 0
| Yes No No Yes Yes Yes | 2 seconds | 512 megabytes | ['greedy', 'implementation', 'math', '*1100'] |
H. It's showtimetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a mysterious language (codenamed "UnknownX") available in "Custom Test" tab. Find out what this language is, and use it to solve the following problem.You are given an integer input = 1000 ... | 6100
| 48 | 1 second | 256 megabytes | ['*special problem'] |
G. Lingua Romanatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputper nextum in unam tum XI conscribementis fac sic vestibulo perlegementum da varo. morde varo. seqis cumula varum.cisper nextum in unam tum XI conscribementis fac sic seqis decumulamenta da v... | 0
1
-2
-3
-4
-5
-6
-7
-8
-9
10
| f(10) = MAGNA NIMIS! f(-9) = -3642.00 f(-8) = -2557.17 f(-7) = -1712.35 f(-6) = -1077.55 f(-5) = -622.76 f(-4) = -318.00 f(-3) = -133.27 f(-2) = -38.59 f(1) = 6.00 f(0) = 0.00 | 1 second | 256 megabytes | ['*special problem'] |
F. Elementary!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe input consists of a single string of uppercase letters A-Z. The length of the string is between 1 and 10 characters, inclusive.OutputOutput "YES" or "NO".ExamplesInput
GENIUS
Output
YES
Input
DOCT... | GENIUS
| YES | 1 second | 256 megabytes | ['*special problem', 'brute force', 'dp', 'strings'] |
E. Jordan Smileytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output InputThe input contains two integers row, col (0 \le row, col \le 63), separated by a single space.OutputOutput "IN" or "OUT".ExamplesInput
0 0
Output
OUT
Input
27 0
Output
IN
Input
0 27
Output
OUT
Inp... | 0 0
| OUT | 1 second | 256 megabytes | ['*special problem', 'dfs and similar', 'geometry', 'implementation'] |
D. Again?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe only line of the input contains a 7-digit hexadecimal number. The first "digit" of the number is letter A, the rest of the "digits" are decimal digits 0-9.OutputOutput a single integer.ExamplesInput
A2... | A278832
| 0 | 1 second | 256 megabytes | ['*special problem', 'implementation'] |
C. ...And after happily lived ever theytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe input contains a single integer a (0 \le a \le 63).OutputOutput a single number.ExamplesInput
2
Output
2
Input
5
Output
24
Input
35
Output
50
| 2
| 2 | 1 second | 256 megabytes | ['*special problem', 'bitmasks'] |
B. Limerickstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere was once young lass called Mary, Whose jokes were occasionally scary. On this April's Fool Fixed limerick rules Allowed her to trip the unwary.Can she fill all the linesTo work at all times?On jugg... | 35
| 57 | 1 second | 256 megabytes | ['*special problem', 'math', 'number theory'] |
B. Dreamoon Likes Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe sequence of m integers is called the permutation if it contains all integers from 1 to m exactly once. The number m is called the length of the permutation.Dreamoon has two permutation... | 6
5
1 4 3 2 1
6
2 4 1 3 2 1
4
2 1 1 3
4
1 3 3 1
12
2 1 3 4 5 6 7 8 9 1 10 2
3
1 1 1
| 2 1 4 4 1 1 4 2 0 0 1 2 10 0 | 2 seconds | 256 megabytes | ['implementation', 'math', '*1400'] |
A. Dreamoon and Ranking Collectiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon is a big fan of the Codeforces contests.One day, he claimed that he will collect all the places from 1 to 54 after two more rated contests. It's amazing!Based on this, you come... | 5
6 2
3 1 1 5 7 10
1 100
100
11 1
1 1 1 1 1 1 1 1 1 1 1
1 1
1
4 57
80 60 40 20
| 5 101 2 2 60 | 1 second | 256 megabytes | ['implementation', '*900'] |
E. Dreamoon Loves AAtime limit per test3.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a string of length n+1 of characters 'A' and 'B'. The first character and last character of the string are equal to 'A'.You are given m indices p_1, p_2, \ldots, p_m (0-indexation) denoti... | 5
80 3 5
11 24 50
81 7 12
4 10 17 26 37 48 61
25 10 14
3 4 7 12 13 15 17 19 21 23
1 0 0
10 2 0
2 4
| 5 2 0 0 4 | 3.5 seconds | 256 megabytes | ['binary search', 'greedy', '*3300'] |
D. Dreamoon Likes Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon likes strings. Today he created a game about strings:String s_1, s_2, \ldots, s_n is beautiful if and only if for each 1 \le i < n, s_i \ne s_{i+1}.Initially, Dreamoon has a string a. ... | 4
aabbcc
aaabbb
aaa
abacad
| 3 3 3 2 4 1 2 3 3 4 2 3 1 2 3 1 1 1 1 1 1 1 1 6 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', '*3100'] |
C. Drazil Likes Heaptime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDrazil likes heap very much. So he created a problem with heap:There is a max heap with a height h implemented on the array. The details of this heap are the following:This heap contains exactly 2... | 2
3 2
7 6 3 5 4 2 1
3 2
7 6 5 4 3 2 1
| 10 3 2 3 1 8 2 1 3 1 | 1.5 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'greedy', 'implementation', '*2400'] |
B. Dreamoon Likes Sequencestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon likes sequences very much. So he created a problem about the sequence that you can't find in OEIS: You are given two integers d, m, find the number of arrays a, satisfying the followi... | 10
1 1000000000
2 999999999
3 99999998
4 9999997
5 999996
6 99995
7 9994
8 993
9 92
10 1
| 1 3 5 11 17 23 29 59 89 0 | 1 second | 256 megabytes | ['bitmasks', 'combinatorics', 'math', '*1700'] |
A. Dreamoon Likes Coloringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon likes coloring cells very much.There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n.You are given an integer m and m int... | 5 3
3 2 2
| 2 4 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'implementation', 'math', '*1800'] |
F. Make k Equaltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given the array a consisting of n elements and the integer k \le n.You want to obtain at least k equal elements in the array a. In one move, you can make one of the following two operations: Tak... | 6 5
1 2 2 4 2 3
| 3 | 2 seconds | 256 megabytes | ['greedy', '*2200'] |
E. Tree Queriestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a rooted tree consisting of n vertices numbered from 1 to n. The root of the tree is a vertex number 1.A tree is a connected undirected graph with n-1 edges.You are given m queries. The i-t... | 10 6
1 2
1 3
1 4
2 5
2 6
3 7
7 8
7 9
9 10
4 3 8 9 10
3 2 4 6
3 2 1 5
3 4 8 2
2 6 10
3 5 4 7
| YES YES YES YES NO NO | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'trees', '*1900'] |
D. Carouseltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe round carousel consists of n figures of animals. Figures are numbered from 1 to n in order of the carousel moving. Thus, after the n-th figure the figure with the number 1 follows. Each figure has its ow... | 4
5
1 2 1 2 2
6
1 2 2 1 2 2
5
1 2 1 2 3
3
10 10 10
| 2 1 2 1 2 2 2 2 1 2 1 2 1 3 2 3 2 3 1 1 1 1 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'dp', 'graphs', 'greedy', 'math', '*1800'] |
C. Ternary XORtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA number is ternary if it contains only digits 0, 1 and 2. For example, the following numbers are ternary: 1022, 11, 21, 2002.You are given a long ternary number x. The first (leftmost) digit of x is guara... | 4
5
22222
5
21211
1
2
9
220222021
| 11111 11111 11000 10211 1 1 110111011 110111010 | 1 second | 256 megabytes | ['greedy', 'implementation', '*1200'] |
B. K-th Beautiful Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor the given integer n (n > 2) let's write down all the strings of length n which contain n-2 letters 'a' and two letters 'b' in lexicographical (alphabetical) order.Recall that the string s of ... | 7
5 1
5 2
5 8
5 10
3 1
3 2
20 100
| aaabb aabab baaba bbaaa abb bab aaaaabaaaaabaaaaaaaa | 1 second | 256 megabytes | ['binary search', 'brute force', 'combinatorics', 'implementation', 'math', '*1300'] |
A. Divisibility Problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integers a and b. In one move you can increase a by 1 (replace a with a+1). Your task is to find the minimum number of moves you need to do in order to make a divisible ... | 5
10 4
13 9
100 13
123 456
92 46
| 2 5 4 333 0 | 1 second | 256 megabytes | ['math', '*800'] |
G. Letters and Question Markstime limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a string S and an array of strings [t_1, t_2, \dots, t_k]. Each string t_i consists of lowercase Latin letters from a to n; S consists of lowercase Latin letters from a to n ... | 4
abc -10
a 1
b 1
c 3
?b?
| 5 | 4 seconds | 1024 megabytes | ['bitmasks', 'dp', 'string suffix structures', '*2800'] |
F. AND Segmentstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three integers n, k, m and m conditions (l_1, r_1, x_1), (l_2, r_2, x_2), \dots, (l_m, r_m, x_m).Calculate the number of distinct arrays a, consisting of n integers such that: 0 \le a_i <... | 4 3 2
1 3 3
3 4 6
| 3 | 3 seconds | 256 megabytes | ['bitmasks', 'combinatorics', 'data structures', 'dp', 'two pointers', '*2500'] |
E. Count The Blockstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou wrote down all integers from 0 to 10^n - 1, padding them with leading zeroes so their lengths are exactly n. For example, if n = 3 then you wrote out 000, 001, ..., 998, 999.A block in an integer... | 1
| 10 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', '*1800'] |
D. Infinite Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a colored permutation p_1, p_2, \dots, p_n. The i-th element of the permutation has color c_i.Let's define an infinite path as infinite sequence i, p[i], p[p[i]], p[p[p[i]]] \dots where al... | 3
4
1 3 4 2
1 2 2 3
5
2 3 4 5 1
1 2 3 4 5
8
7 4 5 6 1 8 3 2
5 3 6 4 7 5 8 4
| 1 5 2 | 2 seconds | 256 megabytes | ['brute force', 'dfs and similar', 'graphs', 'math', 'number theory', '*2200'] |
C. Game with Chipstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya has a rectangular Board of size n \times m. Initially, k chips are placed on the board, i-th chip is located in the cell at the intersection of sx_i-th row and sy_i-th column.In one action, Petya... | 3 3 2
1 2
2 1
3 3
3 2
| 3 DRD | 1 second | 256 megabytes | ['constructive algorithms', 'implementation', '*1600'] |
B. Princesses and Princestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe King of Berland Polycarp LXXXIV has n daughters. To establish his power to the neighbouring kingdoms he wants to marry his daughters to the princes of these kingdoms. As a lucky coincidence... | 5
4
2 2 3
2 1 2
2 3 4
1 3
2
0
0
3
3 1 2 3
3 1 2 3
3 1 2 3
1
1 1
4
1 1
1 2
1 3
1 4
| IMPROVE 4 4 IMPROVE 1 1 OPTIMAL OPTIMAL OPTIMAL | 2 seconds | 256 megabytes | ['brute force', 'graphs', 'greedy', '*1200'] |
A. Sum of Odd Integerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers n and k. Your task is to find if n can be represented as a sum of k distinct positive odd (not divisible by 2) integers or not.You have to answer t independent test case... | 6
3 1
4 2
10 3
10 2
16 4
16 5
| YES YES NO YES YES NO | 2 seconds | 256 megabytes | ['math', '*1100'] |
G. Spiderweb Treestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call a graph with n vertices, each of which has it's own point A_i = (x_i, y_i) with integer coordinates, a planar tree if: All points A_1, A_2, \ldots, A_n are different and no three points lie... | 4
0 0
0 1
-1 -1
1 -1
1 2
1 3
1 4
| 5 | 1 second | 256 megabytes | ['dp', 'geometry', 'trees', '*3500'] |
F2. Wise Men (Hard Version)time limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved.n wise men... | 3
011
101
110
| 0 0 0 6 | 4 seconds | 512 megabytes | ['bitmasks', 'dp', 'math', '*3200'] |
F1. Wise Men (Easy Version)time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The difference is constraints on the number of wise men and the time limit. You can make hacks only if all versions of this task are solved.n wise men... | 3
011
101
110
| 0 0 0 6 | 2 seconds | 512 megabytes | ['bitmasks', 'brute force', 'dp', 'meet-in-the-middle', '*2600'] |
E. Bombstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation, p_1, p_2, \ldots, p_n.Imagine that some positions of the permutation contain bombs, such that there exists at least one position without a bomb.For some fixed configuration of bombs... | 3
3 2 1
1 2 3
| 3 2 1 | 3 seconds | 256 megabytes | ['data structures', 'two pointers', '*2400'] |
D2. Prefix-Suffix Palindrome (Hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve a... | 5
a
abcdfdcecba
abbaxyzyx
codeforces
acbba
| a abcdfdcba xyzyx c abba | 2 seconds | 256 megabytes | ['binary search', 'greedy', 'hashing', 'string suffix structures', 'strings', '*1800'] |
D1. Prefix-Suffix Palindrome (Easy version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The difference is the constraint on the sum of lengths of strings and the number of test cases. You can make hacks only if you solve a... | 5
a
abcdfdcecba
abbaxyzyx
codeforces
acbba
| a abcdfdcba xyzyx c abba | 2 seconds | 256 megabytes | ['hashing', 'string suffix structures', 'strings', '*1500'] |
C. Permutation Partitionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p_1, p_2, \ldots, p_n of integers from 1 to n and an integer k, such that 1 \leq k \leq n. A permutation means that every number from 1 to n is contained in p exactly... | 3 2
2 1 3
| 5 2 | 1 second | 256 megabytes | ['combinatorics', 'greedy', 'math', '*1300'] |
B. Maximumstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlicia has an array, a_1, a_2, \ldots, a_n, of non-negative integers. For each 1 \leq i \leq n, she has found a non-negative integer x_i = max(0, a_1, \ldots, a_{i-1}). Note that for i=1, x_i = 0.For example,... | 5
0 1 1 -2 1
| 0 1 2 0 3 | 1 second | 256 megabytes | ['implementation', 'math', '*900'] |
A. Bad Ugly Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a integer n (n > 0). Find any integer s which satisfies these conditions, or report that there are no such numbers:In the decimal representation of s: s > 0, s consists of n digits, ... | 4
1
2
3
4
| -1 57 239 6789 | 1 second | 256 megabytes | ['constructive algorithms', 'number theory', '*1000'] |
F. Ehab's Last Theoremtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's the year 5555. You have a graph, and you want to find a long cycle and a huge independent set, just because you can. But for now, let's just stick with finding either.Given a connected graph w... | 6 6
1 3
3 4
4 2
2 6
5 6
5 1
| 1 1 6 4 | 1 second | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'greedy', '*2500'] |
E. Ehab's REAL Number Theory Problemtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n that has a special condition: every element in this array has at most 7 divisors. Find the length of the shortest non-empty subsequence of this a... | 3
1 4 6
| 1 | 3 seconds | 256 megabytes | ['brute force', 'dfs and similar', 'graphs', 'number theory', 'shortest paths', '*2600'] |
D. Ehab the Xorcisttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven 2 integers u and v, find the shortest array such that bitwise-xor of its elements is u, and the sum of its elements is v.InputThe only line contains 2 integers u and v (0 \le u,v \le 10^{18}).Ou... | 2 4
| 2 3 1 | 1 second | 256 megabytes | ['bitmasks', 'constructive algorithms', 'greedy', 'number theory', '*1700'] |
C. Ehab and Path-etic MEXstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree consisting of n nodes. You want to write some labels on the tree's edges such that the following conditions hold: Every label is an integer between 0 and n-2 inclusive. A... | 3
1 2
1 3
| 0 1 | 1 second | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'greedy', 'trees', '*1500'] |
B. CopyCopyCopyCopyCopytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEhab has an array a of length n. He has just enough free time to make a new array consisting of n copies of the old array, written back-to-back. What will be the length of the new array's longest ... | 2
3
3 2 1
6
3 1 4 1 5 9
| 3 5 | 1 second | 256 megabytes | ['greedy', 'implementation', '*800'] |
A. EhAb AnD gCdtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a positive integer x. Find any such 2 positive integers a and b such that GCD(a,b)+LCM(a,b)=x.As a reminder, GCD(a,b) is the greatest integer that divides both a and b. Similarly, LCM(a,b) i... | 2
2
14
| 1 1 6 4 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'number theory', '*800'] |
F. Maximum White Subtreetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree consisting of n vertices. A tree is a connected undirected graph with n-1 edges. Each vertex v of this tree has a color assigned to it (a_v = 1 if the vertex v is white and ... | 9
0 1 1 1 0 0 0 0 1
1 2
1 3
3 4
3 5
2 6
4 7
6 8
5 9
| 2 2 2 2 2 1 1 0 2 | 2 seconds | 256 megabytes | ['dfs and similar', 'dp', 'graphs', 'trees', '*1800'] |
E. Sleeping Scheduletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVova had a pretty weird sleeping schedule. There are h hours in a day. Vova will sleep exactly n times. The i-th time he will sleep exactly after a_i hours from the time he woke up. You can assume t... | 7 24 21 23
16 17 14 20 20 11 22
| 3 | 2 seconds | 256 megabytes | ['dp', 'implementation', '*1700'] |
D. Pair of Topicstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe next lecture in a high school requires two topics to be discussed. The i-th topic is interesting by a_i units for the teacher and by b_i units for the students.The pair of topics i and j (i < j) is... | 5
4 8 2 6 2
4 5 4 1 3
| 7 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'sortings', 'two pointers', '*1400'] |
C. Frog Jumpstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a frog staying to the left of the string s = s_1 s_2 \ldots s_n consisting of n characters (to be more precise, the frog initially stays at the cell 0). Each character of s is either 'L' or 'R'. I... | 6
LRLRRLL
L
LLR
RRRR
LLLLLL
R
| 3 2 3 1 7 1 | 2 seconds | 256 megabytes | ['binary search', 'data structures', 'dfs and similar', 'greedy', 'implementation', '*1100'] |
B. Yet Another Palindrome Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers.Your task is to determine if a has some subsequence of length at least 3 that is a palindrome.Recall that an array b is called a subseq... | 5
3
1 2 1
5
1 2 2 3 2
3
1 1 2
4
1 2 2 1
10
1 1 2 2 3 3 4 4 5 5
| YES YES NO YES NO | 2 seconds | 256 megabytes | ['brute force', 'strings', '*1100'] |
A. Yet Another Tetris Problemtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given some Tetris field consisting of n columns. The initial height of the i-th column of the field is a_i blocks. On top of these columns you can place only figures of size 2 \time... | 4
3
1 1 3
4
1 1 2 1
2
11 11
1
100
| YES NO YES YES | 2 seconds | 256 megabytes | ['implementation', 'number theory', '*900'] |
B. Count Subrectanglestime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array a of length n and array b of length m both consisting of only integers 0 and 1. Consider a matrix c of size n \times m formed by following rule: c_{i, j} = a_i \cdot b_j (i.e... | 3 3 2
1 0 1
1 1 1
| 4 | 1 second | 512 megabytes | ['binary search', 'greedy', 'implementation', '*1500'] |
A. Even Subset Sum Problemtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by 2) or determine that there is no such subset.B... | 3
3
1 4 3
1
15
2
3 5
| 1 2 -1 2 1 2 | 1 second | 512 megabytes | ['brute force', 'dp', 'greedy', 'implementation', '*800'] |
F. Assigning Farestime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMayor of city M. decided to launch several new metro lines during 2020. Since the city has a very limited budget, it was decided not to dig new tunnels but to use the existing underground network.The ... | 3 1
1 2
2 3
1 3
| 3 1 2 3 | 6 seconds | 512 megabytes | ['dp', 'trees', '*3500'] |
E. Median Mountain Rangetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputBerland — is a huge country with diverse geography. One of the most famous natural attractions of Berland is the "Median mountain range". This mountain range is n mountain peaks, located on one ... | 5
1 2 1 2 1
| 2 1 1 1 1 1 | 2 seconds | 512 megabytes | ['data structures', '*3300'] |
D. Reality Showtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA popular reality show is recruiting a new cast for the third season! n candidates numbered from 1 to n have been interviewed. The candidate i has aggressiveness level l_i, and recruiting this candidate ... | 5 4
4 3 1 2 1
1 2 1 2 1
1 2 3 4 5 6 7 8 9
| 6 | 2 seconds | 512 megabytes | ['bitmasks', 'dp', '*2800'] |
C. Instant Noodlestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputWu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. After Wu paid for his purchase, the cashier gave him an interesting task.You are given... | 3
2 4
1 1
1 1
1 2
2 1
2 2
3 4
1 1 1
1 1
1 2
2 2
2 3
4 7
36 31 96 29
1 2
1 3
1 4
2 2
2 4
3 1
4 3
| 2 1 12 | 2 seconds | 512 megabytes | ['graphs', 'hashing', 'math', 'number theory', '*2300'] |
B. Presenttime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputCatherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated various useless characteristics for it. She succeeded to do it for each one she cam... | 2
1 2
| 3 | 3 seconds | 512 megabytes | ['binary search', 'bitmasks', 'constructive algorithms', 'data structures', 'math', 'sortings', '*2100'] |
A. Unusual Competitionstime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputA bracketed sequence is called correct (regular) if by inserting "+" and "1" you can get a well-formed mathematical expression from it. For example, sequences "(())()", "()" and "(()(()))" are cor... | 8
))((())(
| 6 | 1 second | 512 megabytes | ['greedy', '*1300'] |
C. Remove Adjacenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s consisting of lowercase Latin letters. Let the length of s be |s|. You may perform several operations on this string.In one operation, you can choose some index i and remove t... | 8
bacabcab
| 4 | 2 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'strings', '*1600'] |
A. Contest for Robotstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is preparing the first programming contest for robots. There are n problems in it, and a lot of robots are going to participate in it. Each robot solving the problem i gets p_i points, and ... | 5
1 1 1 0 0
0 1 1 1 1
| 3 | 1 second | 256 megabytes | ['greedy', '*900'] |
F. Blocks and Sensorstime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPolycarp plays a well-known computer game (we won't mention its name). Every object in this game consists of three-dimensional blocks — axis-aligned cubes of size 1 \times 1 \times 1. These blocks ... | 4 3 2
1 4
3 2
6 5
1 4
3 2
6 7
1 4
1 4
0 0
0 7
6 5
6 5
0 0
0 7
1 3 6
1 3 6
0 0 0
0 0 7
4 3 5
4 2 5
0 0 0
0 0 7
| 1 4 3 0 6 5 1 4 3 2 6 5 0 0 0 0 0 0 0 0 0 0 0 7 | 3 seconds | 512 megabytes | ['brute force', '*3500'] |
E. Treeland and Virusestime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n cities in Treeland connected with n - 1 bidirectional roads in such that a way that any city is reachable from any other; in other words, the graph of cities and roads is a tree. Tree... | 7
1 2
1 3
2 4
2 5
3 6
3 7
3
2 2
4 1
7 1
1 3
2 2
4 3
7 1
1 3
3 3
1 1
4 100
7 100
1 2 3
| 1 2 1 1 1 1 1 | 3 seconds | 512 megabytes | ['data structures', 'dfs and similar', 'dp', 'shortest paths', 'trees', '*3000'] |
D. Reachable Stringstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn this problem, we will deal with binary strings. Each character of a binary string is either a 0 or a 1. We will also deal with substrings; recall that a substring is a contiguous subsequence of a... | 5
11011
3
1 3 3
1 4 2
1 2 3
| Yes Yes No | 3 seconds | 256 megabytes | ['data structures', 'hashing', 'strings', '*2500'] |
C. World of Darkraft: Battle for Azathothtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRoma is playing a new expansion for his favorite game World of Darkraft. He made a new character and is going for his first grind.Roma has a choice to buy exactly one of n diffe... | 2 3 3
2 3
4 7
2 4
3 2
5 11
1 2 4
2 1 6
3 4 6
| 1 | 2 seconds | 512 megabytes | ['brute force', 'data structures', 'sortings', '*2000'] |
B. Navigation Systemtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe map of Bertown can be represented as a set of n intersections, numbered from 1 to n and connected by m one-way roads. It is possible to move along the roads from any intersection to any other in... | 6 9
1 5
5 4
1 2
2 3
3 4
4 1
2 6
6 4
4 2
4
1 2 3 4
| 1 2 | 2 seconds | 512 megabytes | ['dfs and similar', 'graphs', 'shortest paths', '*1700'] |
A. Journey Planningtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTanya wants to go on a journey across the cities of Berland. There are n cities situated along the main railroad line of Berland, and these cities are numbered from 1 to n. Tanya plans her journey as... | 6
10 7 1 9 10 15
| 26 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'greedy', 'math', 'sortings', '*1400'] |
F. Battalion Strengthtime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n officers in the Army of Byteland. Each officer has some power associated with him. The power of the i-th officer is denoted by p_{i}. As the war is fast approaching, the General would l... | 2
1 2
2
1 2
2 1
| 500000004 1 500000004 | 5 seconds | 256 megabytes | ['data structures', 'divide and conquer', 'probabilities', '*2800'] |
E. Team Buildingtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice, the president of club FCB, wants to build a team for the new volleyball tournament. The team should consist of p players playing in p different positions. She also recognizes the importance of au... | 4 1 2
1 16 10 3
18
19
13
15
| 44 | 3 seconds | 256 megabytes | ['bitmasks', 'dp', 'greedy', 'sortings', '*2300'] |
D. Nash Matrixtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNash designed an interesting yet simple board game where a player is simply required to follow instructions written on the cell where the player currently stands. This board game is played on the n\times ... | 2
1 1 1 1
2 2 2 2
| VALID XL RX | 2 seconds | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'implementation', '*2000'] |
C. Primitive Primestime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is Professor R's last class of his teaching career. Every time Professor R taught a class, he gave a special problem for the students to solve. You being his favourite student, put your heart in... | 3 2 2
1 1 2
2 1
| 1 | 1.5 seconds | 256 megabytes | ['constructive algorithms', 'math', 'ternary search', '*1800'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.