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 |
|---|---|---|---|---|---|
C. Product of Three Numberstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given one integer number n. Find three distinct integers a, b, c such that 2 \le a, b, c and a \cdot b \cdot c = n or say that it is impossible to do it.If there are several answers, ... | 5
64
32
97
2
12345
| YES 2 4 8 NO NO NO YES 3 5 823 | 2 seconds | 256 megabytes | ['greedy', 'math', 'number theory', '*1300'] |
B. Collecting Packagestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a robot in a warehouse and n packages he wants to collect. The warehouse can be represented as a coordinate grid. Initially, the robot stays at the point (0, 0). The i-th package is at the... | 3
5
1 3
1 2
3 3
5 5
4 3
2
1 0
0 1
1
4 3
| YES RUUURRRRUU NO YES RRRRUUU | 1 second | 256 megabytes | ['implementation', 'sortings', '*1200'] |
A. Collecting Coinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has a coins, Barbara has b coins and Cerene has c coins. Recently Polycarp has returned from the tri... | 5
5 3 2 8
100 101 102 105
3 2 1 100000000
10 20 15 14
101 101 101 3
| YES YES NO NO YES | 2 seconds | 256 megabytes | ['math', '*800'] |
B. JOE is on TV!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output3R2 - Standby for ActionOur dear Cafe's owner, JOE Miller, will soon take part in a new game TV-show "1 vs. n"!The game goes in rounds, where in each round the host asks JOE and his opponents a common qu... | 1
| 1.000000000000 | 1 second | 256 megabytes | ['combinatorics', 'greedy', 'math', '*1000'] |
A. ConneR and the A.R.C. Markland-Ntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSakuzyo - ImprintingA.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.It's... | 5
5 2 3
1 2 3
4 3 3
4 1 2
10 2 6
1 2 3 4 5 7
2 1 1
2
100 76 8
76 75 36 67 41 74 10 77
| 2 0 4 0 2 | 1 second | 256 megabytes | ['binary search', 'brute force', 'implementation', '*1100'] |
F. Nora's Toy Boxestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSIHanatsuka - EMber SIHanatsuka - ATONEMENTBack in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-02, both to have fun and enhance his abilities.One day, Nora's a... | 3
2 6 8
| 2 | 1 second | 256 megabytes | ['bitmasks', 'combinatorics', 'dp', '*3500'] |
E. Rin and The Unknown Flowertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMisoilePunch♪ - 彩This is an interactive problem!On a normal day at the hidden office in A.R.C. Markland-N, Rin received an artifact, given to her by the exploration captain Sagar.After much... | 1
4
2 1 2
1 2
0
1 | ? C ? CH ? CCHO ! CCHH | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'interactive', 'math', '*3500'] |
D. Chaotic V.time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputÆsir - CHAOS Æsir - V."Everything has been planned out. No more hidden concerns. The condition of Cytus is also perfect.The time right now...... 00:01:12......It's time."The emotion samples are now suffici... | 3
2 1 4
| 5 | 2 seconds | 512 megabytes | ['dp', 'graphs', 'greedy', 'math', 'number theory', 'trees', '*2700'] |
C. Xenon's Attack on the Gangstime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputINSPION FullBand Master - INSPION INSPION - IOLITE-SUNSTONEOn another floor of the A.R.C. Markland-N, the young man Simon "Xenon" Jackson, takes a break after finishing his project early (... | 3
1 2
2 3
| 3 | 3 seconds | 512 megabytes | ['combinatorics', 'dfs and similar', 'dp', 'greedy', 'trees', '*2300'] |
B. Aroma's Searchtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTHE SxPLAY & KIVΛ - 漂流 KIVΛ & Nikki Simmons - PerspectivesWith a new body, our idol Aroma White (or should we call her Kaori Minamiya?) begins to uncover her lost past through the OS space.The space can... | 1 1 2 3 1 0
2 4 20
| 3 | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'geometry', 'greedy', 'implementation', '*1700'] |
A. NEKO's Maze Gametime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output3R2 as DJ Mashiro - Happiness Breeze Ice - DJ Mashiro is dead or aliveNEKO#ΦωΦ has just got a new maze game on her PC!The game's main puzzle is a maze, in the forms of a 2 \times n rectangle grid. ... | 5 5
2 3
1 4
2 4
2 3
1 4
| Yes No No No Yes | 1.5 seconds | 256 megabytes | ['data structures', 'dsu', 'implementation', '*1400'] |
F. Coffee Varieties (easy version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. You can find the hard version in the Div. 1 contest. Both versions only differ in the number of times you can ask your friend to taste coffee.Th... | 4 2
N
N
Y
N
N
N
N
| ? 1 ? 2 ? 3 ? 4 R ? 4 ? 1 ? 2 ! 3 | 1 second | 256 megabytes | ['graphs', 'interactive', '*2800'] |
B. Array Sharpeningtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou're given an array a_1, \ldots, a_n of n non-negative integers.Let's call it sharpened if and only if there exists an integer 1 \le k \le n such that a_1 < a_2 < \ldots < a_k and a_k > a_{k+1} > \l... | 10
1
248618
3
12 10 8
6
100 11 15 9 7 8
4
0 1 1 0
2
0 0
2
0 1
2
1 0
2
1 1
3
0 1 0
3
1 0 1
| Yes Yes Yes No No Yes Yes Yes Yes No | 1 second | 256 megabytes | ['greedy', 'implementation', '*1300'] |
A. Even But Not Eventime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's define a number ebne (even but not even) if and only if its sum of digits is divisible by 2 but the number itself is not divisible by 2. For example, 13, 1227, 185217 are ebne numbers, while 12... | 4
4
1227
1
0
6
177013
24
222373204424185217171912
| 1227 -1 17703 2237344218521717191 | 1 second | 256 megabytes | ['greedy', 'math', 'strings', '*900'] |
F. Making Shapestime limit per test5 secondsmemory limit per test768 megabytesinputstandard inputoutputstandard outputYou are given n pairwise non-collinear two-dimensional vectors. You can make shapes in the two-dimensional plane with these vectors in the following fashion: Start at the origin (0, 0). Choose a vector ... | 3 3
-1 0
1 1
0 -1
| 3 | 5 seconds | 768 megabytes | ['dp', '*3500'] |
E. Cartesian Tree time limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIldar is the algorithm teacher of William and Harris. Today, Ildar is teaching Cartesian Tree. However, Harris is sick, so Ildar is only teaching William.A cartesian tree is a rooted tree, that can be... | 5
2 4 1 5 3
| 1 3 6 8 11 | 5 seconds | 256 megabytes | ['data structures', '*3300'] |
D. Coffee Varieties (hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. You can find the easy version in the Div. 2 contest. Both versions only differ in the number of times you can ask your friend to taste coffee.Th... | 4 2
N
N
Y
N
N
N
N
| ? 1 ? 2 ? 3 ? 4 R ? 4 ? 1 ? 2 ! 3 | 1 second | 256 megabytes | ['constructive algorithms', 'graphs', 'interactive', '*3000'] |
C. Prefix Enlightenmenttime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n lamps on a line, numbered from 1 to n. Each one has an initial state off (0) or on (1).You're given k subsets A_1, \ldots, A_k of \{1, 2, \dots, n\}, such that the intersection of any... | 7 3
0011100
3
1 4 6
3
3 4 7
2
2 3
| 1 2 3 3 3 3 3 | 3 seconds | 256 megabytes | ['dfs and similar', 'dsu', 'graphs', '*2400'] |
B. Irreducible Anagramstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call two strings s and t anagrams of each other if it is possible to rearrange symbols in the string s to get a string, equal to t.Let's consider two strings s and t which are anagrams of e... | aaaaa
3
1 1
2 4
5 5
| Yes No Yes | 2 seconds | 256 megabytes | ['binary search', 'constructive algorithms', 'data structures', 'strings', 'two pointers', '*1800'] |
A. Mind Controltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou and your n - 1 friends have found an array of integers a_1, a_2, \dots, a_n. You have decided to share it in the following way: All n of you stand in a line in a particular order. Each minute, the per... | 4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2
| 8 4 1 1 | 1 second | 256 megabytes | ['brute force', 'data structures', 'implementation', '*1600'] |
F. Red-Blue Graphtime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a bipartite graph: the first part of this graph contains n_1 vertices, the second part contains n_2 vertices, and there are m edges. The graph can contain multiple edges.Initially, each ed... | 3 2 6 10 15
RRB
UB
3 2
2 2
1 2
1 1
2 1
1 1
| 35 BUURRU | 1 second | 512 megabytes | ['constructive algorithms', 'flows', '*2900'] |
E. Messenger Simulatortime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is a frequent user of the very popular messenger. He's chatting with his friends all the time. He has n friends, numbered from 1 to n.Recall that a permutation of size n is an array of si... | 5 4
3 5 1 4
| 1 3 2 5 1 4 1 5 1 5 | 3 seconds | 256 megabytes | ['data structures', '*2000'] |
D. Minimax Problemtime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given n arrays a_1, a_2, ..., a_n; each array consists of exactly m integers. We denote the y-th element of the x-th array as a_{x, y}.You have to choose two arrays a_i and a_j (1 \le i, j \le... | 6 5
5 0 3 1 2
1 8 9 1 3
1 2 3 4 5
9 1 0 3 7
2 3 0 6 3
6 4 1 7 0
| 1 5 | 5 seconds | 512 megabytes | ['binary search', 'bitmasks', 'dp', '*2000'] |
C. Two Arraystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers n and m. Calculate the number of pairs of arrays (a, b) such that: the length of both arrays is equal to m; each element of each array is an integer between 1 and n (inclusive);... | 2 2
| 5 | 1 second | 256 megabytes | ['combinatorics', 'dp', '*1600'] |
B. Yet Another Meme Problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers A and B, calculate the number of pairs (a, b) such that 1 \le a \le A, 1 \le b \le B, and the equation a \cdot b + a + b = conc(a, b) is true; conc(a, b) is the conc... | 31 114 2191 31415926 | 1 0 1337 | 1 second | 256 megabytes | ['math', '*1100'] |
A. Deadlinetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAdilbek was assigned to a special project. For Adilbek it means that he has n days to run a special program and provide its results. But there is a problem: the program needs to run for d days to calculate t... | 3
1 1
4 5
5 11
| YES YES NO | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'math', 'ternary search', '*1100'] |
B. Hypersettime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBees Alice and Alesya gave beekeeper Polina famous card game "Set" as a Christmas present. The deck consists of cards that vary in four features across three options for each kind of feature: number of shape... | 3 3
SET
ETS
TSE
| 1 | 3 seconds | 256 megabytes | ['brute force', 'data structures', 'implementation', '*1500'] |
A. Angry Studentstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's a walking tour day in SIS.Winter, so t groups of students are visiting Torzhok. Streets of Torzhok are so narrow that students have to go in a row one after another.Initially, some students are ang... | 1
4
PPAP
| 1 | 1 second | 256 megabytes | ['greedy', 'implementation', '*800'] |
F. Harry The Pottertime limit per test9 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputTo defeat Lord Voldemort, Harry needs to destroy all horcruxes first. The last horcrux is an array a of n integers, which also needs to be destroyed. The array is considered destroyed if all its ele... | 3
1 10 100
| 3 | 9 seconds | 1024 megabytes | ['brute force', 'constructive algorithms', 'dp', 'fft', 'implementation', 'math', '*3100'] |
E. Fedya the Potter Strikes Backtime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFedya has a string S, initially empty, and an array W, also initially empty.There are n queries to process, one at a time. Query i consists of a lowercase English letter c_i and a nonneg... | 7
a 1
a 0
y 3
y 5
v 4
u 6
r 8
| 1 2 4 5 7 9 12 | 4 seconds | 256 megabytes | ['data structures', 'strings', '*3200'] |
D. LCCtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn infinitely long Line Chillland Collider (LCC) was built in Chillland. There are n pipes with coordinates x_i that are connected to LCC. When the experiment starts at time 0, i-th proton flies from the i-th pip... | 2
1 1 100
3 1 0
| 1 | 2 seconds | 256 megabytes | ['data structures', 'math', 'matrices', 'probabilities', '*3100'] |
C2. Madhouse (Hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem is different with easy version only by constraints on total answers lengthIt is an interactive problemVenya joined a tour to the madhouse, in which orderlies play with patients th... | 4
a
aa
a
cb
b
c
c | ? 1 2 ? 3 4 ? 4 4 ! aabc | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'hashing', 'interactive', 'math', '*2800'] |
C1. Madhouse (Easy version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem is different with hard version only by constraints on total answers lengthIt is an interactive problemVenya joined a tour to the madhouse, in which orderlies play with patients th... | 4
a
aa
a
cb
b
c
c | ? 1 2 ? 3 4 ? 4 4 ! aabc | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'interactive', 'math', '*2400'] |
B. Numbers on Treetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputEvlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer a_i written on it. For each vertex i, Evlampiy calculated c_i — the number... | 3
2 0
0 2
2 0
| YES 1 2 1 | 1 second | 256 megabytes | ['constructive algorithms', 'data structures', 'dfs and similar', 'graphs', 'greedy', 'trees', '*1800'] |
A. Garlandtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputVadim loves decorating the Christmas tree, so he got a beautiful garland as a present. It consists of n light bulbs in a single row. Each bulb has a number from 1 to n (in arbitrary order), such that all the n... | 5
0 5 0 2 3
| 2 | 1 second | 256 megabytes | ['dp', 'greedy', 'sortings', '*1800'] |
F. Classical?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven an array a, consisting of n integers, find:\max\limits_{1 \le i < j \le n} LCM(a_i,a_j),where LCM(x, y) is the smallest positive integer that is divisible by both x and y. For example, LCM(6, 8) = 24,... | 3
13 35 77
| 1001 | 1 second | 256 megabytes | ['binary search', 'combinatorics', 'number theory', '*2900'] |
E. Delete a Segmenttime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n segments on a Ox axis [l_1, r_1], [l_2, r_2], ..., [l_n, r_n]. Segment [l, r] covers all points from l to r inclusive, so all x such that l \le x \le r.Segments can be placed arbitrarily ... | 3
4
1 4
2 3
3 6
5 7
3
5 5
5 5
5 5
6
3 3
1 1
5 5
1 5
2 2
4 4
| 2 1 5 | 4 seconds | 256 megabytes | ['brute force', 'constructive algorithms', 'data structures', 'dp', 'graphs', 'sortings', 'trees', 'two pointers', '*2300'] |
D. Dr. Evil Underscorestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, as a friendship gift, Bakry gave Badawy n integers a_1, a_2, \dots, a_n and challenged him to choose an integer X such that the value \underset{1 \leq i \leq n}{\max} (a_i \oplus X) is mini... | 3
1 2 3
| 2 | 1 second | 256 megabytes | ['bitmasks', 'brute force', 'dfs and similar', 'divide and conquer', 'dp', 'greedy', 'strings', 'trees', '*1900'] |
C. Fadi and LCMtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, Osama gave Fadi an integer X, and Fadi was wondering about the minimum possible value of max(a, b) such that LCM(a, b) equals X. Both a and b should be positive integers.LCM(a, b) is the smallest p... | 2
| 1 2 | 1 second | 256 megabytes | ['brute force', 'math', 'number theory', '*1400'] |
B. Just Eat It!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, Yasser and Adel are at the shop buying cupcakes. There are n cupcake types, arranged from 1 to n on the shelf, and there are infinitely many of each type. The tastiness of a cupcake of type i is an... | 3
4
1 2 3 4
3
7 4 -1
3
5 -5 5
| YES NO NO | 1 second | 256 megabytes | ['dp', 'greedy', 'implementation', '*1300'] |
A. Mezo Playing Zomatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, Mezo is playing a game. Zoma, a character in that game, is initially at position x = 0. Mezo starts sending n commands to Zoma. There are two possible commands: 'L' (Left) sets the position x... | 4
LRLR
| 5 | 1 second | 256 megabytes | ['math', '*800'] |
G. Seollaltime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputIt is only a few days until Seollal (Korean Lunar New Year), and Jaehyun has invited his family to his garden. There are kids among the guests. To make the gathering more fun for the kids, Jaehyun is going t... | 4
2 2
OO
OO
3 3
OOO
XOO
OOO
4 4
OOOX
XOOX
OOXO
OOOO
5 6
OOOOOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO
| YES OOO O OOO NO YES OOOOO X O O X O O X O OOO X O O O O O OOOOO YES OOOOOOOOOOO O O O OOO OOO OOO O O O OOO OOO OOO O O O OOO OOO OOO O O O OOO OOO OOO | 3 seconds | 1024 megabytes | ['graphs', '*3300'] |
F. New Year and Social Networktime limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputDonghyun's new social network service (SNS) contains n users numbered 1, 2, \ldots, n. Internally, their network is a tree graph, so there are n-1 direct connections between each user. Ea... | 4
1 2
2 3
4 3
1 3
2 4
1 4
| 3 3 2 4 2 2 1 1 3 4 3 1 4 | 4 seconds | 1024 megabytes | ['data structures', 'graph matchings', 'graphs', 'math', 'trees', '*3200'] |
E. New Year and Castle Constructiontime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputKiwon's favorite video game is now holding a new year event to motivate the users! The game is about building and defending a castle, which led Kiwon to think about the following puz... | 5
-1 0
1 0
-10 -1
10 -1
0 3
| 2 | 3 seconds | 1024 megabytes | ['combinatorics', 'geometry', 'math', 'sortings', '*2500'] |
D. New Year and Conferencetime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputFilled with optimism, Hyunuk will host a conference about how great this new year will be!The conference will have n lectures. Hyunuk has two candidate venues a and b. For each of the n lectu... | 2
1 2 3 6
3 4 7 8
| YES | 2 seconds | 1024 megabytes | ['binary search', 'data structures', 'hashing', 'sortings', '*2100'] |
C. New Year and Permutationtime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard outputRecall that the permutation is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appear... | 1 993244853
| 1 | 1 second | 1024 megabytes | ['combinatorics', 'math', '*1600'] |
B. New Year and Ascent Sequencetime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputA sequence a = [a_1, a_2, \ldots, a_l] of length l has an ascent if there exists a pair of indices (i, j) such that 1 \le i < j \le l and a_i < a_j. For example, the sequence [0, 2, 0, 2... | 5
1 1
1 1
1 2
1 4
1 3
| 9 | 2 seconds | 1024 megabytes | ['binary search', 'combinatorics', 'data structures', 'dp', 'implementation', 'sortings', '*1400'] |
A. New Year and Namingtime limit per test1 secondmemory limit per test1024 megabytesinputstandard inputoutputstandard outputHappy new year! The year 2020 is also known as Year Gyeongja (경자년, gyeongja-nyeon) in Korea. Where did the name come from? Let's briefly look at the Gapja system, which is traditionally used in Ko... | 10 12
sin im gye gap eul byeong jeong mu gi gyeong
yu sul hae ja chuk in myo jin sa o mi sin
14
1
2
3
4
10
11
12
13
73
2016
2017
2018
2019
2020
| sinyu imsul gyehae gapja gyeongo sinmi imsin gyeyu gyeyu byeongsin jeongyu musul gihae gyeongja | 1 second | 1024 megabytes | ['implementation', 'strings', '*800'] |
F. DIY Garlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has decided to decorate his room because the New Year is soon. One of the main decorations that Polycarp will install is the garland he is going to solder himself.Simple garlands consisting of se... | 6
3 6 3 1 5
| 3 6 3 6 5 1 3 1 4 5 2 | 2 seconds | 256 megabytes | ['constructive algorithms', 'greedy', 'trees', '*2200'] |
E. New Year Partiestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOh, New Year. The time to gather all your friends and reflect on the heartwarming events of the past year...n friends live in a city which can be represented as a number line. The i-th friend lives i... | 4
1 2 4 4
| 2 4 | 2 seconds | 256 megabytes | ['dp', 'greedy', '*1800'] |
D. Christmas Treestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n Christmas trees on an infinite number line. The i-th tree grows at the position x_i. All x_i are guaranteed to be distinct.Each integer point can be either occupied by the Christmas tree, ... | 2 6
1 5
| 8 -1 2 6 4 0 3 | 2 seconds | 256 megabytes | ['graphs', 'greedy', 'shortest paths', '*1800'] |
C. Friends and Giftstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n friends who want to give gifts for the New Year to each other. Each friend should give exactly one gift and receive exactly one gift. The friend cannot give the gift to himself.For each ... | 5
5 0 0 2 4
| 5 3 1 2 4 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'math', '*1500'] |
B. Candies Divisiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSanta has n candies and he wants to gift them to k kids. He wants to divide as many candies as possible between all k kids. Santa can't divide one candy into parts but he is allowed to not use some c... | 5
5 2
19 4
12 7
6 2
100000 50010
| 5 18 10 6 75015 | 2 seconds | 256 megabytes | ['math', '*900'] |
A. Minutes Before the New Yeartime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNew Year is coming and you are excited to know how many minutes remain before the New Year. You know that currently the clock shows h hours and m minutes, where 0 \le hh < 24 and 0 \le mm <... | 5
23 55
23 0
0 1
4 20
23 59
| 5 60 1439 1180 1 | 1 second | 256 megabytes | ['math', '*800'] |
E. The Cake Is a Lietime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe are committed to the well being of all participants. Therefore, instead of the problem, we suggest you enjoy a piece of cake.Uh oh. Somebody cut the cake. We told them to wait for you, but they d... | 3
6
3 6 5
5 2 4
5 4 6
6 3 1
6
2 5 6
2 5 1
4 1 2
1 3 5
3
1 2 3
| 1 6 4 2 5 3 4 2 3 1 1 4 2 6 5 3 3 4 2 1 1 3 2 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'dfs and similar', 'graphs', '*2400'] |
D. Enchanted Artifacttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.After completing the last level of the enchanted temple, you received a powerful artifact of the 255th level. Do not rush to celebrate, because this artifact has a pow... |
2
2
1
2
3
0 | aaa aaab abba bba abaaa aabba | 1 second | 256 megabytes | ['constructive algorithms', 'interactive', 'strings', '*2300'] |
C. Petya and Examtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya has come to the math exam and wants to solve as many problems as possible. He prepared and carefully studied the rules by which the exam passes.The exam consists of n problems that can be solved ... | 10
3 5 1 3
0 0 1
2 1 4
2 5 2 3
1 0
3 2
1 20 2 4
0
16
6 20 2 5
1 1 0 1 0 0
0 8 2 9 11 6
4 16 3 6
1 0 1 1
8 3 5 6
6 20 3 6
0 1 0 0 1 0
20 11 3 20 16 17
7 17 1 6
1 1 0 1 0 0 0
1 7 0 11 10 15 10
6 17 2 6
0 0 1 0 0 1
7 6 3 7 10 12
5 17 2 5
1 1 1 1 0
17 11 10 6 4
1 1 1 2
0
1
| 3 2 1 0 1 4 0 1 2 1 | 2 seconds | 256 megabytes | ['greedy', 'sortings', 'two pointers', '*1800'] |
B2. K for the Price of One (Hard Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of this problem. The only difference is the constraint on k — the number of gifts in the offer. In this version: 2 \le k \le n.Vasya came to the store t... | 8
5 6 2
2 4 3 5 7
5 11 2
2 4 3 5 7
3 2 3
4 2 6
5 2 3
10 1 3 9 2
2 10000 2
10000 10000
2 9999 2
10000 10000
4 6 4
3 2 3 2
5 5 3
1 2 2 1 2
| 3 4 1 1 2 0 4 5 | 2 seconds | 256 megabytes | ['dp', 'greedy', 'sortings', '*1600'] |
B1. K for the Price of One (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of this problem. The only difference is the constraint on k — the number of gifts in the offer. In this version: k=2.Vasya came to the store to buy good... | 6
5 6 2
2 4 3 5 7
5 11 2
2 4 3 5 7
2 10000 2
10000 10000
2 9999 2
10000 10000
5 13 2
8 2 8 2 5
3 18 2
1 2 3
| 3 4 2 0 4 3 | 2 seconds | 256 megabytes | ['dp', 'greedy', 'sortings', '*1400'] |
A. Temporarily unavailabletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp lives on the coordinate axis Ox and travels from the point x=a to x=b. It moves uniformly rectilinearly at a speed of one unit of distance per minute.On the axis Ox at the point x=c th... | 9
1 10 7 1
3 3 3 0
8 2 10 4
8 2 10 100
-10 20 -17 2
-3 2 2 0
-3 1 2 0
2 3 2 3
-1 3 -2 2
| 7 0 4 0 30 5 4 0 3 | 1 second | 256 megabytes | ['implementation', 'math', '*900'] |
B. Azamon Web Servicestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend Jeff Zebos has been trying to run his new online company, but it's not going very well. He's not getting a lot of sales on his website which he decided to call Azamon. His big problem,... | 3
AZAMON APPLE
AZAMON AAAAAAAAAAALIBABA
APPLE BANANA
| AMAZON --- APPLE | 2 seconds | 256 megabytes | ['greedy', '*1600'] |
A. Suffix Threetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe just discovered a new data structure in our research group: a suffix three!It's very useful for natural language processing. Given three languages and three suffixes, a suffix three can determine which... | 8
kamusta_po
genki_desu
ohayou_gozaimasu
annyeong_hashimnida
hajime_no_ippo
bensamu_no_sentou_houhou_ga_okama_kenpo
ang_halaman_doon_ay_sarisari_singkamasu
si_roy_mustang_ay_namamasu
| FILIPINO JAPANESE JAPANESE KOREAN FILIPINO FILIPINO JAPANESE JAPANESE | 1 second | 256 megabytes | ['implementation', '*800'] |
F. Intergalactic Sliding Puzzletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are an intergalactic surgeon and you have an alien patient. For the purposes of this problem, we can and we will model this patient's body using a 2 \times (2k + 1) rectangular grid. T... | 2
3
1 2 3 5 6 E 7
8 9 10 4 11 12 13
11
34 45 6 22 16 43 38 44 5 4 41 14 7 29 28 19 9 18 42 8 17 33 1
E 15 40 36 31 24 10 2 21 11 32 23 30 27 35 25 13 12 39 37 26 20 3
| SURGERY COMPLETE IR R SrS S rr I lldll DONE SURGERY FAILED | 1 second | 256 megabytes | ['combinatorics', 'constructive algorithms', 'math', '*3400'] |
E. Kirchhoff's Current Losstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour friend Kirchhoff is shocked with the current state of electronics design."Ohmygosh! Watt is wrong with the field? All these circuits are inefficient! There's so much capacity for improve... | 3
5 *
1 (* S *)
1 (* P (* S *))
| REVOLTING 5 REVOLTING 1 0 REVOLTING 2 1 1 | 2 seconds | 256 megabytes | ['math', '*2900'] |
D. Miss Punyversetime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe Oak has n nesting places, numbered with integers from 1 to n. Nesting place i is home to b_i bees and w_i wasps.Some nesting places are connected by branches. We call two nesting places adjacent if... | 2
4 3
10 160 70 50
70 111 111 0
1 2
2 3
3 4
2 1
143 420
214 349
2 1
| 2 0 | 4 seconds | 512 megabytes | ['dp', 'greedy', 'trees', '*2500'] |
C. Jeremy Bearimytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWelcome! Everything is fine.You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for et... | 2
3
1 2 3
3 2 4
2 4 3
4 5 6
5 6 5
2
1 2 1
1 3 2
1 4 3
| 15 33 6 6 | 3 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'greedy', 'trees', '*2000'] |
B. Beingawesomeismtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are an all-powerful being and you have created a rectangular world. In fact, your world is so bland that it could be represented by a r \times c grid. Each cell on the grid represents a country. E... | 4
7 8
AAPAAAAA
PPPPAAAA
PPPPAAAA
APAAPPPP
APAPPAPP
AAAAPPAP
AAAAPPAA
6 5
AAAAA
AAAAA
AAPAA
AAPAP
AAAPP
AAAPP
4 4
PPPP
PPPP
PPPP
PPPP
3 4
PPPP
PAAP
PPPP
| 2 1 MORTAL 4 | 2 seconds | 256 megabytes | ['implementation', 'math', '*1800'] |
A. Cut and Pastetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe start with a string s consisting only of the digits 1, 2, or 3. The length of s is denoted by |s|. For each i from 1 to |s|, the i-th character of s is denoted by s_i. There is one cursor. The cursor... | 4
5
231
7
2323
6
333
24
133321333
| 25 1438 1101 686531475 | 2 seconds | 256 megabytes | ['implementation', 'math', '*1700'] |
F. New Year and Handle Changetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNew Year is getting near. So it's time to change handles on codeforces. Mishka wants to change his handle but in such a way that people would not forget who he is.To make it work, he only a... | 7 1 4
PikMike
| 0 | 3 seconds | 256 megabytes | ['binary search', 'dp', '*2800'] |
E. New Year Permutationstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYeah, we failed to make up a New Year legend for this problem.A permutation of length n is an array of n integers such that every integer from 1 to n appears in it exactly once. An element y of p... | 5
3 3
5 15
4 13
6 8
4 2
| 2 1 3 3 1 2 5 4 -1 1 2 6 3 4 5 1 2 4 3 | 1 second | 256 megabytes | ['combinatorics', 'dp', '*2700'] |
D. Santa's Bottime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSanta Claus has received letters from n different kids throughout this year. Of course, each kid wants to get some presents from Santa: in particular, the i-th kid asked Santa to give them one of k_i diff... | 2
2 2 1
1 1
| 124780545 | 5 seconds | 256 megabytes | ['combinatorics', 'math', 'probabilities', '*1700'] |
C. Stack of Presentstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSanta has to send presents to the kids. He has a large stack of n presents, numbered from 1 to n; the topmost present has number a_1, the next present is a_2, and so on; the bottom present has number... | 2
3 3
3 1 2
3 2 1
7 2
2 1 7 3 4 5 6
3 1
| 5 8 | 1 second | 256 megabytes | ['data structures', 'implementation', '*1400'] |
B. Verse For Santatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNew Year is coming! Vasya has prepared a New Year's verse and wants to recite it in front of Santa Claus.Vasya's verse contains n parts. It takes a_i seconds to recite the i-th part. Vasya can't change... | 3
7 11
2 9 1 3 18 1 4
4 35
11 9 10 7
1 8
5
| 2 1 0 | 1 second | 256 megabytes | ['binary search', 'brute force', 'implementation', '*1300'] |
A. New Year Garlandtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp is sad — New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.The local store introduced ... | 3
3 3 3
1 10 2
2 1 1
| Yes No Yes | 1 second | 256 megabytes | ['math', '*900'] |
F. Cardstime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputConsider the following experiment. You have a deck of m cards, and exactly one card is a joker. n times, you do the following: shuffle the deck, take the top card of the deck, look at it and return it into the ... | 1 1 1
| 1 | 4 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', 'number theory', 'probabilities', '*2600'] |
E. Tests for problem Dtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe had a really tough time generating tests for problem D. In order to prepare strong tests, we had to solve the following problem.Given an undirected labeled tree consisting of n vertices, find a... | 6
1 2
1 3
3 4
3 5
2 6
| 9 12 7 10 3 11 1 5 2 4 6 8 | 2 seconds | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'divide and conquer', 'trees', '*2200'] |
D. Segment Treetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs the name of the task implies, you are asked to do some work with segments and trees.Recall that a tree is a connected undirected graph such that there is exactly one simple path between every pair of ... | 6
9 12
2 11
1 3
6 10
5 7
4 8
| YES | 2 seconds | 256 megabytes | ['data structures', 'dsu', 'graphs', 'trees', '*2100'] |
C. Berry Jamtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKarlsson has recently discovered a huge stock of berry jam jars in the basement of the house. More specifically, there were 2n jars of strawberry and blueberry jam.All the 2n jars are arranged in a row. The... | 4
6
1 1 1 2 2 1 2 1 2 1 1 2
2
1 2 1 2
3
1 1 1 1 1 1
2
2 1 1 1
| 6 0 6 2 | 2 seconds | 256 megabytes | ['data structures', 'dp', 'greedy', 'implementation', '*1700'] |
B. A and Btime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers a and b. You can perform a sequence of operations: during the first operation you choose one of these numbers and increase it by 1; during the second operation you choose one of thes... | 3
1 3
11 11
30 20
| 3 0 4 | 1 second | 256 megabytes | ['greedy', 'math', '*1500'] |
A. Shuffle Hashingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has built his own web service. Being a modern web service it includes login feature. And that always implies password security problems.Polycarp decided to store the hash of the password, gen... | 5
abacaba
zyxaabcaabkjh
onetwothree
threetwoone
one
zzonneyy
one
none
twenty
ten
| YES YES NO YES NO | 2 seconds | 256 megabytes | ['brute force', 'implementation', 'strings', '*1000'] |
D. Let's Play the Words?time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has n different binary words. A word called binary if it contains only characters '0' and '1'. For example, these words are binary: "0001", "11", "0" and "0011100".Polycarp wants to off... | 4
4
0001
1000
0011
0111
3
010
101
0
2
00000
00001
4
01
001
0001
00001
| 1 3 -1 0 2 1 2 | 3 seconds | 256 megabytes | ['data structures', 'hashing', 'implementation', 'math', '*1900'] |
B. Make Them Oddtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n positive integers a_1, a_2, \dots, a_n. For the one move you can choose any even value c and divide by two all elements that equal c.For example, if a=[6,8,12,6,3,12] and you choose c=6, and... | 4
6
40 6 40 3 20 1
1
1024
4
2 4 8 16
3
3 1 7
| 4 10 4 0 | 3 seconds | 256 megabytes | ['greedy', 'number theory', '*1200'] |
A. Happy Birthday, Polycarp!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputHooray! Polycarp turned n years old! The Technocup Team sincerely congratulates Polycarp!Polycarp celebrated all of his n birthdays: from the 1-th to the n-th. At the moment, he is wondering:... | 6
18
1
9
100500
33
1000000000
| 10 1 9 45 12 81 | 1 second | 256 megabytes | ['implementation', '*1000'] |
F. Asterisk Substringstime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputConsider a string s of n lowercase English letters. Let t_i be the string obtained by replacing the i-th character of s with an asterisk character *. For example, when s = \mathtt{abc}, we have t_... | abc
| 15 | 5 seconds | 512 megabytes | ['string suffix structures', '*3400'] |
E. Four Stonestime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are four stones on an infinite line in integer coordinates a_1, a_2, a_3, a_4. The goal is to have the stones in coordinates b_1, b_2, b_3, b_4. The order of the stones does not matter, that is, a st... | 0 1 2 3
3 5 6 8
| 3 1 3 2 5 0 3 | 1 second | 512 megabytes | ['constructive algorithms', '*3500'] |
D. Tree Eliminationtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVasya has a tree with n vertices numbered from 1 to n, and n - 1 edges numbered from 1 to n - 1. Initially each vertex contains a token with the number of the vertex written on it.Vasya plays a game.... | 5
1 2
1 3
1 4
1 5
| 5 | 2 seconds | 512 megabytes | ['dp', 'trees', '*2900'] |
C. Beautiful Rectangletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n integers. You need to choose a subset and put the chosen numbers in a beautiful rectangle (rectangular matrix). Each chosen number should occupy one of its rectangle cells, each cel... | 12
3 1 4 1 5 9 2 6 5 3 5 8
| 12 3 4 1 2 3 5 3 1 5 4 5 6 8 9 | 1 second | 256 megabytes | ['brute force', 'combinatorics', 'constructive algorithms', 'data structures', 'greedy', 'math', '*2300'] |
B. Two Fairstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n cities in Berland and some pairs of them are connected by two-way roads. It is guaranteed that you can pass from any city to any other, moving along the roads. Cities are numerated from 1 to n.T... | 3
7 7 3 5
1 2
2 3
3 4
4 5
5 6
6 7
7 5
4 5 2 3
1 2
2 3
3 4
4 1
4 2
4 3 2 1
1 2
2 3
4 1
| 4 0 1 | 3 seconds | 256 megabytes | ['combinatorics', 'dfs and similar', 'dsu', 'graphs', '*1900'] |
A. As Simple as One and Twotime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a non-empty string s=s_1s_2\dots s_n, which consists only of lowercase Latin letters. Polycarp does not like a string if it contains at least one string "one" or at least one st... | 4
onetwone
testme
oneoneone
twotwo
| 2 6 3 0 3 4 1 7 2 1 4 | 3 seconds | 256 megabytes | ['dp', 'greedy', '*1400'] |
F. Шардирование постовограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводЭто интерактивная задача.Когда данных становится слишком много и они не помещаются на один сервер, их приходится шардировать. Рассмотрим систему хранения постов пользователей, ... | Входные данные
1 2
3 2
3
3
5
10 | Выходные данные ? 1 2 ? 2 1 ? 1 3 ! 5 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem', 'binary search', 'interactive'] |
E3. Контрольная суммаограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводДанные пользователей ВКонтакте хранятся на десятках тысяч серверов. Для того, чтобы можно было определять ошибки при записи данных на диск, на диск регулярно записываются текущи... | Входные данные
8 1
1 2 3 4 5 6 7 8
0 4 0 0 0 0
| Выходные данные 212 34 127 159 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
E2. Контрольная суммаограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводДанные пользователей ВКонтакте хранятся на десятках тысяч серверов. Для того, чтобы можно было определять ошибки при записи данных на диск, на диск регулярно записываются текущи... | Входные данные
8 1
1 2 3 4 5 6 7 8
0 4 0 0 0 0
| Выходные данные 212 34 127 159 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
E1. Контрольная суммаограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводДанные пользователей ВКонтакте хранятся на десятках тысяч серверов. Для того, чтобы можно было определять ошибки при записи данных на диск, на диск регулярно записываются текущи... | Входные данные
8 1
1 2 3 4 5 6 7 8
0 4 0 0 0 0
| Выходные данные 212 34 127 159 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
D. Storage2ограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводДля надежного, но компактного хранения картинок во ВКонтакте используются избыточные коды. Все картинки разбиваются на группы по 15, и для каждой группы картинок вычисляются 13 избыточных... | Входные данные
28
| Выходные данные 1.00000000000000000000 15.00000000000000000000 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
C. #define Задача B ...ограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводКомпания «ВКонтакте» активно использует языки C/C++ для разработки движков. Старший разработчик Вася — большой любитель языка C, ведь только в нем можно полностью раскрыть пот... | Входные данные
5
0
1
3
5
8
| Выходные данные 0 1 4 2 3 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
B. Code Reviewограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводУ команды разработки движков ВКонтакте есть общий чат. После каждого сложного коммита в репозиторий, автор этого коммита присылает в чат сообщение с предложением провести ревью. Для од... | Входные данные
7
1 0e813c50
1 00e9422b
1 520cb7b4
2 052dd9ad
3 9dd5f347
3 e35f067b
1 bb4d4a99
| Выходные данные 0e813c50 00e9422b 9dd5f347 bb4d4a99 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
A. Скрытый другограничение по времени на тест2 секундыограничение по памяти на тест512 мегабайтвводстандартный вводвыводстандартный выводВам дан граф друзей VK. Недавно у пользователей появилась возможность скрывать друзей из социального графа. Для заданного графа друзей найдите скрытые дружеские связи, то есть такие с... | Входные данные
5
3 2 3 4
4 1 3 4 5
0
2 1 2
3 4 3 1
| Выходные данные 6 3 5 4 5 5 2 3 1 1 5 3 2 | ограничение по времени на тест2 секунды | ограничение по памяти на тест512 мегабайт | ['*special problem'] |
F. Two Bracket Sequencestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given two bracket sequences (not necessarily regular) s and t consisting only of characters '(' and ')'. You want to construct the shortest regular bracket sequence that contains both gi... | (())(()
()))()
| (())()() | 2 seconds | 512 megabytes | ['dp', 'strings', 'two pointers', '*2200'] |
E. Nearest Opposite Paritytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers. In one move, you can jump from the position i to the position i - a_i (if 1 \le i - a_i) or to the position i + a_i (if i + a_i \le n).For ea... | 10
4 5 7 6 7 5 4 4 6 4
| 1 1 1 2 -1 1 1 3 1 1 | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'shortest paths', '*1900'] |
D. Remove One Elementtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers.You can remove at most one element from this array. Thus, the final length of the array is n-1 or n.Your task is to calculate the maximum possible ... | 5
1 2 5 3 4
| 4 | 2 seconds | 256 megabytes | ['brute force', 'dp', '*1500'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.