Dataset Viewer
Auto-converted to Parquet Duplicate
problem_statement
stringlengths
147
8.53k
input
stringlengths
1
771
output
stringlengths
1
592
time_limit
stringclasses
32 values
memory_limit
stringclasses
21 values
tags
stringlengths
6
168
F. Nene and the Passing Gametime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNene is training her team as a basketball coach. Nene's team consists of n players, numbered from 1 to n. The i-th player has an arm interval [l_i,r_i]. Two players i and j (i \neq j) can pa...
521 11 121 12 231 31 31 351 12 21 52 21 161 25 52 32 32 21 2
2 2 2 1 3
4 seconds
256 megabytes
['constructive algorithms', 'data structures', 'dsu', 'graphs', 'sortings', '*3000']
E2. Nene vs. Monsters (Hard Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference between the versions is the constraints on a_i. You can make hacks only if both versions of the problem are solved.Nene i...
532 5 320 041 5 7 244 2 1 2131 1 4 5 1 4 1 9 1 9 8 1 0
1 1 0 1 1 2 1 3 6 1 3 6 8 10 12
2 seconds
256 megabytes
['brute force', 'greedy', 'implementation', 'math', '*2700']
E1. Nene vs. Monsters (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference between the versions is the constraints on a_i. You can make hacks only if both versions of the problem are solved.Nene i...
532 5 320 041 5 7 244 2 1 2131 1 4 5 1 4 1 9 1 9 8 1 0
1 1 0 1 1 2 1 3 6 1 3 6 8 10 12
2 seconds
256 megabytes
['brute force', 'implementation', 'math', '*2500']
D. Nene and the Mex Operatortime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNene gave you an array of integers a_1, a_2, \ldots, a_n of length n.You can perform the following operation no more than 5\cdot 10^5 times (possibly zero): Choose two integers l and r such...
20 1
4 1 1 2
2 seconds
256 megabytes
['bitmasks', 'brute force', 'constructive algorithms', 'divide and conquer', 'dp', 'greedy', 'implementation', 'math', '*2000']
C. Nene's Magical Matrixtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe magical girl Nene has an n\times n matrix a filled with zeroes. The j-th element of the i-th row of matrix a is denoted as a_{i, j}.She can perform operations of the following two types with...
212
1 1 1 1 1 7 3 1 1 1 2 1 2 1 2 2 1 1 2
2 seconds
256 megabytes
['constructive algorithms', 'greedy', 'math', '*1600']
B. Nene and the Card Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou and Nene are playing a card game. The deck with 2n cards is used to play this game. Each card has an integer from 1 to n on it, and each of integers 1 through n appears exactly on 2 cards. A...
541 1 2 387 4 1 2 8 8 5 587 1 4 5 3 4 2 631 2 311
1 2 1 0 0
1 second
256 megabytes
['games', 'greedy', '*800']
A. Nene's Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNene invented a new game based on an increasing sequence of integers a_1, a_2, \ldots, a_k.In this game, initially n players are lined up in a row. In each of the rounds of this game, the following happens...
62 13 555 32 4 6 7 91 3 55 43 4 5 6 71 2 3 42 369 961 10 1001 1100503 310 20 301 10 100
2 1 1 1 1 2 2 2 1 10 68 50 1 9 9
1 second
256 megabytes
['binary search', 'brute force', 'data structures', 'games', 'greedy', '*800']
H. The Most Reckless Defensetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are playing a very popular Tower Defense game called "Runnerfield 2". In this game, the player sets up defensive towers that attack enemies moving from a certain starting point to the pl...
62 2 1#.##1 2 12 2 1#.##1 2 22 2 1#.##1 2 5003 3 2#..##..##1 2 43 1 33 5 2#.####.#.####.#2 2 22 4 25 5 4#....#....#....#....#####3 2 1424 5 92 5 791 3 50
0 1 1491 11 8 1797
3 seconds
256 megabytes
['bitmasks', 'brute force', 'constructive algorithms', 'dp', 'flows', 'graph matchings', 'shortest paths', '*2300']
G. GCD on a gridtime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNot long ago, Egor learned about the Euclidean algorithm for finding the greatest common divisor of two numbers. The greatest common divisor of two numbers a and b is the largest number that divides bot...
32 330 20 3015 25 403 312 4 93 12 28 3 122 42 4 6 81 3 6 9
10 3 1
3 seconds
256 megabytes
['brute force', 'dfs and similar', 'dp', 'implementation', 'math', 'number theory', '*1900']
F. Unfair Gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlice and Bob gathered in the evening to play an exciting game on a sequence of n integers, each integer of the sequence doesn't exceed 4. The rules of the game are too complex to describe, so let's just ...
51 1 1 01 0 1 22 2 2 03 3 2 00 9 9 9
1 1 3 3 12
2 seconds
256 megabytes
['dp', 'games', 'greedy', 'math', 'schedules', '*1800']
E. Long Inversionstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA binary string s of length n is given. A binary string is a string consisting only of the characters '1' and '0'.You can choose an integer k (1 \le k \le n) and then apply the following operation any...
5500100501000710111013000210
3 2 4 3 1
3 seconds
256 megabytes
['brute force', 'greedy', 'implementation', 'sortings', '*1700']
D. Inaccurate Subsequence Searchtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMaxim has an array a of n integers and an array b of m integers (m \le n).Maxim considers an array c of length m to be good if the elements of array c can be rearranged in such a way tha...
57 4 24 1 2 3 4 5 61 2 3 47 4 34 1 2 3 4 5 61 2 3 47 4 44 1 2 3 4 5 61 2 3 411 5 39 9 2 2 10 9 7 6 3 6 36 9 7 8 104 1 14 1 5 66
4 3 2 4 1
2 seconds
256 megabytes
['data structures', 'two pointers', '*1400']
C. Inhabitant of the Deep Seatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputn ships set out to explore the depths of the ocean. The ships are numbered from 1 to n and follow each other in ascending order; the i-th ship has a durability of a_i.The Kraken attacked th...
64 51 2 4 34 61 2 4 35 202 7 1 8 22 23 22 151 52 75 2
2 3 5 0 2 2
2 seconds
256 megabytes
['greedy', 'implementation', 'math', '*1300']
B. Progressive Squaretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA progressive square of size n is an n \times n matrix. Maxim chooses three integers a_{1,1}, c, and d and constructs a progressive square according to the following rules:a_{i+1,j} = a_{i,j} + ca_...
53 2 33 9 6 5 7 1 10 4 83 2 33 9 6 5 7 1 11 4 82 100 100400 300 400 5003 2 33 9 6 6 5 1 11 4 84 4 415 27 7 19 23 23 11 15 7 3 19 23 11 15 11 15
NO YES YES NO NO
2 seconds
256 megabytes
['constructive algorithms', 'data structures', 'implementation', 'sortings', '*1000']
A. Yogurt Saletime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe price of one yogurt at the "Vosmiorochka" store is a burles, but there is a promotion where you can buy two yogurts for b burles.Maxim needs to buy exactly n yogurts. When buying two yogurts, he can ch...
42 5 93 5 93 5 114 5 11
9 14 15 20
1 second
256 megabytes
['math', '*800']
F. Unique Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's say that two strings a and b are equal if you can get the string b by cyclically shifting string a. For example, the strings 0100110 and 1100100 are equal, while 1010 and 1100 are not.You are giv...
1 1 0
1
2 seconds
256 megabytes
['combinatorics', 'dp', 'math', '*3100']
E. Chain Reactiontime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere are n monsters standing in a row. The i-th monster has a_i health points.Every second, you can choose one alive monster and launch a chain lightning at it. The lightning deals k damage to it, and...
35 2 7
10 6 4 3 2 2 1
3 seconds
512 megabytes
['binary search', 'data structures', 'dsu', 'greedy', 'implementation', 'math', 'number theory', '*2200']
D. Colored Ballstime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThere are balls of n different colors; the number of balls of the i-th color is a_i.The balls can be combined into groups. Each group should contain at most 2 balls, and no more than 1 ball of each col...
31 1 2
11
2 seconds
1024 megabytes
['combinatorics', 'dp', 'math', 'sortings', '*1800']
C. Long Multiplicationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers x and y of the same length, consisting of digits from 1 to 9.You can perform the following operation any number of times (possibly zero): swap the i-th digit in x and th...
373312535163982
71 33 5 2 3912 3586
2 seconds
256 megabytes
['greedy', 'math', 'number theory', '*1200']
B. Make It Uglytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call an array a beautiful if you can make all its elements the same by using the following operation an arbitrary number of times (possibly, zero): choose an index i (2 \le i \le |a| - 1) such th...
432 2 251 2 1 2 11173 3 3 5 3 3 3
-1 1 -1 3
2 seconds
256 megabytes
['implementation', 'math', '*1200']
A. Painting the Ribbontime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice and Bob have bought a ribbon consisting of n parts. Now they want to paint it.First, Alice will paint every part of the ribbon into one of m colors. For each part, she can choose its color a...
51 1 15 1 15 2 15 2 25 5 3
NO NO YES NO YES
2 seconds
512 megabytes
['constructive algorithms', 'greedy', 'math', '*900']
J. Help, what does it mean to be "Based"time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputSup, gimme a single integer x (1 \le x \le 4) homie uwu :3OutputIf x = 1, spit out some based code that, like when ya feed it two integers a and b, it hands over their sum.If...
1
yoink a yoink b *slaps a on top of b* yeet b go touch some grass
1 second
256 megabytes
['brute force', 'constructive algorithms', 'expression parsing', 'implementation', 'sortings']
I. Dark Mattertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputView the statement as a PDF.ExampleInput 1 + 1Output 3
1 + 1
3
1 second
256 megabytes
['bitmasks', 'geometry']
H. Palindrometime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA palindrome is a string that reads the same in both directions, for example z, uwu, or moom.InputThe first line contains an integer t (1 \leq t \leq 100) — the number of testcases.The following t lines ea...
8actleradarracecarphpatcodercodeforcessteam
NO NO YES YES NO NO YES YES
3 seconds
256 megabytes
['implementation', 'strings']
G. Mathematician Takeovertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA mathematician grabbed my computer as I was preparing this problem, deleted the statement, and changed the samples to fit his liking. The model solution and input/output format are still correc...
1.234
0.21026
1 second
256 megabytes
['binary search', 'dfs and similar', 'math']
F. Gridtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe input contains 21 lines, each containing 21 characters \texttt{0} or \texttt{1}.ExampleInput 11111110101110111111110000010001100100000110111010110100101110110111010110010101110110111010100100101110110000...
11111110101110111111110000010001100100000110111010110100101110110111010110010101110110111010100100101110110000010011110100000111111110101010111111100000000000110000000011110010111111001110100011101010110011010111110110110100100001100100100000100001100011110111000011100101100000000100100111110011111110000110101000010000...
12
1 second
256 megabytes
['brute force']
E. Sweep Linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBe careful not to make a mistake. You might have to start all over again.— Someone, probablyInputThe first line contains one integer n (1 \leq n \leq 10^5) — the length of the array a.The second line contai...
71 1 2 1 1 2 0
1
1 second
256 megabytes
['combinatorics', 'games', 'math']
D. Are You a Procrastinator?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output!Input!Output!Scoring!ExampleInput ? Output ?Note!
?
?
1 second
256 megabytes
['implementation']
C. They Have Fooledtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output InputThe first line contains one integer n (0 \leq n \leq 12).OutputOne integer — the answer.ExamplesInput 0Output 10Input 1Output 10Input 5Output 7Input 9Output 0
0
10
1 second
256 megabytes
['brute force', 'schedules']
B. Is it stated?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputInputThe first line contains an integer t (1 \leq t \leq 100) — the number of testcases.The following t lines each contain a string of length at most 100 consisting of lowercase English letters. OutputF...
10isitstatedsubmitacacceptedwawronganswertletimelimitexceeded
NO YES NO YES NO NO NO NO NO YES
2 seconds
256 megabytes
['strings']
I. Growing Treestime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputwowaka ft. Hatsune Miku - Ura-Omote LoversඞYou are given an undirected connected simple graph with n nodes and m edges, where edge i connects node u_i and v_i, with two positive parameters a_i and b_i a...
45 5 14 3 5 52 1 5 72 4 6 25 3 3 52 5 2 95 5 34 3 5 52 1 5 72 4 6 25 3 3 52 5 2 92 1 100000001 2 1000 100010 15 107 1 7 65 8 6 64 8 2 24 3 10 910 8 3 44 6 6 15 4 1 39 3 4 38 3 9 97 5 10 32 1 3 46 1 6 42 5 7 310 7 2 18 2 6 8
38 191 100000010000000000 2722
5 seconds
512 megabytes
['binary search', 'constructive algorithms', 'flows', 'graphs', 'greedy', '*3200']
H. Thanos Snaptime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputPiotr Rubik - Psalm dla CiebieඞThere is an array a of size 2^k for some positive integer k, which is initially a permutation of values from 1 to 2^k. Alice and Bob play the following game on the array a. ...
511 224 3 2 135 1 6 4 7 2 8 3410 15 6 12 1 3 4 9 13 5 7 16 14 11 2 8532 2 5 23 19 17 31 7 29 3 4 16 13 9 30 24 14 1 8 20 6 15 26 18 10 27 22 12 25 21 28 11
1 3 1 7 5 1 15 13 9 1 31 28 25 17 1
3 seconds
512 megabytes
['binary search', 'dp', 'games', 'greedy', 'trees', '*3200']
G. Clacking Ballstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputRammstein - AusländerඞThere are m baskets placed along a circle, numbered from 1 to m in clockwise order (basket m is next to basket 1). Furthermore, there are n balls, where ball i is initially placed...
53 105 1 42 1515 16 61 2 3 4 5 66 96 5 4 3 2 11 10069
600000042 14 35 333333409 0
2 seconds
256 megabytes
['combinatorics', 'math', 'probabilities', '*3100']
F. Inversion Compositiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMy Chemical Romance - DisenchantedඞYou are given a permutation p of size n, as well as a non-negative integer k. You need to construct a permutation q of size n such that \operatorname{inv}(q) +...
53 42 3 15 52 3 5 1 46 115 1 2 3 4 69 513 1 4 2 5 6 7 8 91 01
YES 3 2 1 NO NO YES 1 5 9 8 7 6 4 3 2 YES 1
2 seconds
256 megabytes
['constructive algorithms', 'data structures', 'greedy', '*2500']
E. No Palindromestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChristopher Tin ft. Soweto Gospel Choir - Baba YetuඞYou are given a string s consisting of lowercase Latin characters. You need to partition^\dagger this string into some substrings, such that each sub...
3sinktheyachtllllllllluwuowouwu
YES 1 sinktheyacht NO YES 3 uw uow ouwu
2 seconds
256 megabytes
['brute force', 'constructive algorithms', 'divide and conquer', 'greedy', 'hashing', 'implementation', 'math', 'strings', '*2000']
D. Buying Jewelstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNightwish feat. Jonsu - Erämaan ViimeinenඞAlice has n coins and wants to shop at Bob's jewelry store. Today, although Bob has not set up the store yet, Bob wants to make sure Alice will buy exactly k je...
37 36 4255 8
YES 10 2 3 4 5 6 7 8 9 10 11 NO YES 8 128 64 32 16 8 4 2 1
2 seconds
256 megabytes
['constructive algorithms', 'greedy', 'math', '*2000']
C. Ticket Hoardingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMaître Gims - Est-ce que tu m'aimes ?ඞAs the CEO of a startup company, you want to reward each of your k employees with a ticket to the upcoming concert. The tickets will be on sale for n days, and by...
44 2 38 6 4 24 2 88 6 4 25 100 110000 1 100 10 10006 3 95 5 5 5 5 5
10 64 1 72
2 seconds
256 megabytes
['greedy', 'math', 'sortings', '*1400']
B. Battle Cowstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe HU - Shireg ShiregඞThere are n cows participating in a coding tournament. Cow i has a Cowdeforces rating of a_i (all distinct), and is initially in position i. The tournament consists of n-1 matches as...
36 112 10 14 11 8 36 57 2 727 10 12 132 21000000000 1
1 2 0
1 second
256 megabytes
['binary search', 'data structures', 'greedy', '*1200']
A. Dual Triggertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNgọt - LẦN CUỐI (đi bên em xót xa người ơi)ඞThere are n lamps numbered 1 to n lined up in a row, initially turned off. You can perform the following operation any number of times (possibly zero): Choose...
510110101011010100100111060000001112111111111111
YES NO YES NO YES
1 second
256 megabytes
['constructive algorithms', 'greedy', 'math', '*900']
G. Shuffling Songstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVladislav has a playlist consisting of n songs, numbered from 1 to n. Song i has genre g_i and writer w_i. He wants to make a playlist in such a way that every pair of adjacent songs either have the s...
41pop taylorswift4electronic themotanselectronic carlasdreamspop themotanspop irinarimes7rap eminemrap drdrerap kanyewestpop taylorswiftindierock arcticmonkeysindierock arcticmonkeyspunkrock theoffspring4a bc de fg h
0 0 4 3
3 seconds
256 megabytes
['bitmasks', 'dfs and similar', 'dp', 'graphs', 'hashing', 'implementation', 'strings', '*1900']
F. 0, 1, 2, Tree!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFind the minimum height of a rooted tree^{\dagger} with a+b+c vertices that satisfies the following conditions: a vertices have exactly 2 children, b vertices have exactly 1 child, and c vertices h...
102 1 30 0 10 1 11 0 21 1 33 1 48 17 924 36 481 0 00 3 1
2 0 1 1 -1 3 6 -1 -1 3
2 seconds
256 megabytes
['bitmasks', 'brute force', 'greedy', 'implementation', 'trees', '*1700']
E. Nearly Shortest Repeating Substringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s of length n consisting of lowercase Latin characters. Find the length of the shortest string k such that several (possibly one) copies of k can be concaten...
54abaa4abba13slavicgslavic8hshahaha20stormflamestornflame
1 4 13 2 10
2 seconds
256 megabytes
['brute force', 'implementation', 'number theory', 'strings', '*1500']
D. Product of Binary Decimalstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLet's call a number a binary decimal if it is a positive integer and all digits in its decimal notation are either 0 or 1. For example, 1\,010\,111 is a binary decimal, while 10\,201 and 78...
111211146411222110110100000991122024124211001
YES YES YES YES YES YES NO NO NO NO YES
3 seconds
256 megabytes
['brute force', 'dp', 'implementation', 'number theory', '*1100']
C. Clock Conversiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven the time in 24-hour format, output the equivalent time in 12-hour format. 24-hour format divides the day into 24 hours from 00 to 23, each of which has 60 minutes from 00 to 59. 12-hour forma...
1109:4118:0612:1400:5900:0014:3401:0119:0711:5912:0021:37
09:41 AM 06:06 PM 12:14 PM 12:59 AM 12:00 AM 02:34 PM 01:01 AM 07:07 PM 11:59 AM 12:00 PM 09:37 PM
1 second
256 megabytes
['implementation', 'math', '*800']
B. Upscalingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n. Output a 2n \times 2n checkerboard made of 2 \times 2 squares alternating '\texttt{#}' and '\texttt{.}', with the top-left cell being '\texttt{#}'. The picture above shows the an...
41234
## ## ##.. ##.. ..## ..## ##..## ##..## ..##.. ..##.. ##..## ##..## ##..##.. ##..##.. ..##..## ..##..## ##..##.. ##..##.. ..##..## ..##..##
1 second
256 megabytes
['implementation', '*800']
A. Stair, Peak, or Neither?time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three digits a, b, and c. Determine whether they form a stair, a peak, or neither. A stair satisfies the condition a<b<c. A peak satisfies the condition a<b>c. InputThe first ...
71 2 33 2 11 5 33 4 10 0 04 1 74 5 7
STAIR NONE PEAK PEAK NONE NONE STAIR
1 second
256 megabytes
['implementation', '*800']
K. Make Triangletime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n positive integers x_1, x_2, \ldots, x_n and three positive integers n_a, n_b, n_c satisfying n_a+n_b+n_c = n. You want to split the n positive integers into three groups, so that: The fi...
46 2 2 21 1 1 1 1 15 3 1 11 1 1 1 16 2 2 21 1 1 1 1 38 1 2 516 1 1 1 1 1 1 12
YES 1 1 1 1 1 1 NO NO YES 16 12 1 1 1 1 1 1
2 seconds
256 megabytes
['constructive algorithms', 'math']
J. Amanda the Amoebatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem has an attachment. You can use it to simulate and visualize the movements of the amoeba.Amoeba Amanda lives inside a rectangular grid of square pixels. Her body occupies some of these p...
5 8.******.**.X**..*******.**.X**...******..******....X****.*******...X****.******.
YES 5 3 1 3 8 2 1 2 8 4 1 4 8 2 2 4 7 4 2 2 7
2 seconds
256 megabytes
['graphs', 'implementation', 'trees', 'two pointers']
I. Diskstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given n disks in the plane. The center of each disk has integer coordinates, and the radius of each disk is a positive integer. No two disks overlap in a region of positive area, but it is possible for ...
50 2 10 0 14 -3 411 0 311 5 2
YES
2 seconds
256 megabytes
['dfs and similar', 'geometry', 'graph matchings', 'graphs']
H. Division Avoidancetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA newly discovered organism can be represented as a set of cells on an infinite grid. There is a coordinate system on the grid such that each cell has two integer coordinates x and y. A cell with c...
240 01 00 11 1160 00 10 20 31 01 11 21 32 02 12 22 33 03 13 23 3
YES NO
2 seconds
256 megabytes
['greedy', 'math']
G. Scootertime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe Czech Technical University campus consists of n buildings, indexed from 1 to n. In each building, there can be a math class scheduled, or a computer science class, or neither (but not both). Additionally,...
3CM--CM
7 DRIVE 3 PICKUP DRIVE 2 DROPOFF PICKUP DRIVE 1 DROPOFF
2 seconds
512 megabytes
['graphs', 'greedy']
F. Datingtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are the developer of a dating app which ignores gender completely. The app has n users, indexed from 1 to n. Each user's profile features a list of the activities they enjoy doing. There are m possible act...
3 53 1 2 45 1 2 3 4 52 1 5
YES 3 1
3 seconds
512 megabytes
['greedy', 'sortings', 'trees']
E. Damage per Secondtime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou just created a new character in your favourite role-playing game and now have to decide how to skill him. The two skill attributes to be chosen are: damage per hit and hits per second. Damage ...
1 714
3 4
5 seconds
1024 megabytes
['brute force', 'math']
D. Funny or Scary?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are designing a new video game. It has n scenarios, which the player may play in any order, but each scenario must be played exactly once. When a player switches from a scenario to another scenari...
5.?F???.???F?.S???S.?????.
.FFFF F.FFF FF.SF FFS.F FFFF.
2 seconds
256 megabytes
['constructive algorithms']
C. Annual Ants' Gatheringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDeep within a forest lies an ancient tree, home to n ants living in n tiny houses, indexed from 1 to n, connected by the branches of the tree. Once a year, all the ants need to gather to watch...
75 13 24 63 67 11 3
YES
2 seconds
256 megabytes
['dfs and similar', 'dp', 'greedy', 'trees']
B. Charming Mealstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Czech cuisine features n appetizers and n main dishes. The i-th appetizer has spiciness a_i, and the i-th main dish has spiciness b_i.A typical Czech meal consists of exactly one appetizer and one ...
430 0 01000000000 1000000000 100000000051 2 3 4 51 2 3 4 560 0 0 100 100 100100 100 100 0 0 0714 25 62 74 86 95 1251 62 71 72 92 20 84
1000000000 2 100 30
2 seconds
256 megabytes
['binary search', 'brute force', 'greedy', 'sortings']
A. Grovetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou want to plant trees in a square lawn of size n \times n whose corners have Cartesian coordinates (0, 0), (n, 0), (0, n), and (n, n). Trees can only be planted at locations with integer coordinates. Every tr...
6 1.241
2 4 2 2 4
4 seconds
256 megabytes
['brute force', 'dfs and similar', 'dp', 'geometry', 'probabilities']
G. MST with Matchingtime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an undirected connected graph on n vertices. Each edge of this graph has a weight; the weight of the edge connecting vertices i and j is w_{i,j} (or w_{i,j} = 0 if there is no edge bet...
4 100 1 8 01 0 1 08 1 0 20 0 2 0
21
6 seconds
512 megabytes
['bitmasks', 'brute force', 'dsu', 'graph matchings', 'trees', '*3100']
F. Rare Coinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n bags numbered from 1 to n, the i-th bag contains a_i golden coins and b_i silver coins.The value of a gold coin is 1. The value of a silver coin is either 0 or 1, determined for each silver coi...
2 21 00 22 21 1
748683265 748683265
2 seconds
256 megabytes
['combinatorics', 'math', 'probabilities', '*2500']
E. Clique Partitiontime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given two integers, n and k. There is a graph on n vertices, numbered from 1 to n, which initially has no edges.You have to assign each vertex an integer; let a_i be the integer on the vertex...
32 35 48 16
2 1 1 1 1 3 1 5 2 4 2 1 1 2 1 2 1 2 3 4 5 6 7 8 1 1 1 1 1 1 1 1 1
3 seconds
512 megabytes
['brute force', 'constructive algorithms', 'graphs', 'greedy', 'implementation', '*2100']
D. Tandem Repeats?time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s, consisting of lowercase Latin letters and/or question marks.A tandem repeat is a string of an even length such that its first half is equal to its second half.A string a is a...
4zaabaabz?????code?????scodeforces
6 4 10 0
2 seconds
256 megabytes
['brute force', 'strings', 'two pointers', '*1700']
C. Arrow Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a grid, consisting of 2 rows and n columns. The rows are numbered from 1 to 2 from top to bottom. The columns are numbered from 1 to n from left to right. Each cell of the grid contains an arrow p...
44>><<>>><2><><4>>><>><<6>><<><><>>><
YES YES NO YES
2 seconds
256 megabytes
['brute force', 'constructive algorithms', 'dfs and similar', 'dp', 'graphs', 'shortest paths', '*1300']
B. Array Fixtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer array a of length n.You can perform the following operation any number of times (possibly zero): take any element of the array a, which is at least 10, delete it, and instead insert...
3412 3 45 67312 28 520 0
YES NO YES
2 seconds
256 megabytes
['brute force', 'dp', 'greedy', 'implementation', '*1100']
A. Special Characterstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an integer n.Your task is to build a string of uppercase Latin letters. There must be exactly n special characters in this string. Let's call a character special if it is equal to exa...
3612
YES AAABAACC NO YES MM
2 seconds
256 megabytes
['brute force', 'constructive algorithms', '*800']
F. Nobody is neededtime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputOleg received a permutation a of length n as a birthday present.Oleg's friend Nechipor asks Oleg q questions, each question is characterized by two numbers l and r, in response to the question Oleg m...
48 82 1 6 3 5 4 8 71 82 81 71 61 35 84 42 31 111 13 33 2 11 21 32 38 11 2 3 4 5 6 7 81 8
20 15 18 12 5 5 1 3 1 2 3 2 27
6 seconds
512 megabytes
['2-sat', 'data structures', 'dfs and similar', 'dp', '*2500']
E. Girl Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSome permutation of length n is guessed.You are given the indices of its prefix maximums and suffix maximums.Recall that a permutation of length k is an array of size k such that each integer from 1 ...
61 1 1114 2 31 22 3 43 3 11 2 335 3 41 2 32 3 4 520 5 41 2 3 4 1212 13 18 206 2 31 33 4 6
1 3 1 0 317580808 10
2 seconds
256 megabytes
['combinatorics', 'dp', 'math', 'number theory', '*2200']
D. Birthday Gifttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYarik's birthday is coming soon, and Mark decided to give him an array a of length n.Mark knows that Yarik loves bitwise operations very much, and he also has a favorite number x, so Mark wants to find ...
83 11 2 32 21 12 21 32 30 03 20 0 14 21 3 3 72 22 35 00 1 2 2 1
2 2 1 2 3 -1 1 2
2 seconds
256 megabytes
['bitmasks', 'brute force', 'constructive algorithms', 'greedy', 'implementation', '*1900']
C. Tree Cuttingtime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a tree with n vertices.Your task is to find the maximum number x such that it is possible to remove exactly k edges from this tree in such a way that the size of each remaining connected co...
65 11 21 33 43 52 11 26 11 22 33 44 55 63 11 21 38 21 21 32 42 53 63 73 86 21 22 31 44 55 6
2 1 3 1 1 2
3 seconds
512 megabytes
['binary search', 'dp', 'greedy', 'implementation', 'trees', '*1600']
B. Maximum Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have an array a of n integers.You perform exactly k operations on it. In one operation, you select any contiguous subarray of the array a (possibly empty) and insert the sum of this subarray anywhere i...
122 2-4 -73 32 2 81 775 14 -2 8 -12 97 48 14 -9 6 0 -1 37 1005 3 -8 12 -5 -9 36 1000-1000000000 -1000000000 -1000000000 -1000000000 -1000000000 -10000000002 11000000000 85 40 0 0 0 06 1048973 757292 58277 -38574 27475 9999847 1-1000 1000 -1000 1000 -1000 1000 -100010 10050408293874 -3498597 7374783 295774930 -48574034 ...
999999996 96 896 17 351 716455332 42 2 0 897909241 0 416571966
1 second
256 megabytes
['dp', 'greedy', 'math', '*1100']
A. Median of an Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of n integers.The median of an array q_1, q_2, \ldots, q_k is the number p_{\lceil \frac{k}{2} \rceil}, where p is the array q sorted in non-decreasing order. For example, t...
832 2 847 3 3 11100000000055 5 5 4 562 1 2 3 1 421 221 145 5 5 5
1 2 1 3 2 1 2 3
1 second
256 megabytes
['greedy', 'implementation', 'sortings', '*800']
H. GCD is Greatertime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIn the evenings during the hike, Kirill and Anton decided to take out an array of integers a of length n from their backpack and play a game with it. The rules are as follows: Kirill chooses from 2 to ...
84 14 3 1 84 14 5 8 45 01 1 1 1 15 231 63 127 63 314 11 3 3 38 34 3 4 1 2 2 5 34 21 4 3 68 4831 61 37 15 53 26 61 12
YES 2 4 8 2 3 1 YES 2 4 4 2 5 8 NO YES 2 63 63 3 31 127 31 YES 2 3 3 2 1 3 YES 2 4 4 6 3 1 2 2 5 3 YES 2 3 6 2 1 4 YES 2 61 61 6 31 37 15 53 26 12
3 seconds
512 megabytes
['brute force', 'data structures', 'math', 'number theory', '*2600']
G. Cook and Porridgetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFinally, lunchtime!n schoolchildren have lined up in a long queue at the cook's tent for porridge. The cook will be serving porridge for D minutes. The schoolchild standing in the i-th position in t...
73 32 23 12 35 1010 37 111 35 16 15 204 27 28 51 53 15 171 38 28 32 21 15 148 24 21 38 36 41 114 55 148 24 21 38 36 4
3 -1 12 6 6 1 6
2 seconds
256 megabytes
['binary search', 'constructive algorithms', 'data structures', 'implementation', '*2500']
F. Kirill and Mushroomstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs soon as everyone in the camp fell asleep, Kirill sneaked out of the tent and went to the Wise Oak to gather mushrooms.It is known that there are n mushrooms growing under the Oak, each of whic...
639 8 143 2 151 2 3 4 51 2 3 4 561 2 3 4 5 66 5 4 3 2 151 4 6 10 102 1 4 5 342 2 5 54 2 3 151 2 9 10 101 4 2 3 5
16 2 9 3 8 2 20 2 5 1 20 2
2 seconds
256 megabytes
['data structures', 'sortings', '*1900']
E. Binary Searchtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAnton got bored during the hike and wanted to solve something. He asked Kirill if he had any new problems, and of course, Kirill had one.You are given a permutation p of size n, and a number x that need...
56 31 2 3 4 5 66 53 1 6 5 2 45 13 5 4 2 16 34 3 1 5 2 63 23 2 1
0 1 3 4 2 2 4 1 5 2 4 5 2 4 1 1 3
2 seconds
256 megabytes
['binary search', 'constructive algorithms', 'greedy', '*1700']
D. Seraphim the Owltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe guys lined up in a queue of n people, starting with person number i = 1, to ask Serafim the Owl about the meaning of life. Unfortunately, Kirill was very busy writing the legend for this problem,...
44 27 3 6 94 3 8 56 26 9 7 1 8 35 8 8 1 4 17 77 2 9 2 6 5 99 1 10 7 1 4 92 12 31 1
14 22 9 3
2 seconds
256 megabytes
['dp', 'greedy', '*1300']
C. Left and Right Housestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the village of Letovo, there are n houses. The villagers decided to build a big road that will divide the village into left and right sides. Each resident wants to live on either the right or...
731016010111601100130003110300141100
2 3 2 3 0 1 0
2 seconds
256 megabytes
['brute force', '*1200']
B. Fireworkstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne of the days of the hike coincided with a holiday, so in the evening at the camp, it was decided to arrange a festive fireworks display. For this purpose, the organizers of the hike bought two installatio...
66 7 43 4 107 8 565 6 781234598961 1 11 1 1000000000000000000
2 7 17 28645268630 4 2000000000000000002
1 second
256 megabytes
['math', 'number theory', '*900']
A. Setting up Camptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe organizing committee plans to take the participants of the Olympiad on a hike after the tour. Currently, the number of tents needed to be taken is being calculated. It is known that each tent can a...
101 2 31 4 11 4 21 1 11 3 219 7 180 0 07 0 00 24 01000000000 1000000000 1000000000
3 -1 3 -1 3 28 0 7 8 1666666667
1 second
256 megabytes
['greedy', 'math', '*800']
B. Equal XORtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a of length 2n, consisting of each integer from 1 to n exactly twice.You are also given an integer k (1 \leq k \leq \lfloor \frac{n}{2} \rfloor ).You need to find two arrays l and r ea...
42 11 2 2 16 16 4 2 1 2 3 1 6 3 5 5 44 11 2 3 4 1 2 3 46 25 1 3 3 5 1 2 6 4 6 4 2
2 1 2 1 6 4 1 3 1 2 1 2 5 1 3 3 6 4 2 4
1 second
256 megabytes
['bitmasks', 'constructive algorithms', '*1100']
A. Destroying Bridgestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n islands, numbered 1, 2, \ldots, n. Initially, every pair of islands is connected by a bridge. Hence, there are a total of \frac{n (n - 1)}{2} bridges. Everule lives on island 1 and enjoy...
62 02 14 15 105 34 4
2 1 4 1 5 1
1 second
256 megabytes
['graphs', 'greedy', 'math', '*800']
F. Minimum Hamming Distancetime limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a binary string^\dagger s of length n.A binary string p of the same length n is called good if for every i (1 \leq i \leq n), there exist indices l and r such that: 1 \leq l ...
330000004000011116111111000100
0 2 1
4 seconds
1024 megabytes
['dp', '*3500']
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
39