problem_number stringclasses 123
values | problem_letter stringclasses 33
values | problem_title stringlengths 1 46 | tags stringlengths 2 129 | difficulty stringclasses 41
values | problem_link stringlengths 43 56 | start_time stringclasses 117
values | language stringclasses 2
values | problem_site stringclasses 3
values | description stringlengths 331 6.84k |
|---|---|---|---|---|---|---|---|---|---|
2053 | I2 | Affectionate Arrays (Hard Version) | ["data structures", "dp", "graphs", "greedy", "math", "shortest paths", "two pointers"] | https://codeforces.com/problemset/problem/2053/I2 | 1735396500 | en | codeforces | # Affectionate Arrays (Hard Version)
## Problem Description
You are the beginning of the letter, the development of a poem, and the end of a fairy tale.
โ ilem, [Pinky Promise](https://www.bilibili.com/video/BV1Jb411U7u2/)
This is the hard version of the problem. The difference between the versions is that in thi... | |
2053 | I1 | Affectionate Arrays (Easy Version) | ["data structures", "dp", "greedy"] | https://codeforces.com/problemset/problem/2053/I1 | 1735396500 | en | codeforces | # Affectionate Arrays (Easy Version)
## Problem Description
You are the beginning of the letter, the development of a poem, and the end of a fairy tale.
โ ilem, [Pinky Promise](https://www.bilibili.com/video/BV1Jb411U7u2/)
This is the easy version of the problem. The difference between the versions is that in thi... | |
2053 | H | Delicate Anti-monotonous Operations | ["constructive algorithms", "implementation"] | https://codeforces.com/problemset/problem/2053/H | 1735396500 | en | codeforces | # Delicate Anti-monotonous Operations
## Problem Description
I shall be looking for you who would be out of Existence.
โ HyuN, [Disorder](https://soundcloud.com/k-sounds-studio/g2r2018-hyun-disorder-feat-yuri)
There are always many repetitive tasks in life. Iris always dislikes them, so she refuses to repeat them... | |
2053 | G | Naive String Splits | ["binary search", "brute force", "greedy", "hashing", "math", "number theory", "strings"] | https://codeforces.com/problemset/problem/2053/G | 1735396500 | en | codeforces | # Naive String Splits
## Problem Description
And I will: love the world that you've adored; wish the smile that you've longed for. Your hand in mine as we explore, please take me to tomorrow's shore.
โ Faye Wong, [As Wished](https://www.youtube.com/watch?v=ZoJCN0pV7Qs)
Cocoly has a string $ t $ of length $ m $ ,... | |
2053 | F | Earnest Matrix Complement | ["brute force", "data structures", "dp", "greedy", "implementation", "math"] | https://codeforces.com/problemset/problem/2053/F | 1735396500 | en | codeforces | # Earnest Matrix Complement
## Problem Description
3, 2, 1, ... We are the โ RiOI Team!
โ Felix & All, [Special Thanks 3](https://www.luogu.com.cn/problem/T351681)
- Peter: Good news: My problem T311013 is approved!
- $ \delta $ : I'm glad my computer had gone out of battery so that I wouldn't have participat... | |
2053 | E | Resourceful Caterpillar Sequence | ["dfs and similar", "dp", "games", "graphs", "greedy", "trees"] | https://codeforces.com/problemset/problem/2053/E | 1735396500 | en | codeforces | # Resourceful Caterpillar Sequence
## Problem Description
Endless Repeating 7 Days
โ r-906, [Panopticon](https://www.youtube.com/watch?v=_-Vd0ZGB-lo)
There is a tree consisting of $ n $ vertices. Let a caterpillar be denoted by an integer pair $ (p, q) $ ( $ 1 \leq p, q \leq n $ , $ p \neq q $ ): its head is at v... | |
2053 | D | Refined Product Optimality | ["binary search", "data structures", "greedy", "math", "schedules", "sortings"] | https://codeforces.com/problemset/problem/2053/D | 1735396500 | en | codeforces | # Refined Product Optimality
## Problem Description
As a tester, when my solution has a different output from the example during testing, I suspect the author first.
โ Chris, [a comment](https://codeforces.com/blog/entry/133116?#comment-1190579)
Although Iris occasionally sets a problem where the solution is poss... | |
2053 | C | Bewitching Stargazer | ["bitmasks", "divide and conquer", "dp", "math"] | https://codeforces.com/problemset/problem/2053/C | 1735396500 | en | codeforces | # Bewitching Stargazer
## Problem Description
I'm praying for owning a transparent heart; as well as eyes with tears more than enough...
โ Escape Plan, [Brightest Star in the Dark](https://www.youtube.com/watch?v=GPnymcrXgX0)
Iris looked at the stars and a beautiful problem emerged in her mind. She is inviting yo... | |
2053 | B | Outstanding Impressionist | ["binary search", "brute force", "data structures", "greedy"] | https://codeforces.com/problemset/problem/2053/B | 1735396500 | en | codeforces | # Outstanding Impressionist
## Problem Description
If it was so, then let's make it a deal...
โ MayDay, [Gentleness](https://www.youtube.com/watch?v=mtAc_bMYBsM&list=PLj6NQzHFCvkHKIm0Vnk9LH3odqTIBRZ1Q&index=15)
Even after copying the paintings from famous artists for ten years, unfortunately, Eric is still unable... | |
2053 | A | Tender Carpenter | ["dp", "geometry", "greedy", "math"] | https://codeforces.com/problemset/problem/2053/A | 1735396500 | en | codeforces | # Tender Carpenter
## Problem Description
I would use a firework to announce, a wave to bid farewell, and a bow to say thanks: bygones are bygones; not only on the following path will I be walking leisurely and joyfully, but also the footsteps won't halt as time never leaves out flowing; for in the next year, we will... | |
2052 | J | Judicious Watching | ["binary search", "greedy", "sortings"] | 2000 | https://codeforces.com/problemset/problem/2052/J | 1734248100 | en | codeforces | # Judicious Watching
## Problem Description
Jill loves having good grades in university, so she never misses deadlines for her homework assignments. But even more, she loves watching the series and discussing it with her best friend Johnny. And unfortunately, today she needs to choose between these two activities!
J... |
2052 | G | Geometric Balance | ["data structures", "geometry", "implementation"] | 2800 | https://codeforces.com/problemset/problem/2052/G | 1734248100 | en | codeforces | # Geometric Balance
## Problem Description
Peter's little brother Ivan likes to play with a turtle. The turtle is a special toy that lives on the plane and can execute three commands:
- Rotate $ a $ degrees counterclockwise.
- Draw $ d $ units in the direction it is facing while dispensing ink. No segment of the pla... |
2052 | F | Fix Flooded Floor | ["constructive algorithms", "dp", "graphs"] | 1700 | https://codeforces.com/problemset/problem/2052/F | 1734248100 | en | codeforces | # Fix Flooded Floor
## Problem Description
Archimedes conducted his famous experiments on buoyancy. But not everyone knows that while he was taking a bath, he was too focused and didn't notice the moment when the water overflowed over the edge of the bath and flooded the floor near the wall. His expensive parquet was... |
2052 | E | Expression Correction | ["brute force", "expression parsing", "strings"] | 1900 | https://codeforces.com/problemset/problem/2052/E | 1734248100 | en | codeforces | # Expression Correction
## Problem Description
Eve is studying mathematics in school. They've already learned how to perform addition and subtraction of decimal numbers and are practicing it by solving fun puzzles. The specific type of the puzzle they are solving is described below. They are given an equality with ad... |
2052 | D | DAG Serialization | ["brute force", "graphs"] | 2100 | https://codeforces.com/problemset/problem/2052/D | 1734248100 | en | codeforces | # DAG Serialization
## Problem Description
Consider a simple single-bit boolean register that supports two operations:
- set โ sets the register to true if it was false, and returns true; otherwise, it returns false;
- unset โ sets the register to false if it was true, and returns true; otherwise, it returns false.
... |
2052 | A | Adrenaline Rush | ["constructive algorithms"] | 1600 | https://codeforces.com/problemset/problem/2052/A | 1734248100 | en | codeforces | # Adrenaline Rush
## Problem Description
Alice's friend is a big fan of the Adrenaline Rush racing competition and always strives to attend every race. However, this time, Alice is the one watching the race. To ensure her friend does not miss any important details, Alice decides to take notes on everything that happe... |
2051 | G | Snakes | ["bitmasks", "dp", "dsu", "graphs"] | https://codeforces.com/problemset/problem/2051/G | 1734878100 | en | codeforces | # Snakes
## Problem Description
Suppose you play a game where the game field looks like a strip of $ 1 \times 10^9 $ square cells, numbered from $ 1 $ to $ 10^9 $ .
You have $ n $ snakes (numbered from $ 1 $ to $ n $ ) you need to place into some cells. Initially, each snake occupies exactly one cell, and you can't ... | |
2051 | F | Joker | ["brute force", "greedy", "implementation", "math"] | https://codeforces.com/problemset/problem/2051/F | 1734878100 | en | codeforces | # Joker
## Problem Description
Consider a deck of $ n $ cards. The positions in the deck are numbered from $ 1 $ to $ n $ from top to bottom. A joker is located at position $ m $ .
$ q $ operations are applied sequentially to the deck. During the $ i $ -th operation, you need to take the card at position $ a_i $ an... | |
2051 | E | Best Price | ["binary search", "brute force", "data structures", "greedy", "sortings"] | https://codeforces.com/problemset/problem/2051/E | 1734878100 | en | codeforces | # Best Price
## Problem Description
A batch of Christmas trees has arrived at the largest store in Berland. $ n $ customers have already come to the store, wanting to buy them.
Before the sales begin, the store needs to determine the price for one tree (the price is the same for all customers). To do this, the store... | |
2051 | D | Counting Pairs | ["binary search", "sortings", "two pointers"] | https://codeforces.com/problemset/problem/2051/D | 1734878100 | en | codeforces | # Counting Pairs
## Problem Description
You are given a sequence $ a $ , consisting of $ n $ integers, where the $ i $ -th element of the sequence is equal to $ a_i $ . You are also given two integers $ x $ and $ y $ ( $ x \le y $ ).
A pair of integers $ (i, j) $ is considered interesting if the following conditions... | |
2051 | C | Preparing for the Exam | ["constructive algorithms", "implementation"] | https://codeforces.com/problemset/problem/2051/C | 1734878100 | en | codeforces | # Preparing for the Exam
## Problem Description
Monocarp is preparing for his first exam at the university. There are $ n $ different questions which can be asked during the exam, numbered from $ 1 $ to $ n $ . There are $ m $ different lists of questions; each list consists of exactly $ n-1 $ different questions. Ea... | |
2051 | B | Journey | ["binary search", "math"] | https://codeforces.com/problemset/problem/2051/B | 1734878100 | en | codeforces | # Journey
## Problem Description
Monocarp decided to embark on a long hiking journey.
He decided that on the first day he would walk $ a $ kilometers, on the second day he would walk $ b $ kilometers, on the third day he would walk $ c $ kilometers, on the fourth day, just like on the first, he would walk $ a $ kilo... | |
2051 | A | Preparing for the Olympiad | ["greedy"] | https://codeforces.com/problemset/problem/2051/A | 1734878100 | en | codeforces | # Preparing for the Olympiad
## Problem Description
Monocarp and Stereocarp are preparing for the Olympiad. There are $ n $ days left until the Olympiad. On the $ i $ -th day, if Monocarp plans to practice, he will solve $ a_i $ problems. Similarly, if Stereocarp plans to practice on the same day, he will solve $ b_i... | |
2050 | G | Tree Destruction | ["dfs and similar", "dp", "trees"] | 1900 | https://codeforces.com/problemset/problem/2050/G | 1733409300 | en | codeforces | # Tree Destruction
## Problem Description
Given a tree $ ^{\text{โ}} $ with $ n $ vertices. You can choose two vertices $ a $ and $ b $ once and remove all vertices on the path from $ a $ to $ b $ , including the vertices themselves. If you choose $ a=b $ , only one vertex will be removed.
Your task is to find the m... |
2050 | F | Maximum modulo equality | ["data structures", "divide and conquer", "math", "number theory"] | 1700 | https://codeforces.com/problemset/problem/2050/F | 1733409300 | en | codeforces | # Maximum modulo equality
## Problem Description
You are given an array $ a $ of length $ n $ and $ q $ queries $ l $ , $ r $ .
For each query, find the maximum possible $ m $ , such that all elements $ a_l $ , $ a_{l+1} $ , ..., $ a_r $ are equal modulo $ m $ . In other words, $ a_l \bmod m = a_{l+1} \bmod m = \dot... |
2050 | E | Three Strings | ["dp", "implementation", "strings"] | 1500 | https://codeforces.com/problemset/problem/2050/E | 1733409300 | en | codeforces | # Three Strings
## Problem Description
You are given three strings: $ a $ , $ b $ , and $ c $ , consisting of lowercase Latin letters. The string $ c $ was obtained in the following way:
1. At each step, either string $ a $ or string $ b $ was randomly chosen, and the first character of the chosen string was removed... |
2050 | D | Digital string maximization | ["brute force", "greedy", "math", "strings"] | 1300 | https://codeforces.com/problemset/problem/2050/D | 1733409300 | en | codeforces | # Digital string maximization
## Problem Description
You are given a string $ s $ , consisting of digits from $ 0 $ to $ 9 $ . In one operation, you can pick any digit in this string, except for $ 0 $ or the leftmost digit, decrease it by $ 1 $ , and then swap it with the digit left to the picked.
For example, in on... |
2050 | C | Uninteresting Number | ["brute force", "dp", "math"] | 1200 | https://codeforces.com/problemset/problem/2050/C | 1733409300 | en | codeforces | # Uninteresting Number
## Problem Description
You are given a number $ n $ with a length of no more than $ 10^5 $ .
You can perform the following operation any number of times: choose one of its digits, square it, and replace the original digit with the result. The result must be a digit (that is, if you choose the ... |
2050 | B | Transfusion | ["brute force", "greedy", "math"] | 1100 | https://codeforces.com/problemset/problem/2050/B | 1733409300 | en | codeforces | # Transfusion
## Problem Description
You are given an array $ a $ of length $ n $ . In one operation, you can pick an index $ i $ from $ 2 $ to $ n-1 $ inclusive, and do one of the following actions:
- Decrease $ a_{i-1} $ by $ 1 $ , then increase $ a_{i+1} $ by $ 1 $ .
- Decrease $ a_{i+1} $ by $ 1 $ , then increas... |
2050 | A | Line Breaks | ["implementation"] | 800 | https://codeforces.com/problemset/problem/2050/A | 1733409300 | en | codeforces | # Line Breaks
## Problem Description
Kostya has a text $ s $ consisting of $ n $ words made up of Latin alphabet letters. He also has two strips on which he must write the text. The first strip can hold $ m $ characters, while the second can hold as many as needed.
Kostya must choose a number $ x $ and write the fir... |
2049 | F | MEX OR Mania | ["bitmasks", "brute force", "data structures", "dsu", "implementation"] | 2700 | https://codeforces.com/problemset/problem/2049/F | 1734705300 | en | codeforces | # MEX OR Mania
## Problem Description
An integer sequence $ b_1, b_2, \ldots, b_n $ is good if $ \operatorname{mex}(b_1, b_2, \ldots, b_n) - (b_1 | b_2 | \ldots | b_n) = 1 $ . Here, $ \operatorname{mex(c)} $ denotes the MEX $ ^{\text{โ}} $ of the collection $ c $ , and $ | $ is the [bitwise OR](https://en.wikipedia.o... |
2049 | E | Broken Queries | ["binary search", "bitmasks", "brute force", "constructive algorithms", "implementation", "interactive"] | 2400 | https://codeforces.com/problemset/problem/2049/E | 1734705300 | en | codeforces | # Broken Queries
## Problem Description
You, a wizard whose creation was destroyed by a dragon, are determined to hunt it down with a magical AOE tracker. But it seems to be toyed with...
This is an interactive problem.
There is a hidden binary array $ a $ of length $ n $ ( $ \mathbf{n} $ is a power of 2) and a hid... |
2049 | D | Shift + Esc | ["brute force", "dp"] | 1900 | https://codeforces.com/problemset/problem/2049/D | 1734705300 | en | codeforces | # Shift + Esc
## Problem Description
After having fun with a certain contraption and getting caught, Evirir the dragon decides to put their magical skills to good use โ warping reality to escape fast!
You are given a grid with $ n $ rows and $ m $ columns of non-negative integers and an integer $ k $ . Let $ (i, j) ... |
2049 | C | MEX Cycle | ["brute force", "constructive algorithms", "greedy", "implementation"] | 1500 | https://codeforces.com/problemset/problem/2049/C | 1734705300 | en | codeforces | # MEX Cycle
## Problem Description
Evirir the dragon has many friends. They have 3 friends! That is one more than the average dragon.
You are given integers $ n $ , $ x $ , and $ y $ . There are $ n $ dragons sitting in a circle. The dragons are numbered $ 1, 2, \ldots, n $ . For each $ i $ ( $ 1 \le i \le n $ ), dr... |
2049 | B | pspspsps | ["brute force", "constructive algorithms", "graph matchings", "implementation"] | 1300 | https://codeforces.com/problemset/problem/2049/B | 1734705300 | en | codeforces | # pspspsps
## Problem Description
Cats are attracted to pspspsps, but Evirir, being a dignified dragon, is only attracted to pspspsps with oddly specific requirements...
Given a string $ s = s_1s_2\ldots s_n $ of length $ n $ consisting of characters p, s, and . (dot), determine whether a permutation $ ^{\text{โ}} $... |
2049 | A | MEX Destruction | ["greedy", "implementation"] | 800 | https://codeforces.com/problemset/problem/2049/A | 1734705300 | en | codeforces | # MEX Destruction
## Problem Description
Evirir the dragon snuck into a wizard's castle and found a mysterious contraption, and their playful instincts caused them to play with (destroy) it...
Evirir the dragon found an array $ a_1, a_2, \ldots, a_n $ of $ n $ non-negative integers.
In one operation, they can choos... |
2048 | I2 | Kevin and Puzzle (Hard Version) | ["bitmasks", "fft", "math"] | 3500 | https://codeforces.com/problemset/problem/2048/I2 | 1734618900 | en | codeforces | # Kevin and Puzzle (Hard Version)
## Problem Description
This is the hard version of the problem. The difference between the versions is that in this version, you need to count the number of good arrays. You can hack only if you solved all versions of this problem.
Kevin is visiting the Red Church, and he found a pu... |
2048 | I1 | Kevin and Puzzle (Easy Version) | ["constructive algorithms"] | 3500 | https://codeforces.com/problemset/problem/2048/I1 | 1734618900 | en | codeforces | # Kevin and Puzzle (Easy Version)
## Problem Description
This is the easy version of the problem. The difference between the versions is that in this version, you need to find any one good array. You can hack only if you solved all versions of this problem.
Kevin is visiting the Red Church, and he found a puzzle on ... |
2048 | H | Kevin and Strange Operation | ["data structures", "dp"] | 3100 | https://codeforces.com/problemset/problem/2048/H | 1734618900 | en | codeforces | # Kevin and Strange Operation
## Problem Description
Kevin is exploring problems related to binary strings in Chinatown. When he was at a loss, a stranger approached him and introduced a peculiar operation:
- Suppose the current binary string is $ t $ , with a length of $ \vert t \vert $ . Choose an integer $ 1... |
2048 | G | Kevin and Matrices | ["brute force", "combinatorics", "dp", "math"] | 2800 | https://codeforces.com/problemset/problem/2048/G | 1734618900 | en | codeforces | # Kevin and Matrices
## Problem Description
Kevin has been transported to Sacred Heart Hospital, which contains all the $ n \times m $ matrices with integer values in the range $ [1,v] $ .
Now, Kevin wants to befriend some matrices, but he is willing to befriend a matrix $ a $ if and only if the following cond... |
2048 | F | Kevin and Math Class | ["brute force", "data structures", "divide and conquer", "dp", "implementation", "math", "trees"] | 2500 | https://codeforces.com/problemset/problem/2048/F | 1734618900 | en | codeforces | # Kevin and Math Class
## Problem Description
Kevin is a student from Eversleeping Town, currently attending a math class where the teacher is giving him division exercises.
On the board, there are two rows of positive integers written, each containing $ n $ numbers. The first row is $ a_1, a_2, \ldots, a_n $ , ... |
2048 | E | Kevin and Bipartite Graph | ["constructive algorithms", "graphs", "greedy"] | 2000 | https://codeforces.com/problemset/problem/2048/E | 1734618900 | en | codeforces | # Kevin and Bipartite Graph
## Problem Description
The Arms Factory needs a poster design pattern and finds Kevin for help.
A poster design pattern is a bipartite graph with $ 2n $ vertices in the left part and $ m $ vertices in the right part, where there is an edge between each vertex in the left part and each... |
2048 | D | Kevin and Competition Memories | ["binary search", "brute force", "data structures", "greedy", "sortings", "two pointers"] | 1600 | https://codeforces.com/problemset/problem/2048/D | 1734618900 | en | codeforces | # Kevin and Competition Memories
## Problem Description
Kevin used to get into Rio's Memories, and in Rio's Memories, a series of contests was once held. Kevin remembers all the participants and all the contest problems from that time, but he has forgotten the specific rounds, the distribution of problems, and the ex... |
2048 | C | Kevin and Binary Strings | ["bitmasks", "brute force", "greedy", "implementation", "strings"] | 1200 | https://codeforces.com/problemset/problem/2048/C | 1734618900 | en | codeforces | # Kevin and Binary Strings
## Problem Description
Kevin discovered a binary string $ s $ that starts with 1 in the river at Moonlit River Park and handed it over to you. Your task is to select two non-empty substrings $ ^{\text{โ}} $ of $ s $ (which can be overlapped) to maximize the XOR value of these two substrings... |
2048 | B | Kevin and Permutation | ["constructive algorithms", "greedy"] | 900 | https://codeforces.com/problemset/problem/2048/B | 1734618900 | en | codeforces | # Kevin and Permutation
## Problem Description
Kevin is a master of permutation-related problems. You are taking a walk with Kevin in Darkwoods, and during your leisure time, he wants to ask you the following question.
Given two positive integers $ n $ and $ k $ , construct a permutation $ ^{\text{โ}} $ $ p $ ... |
2048 | A | Kevin and Combination Lock | ["brute force", "greedy", "implementation", "math", "number theory"] | 800 | https://codeforces.com/problemset/problem/2048/A | 1734618900 | en | codeforces | # Kevin and Combination Lock
## Problem Description
Kevin is trapped in Lakeside Village by Grace. At the exit of the village, there is a combination lock that can only be unlocked if Kevin solves it.
The combination lock starts with an integer $ x $ . Kevin can perform one of the following two operations zero or ... |
2047 | B | Replace Character | ["brute force", "combinatorics", "greedy", "strings"] | 900 | https://codeforces.com/problemset/problem/2047/B | 1733207100 | en | codeforces | # Replace Character
## Problem Description
You're given a string $ s $ of length $ n $ , consisting of only lowercase English letters.
You must do the following operation exactly once:
- Choose any two indices $ i $ and $ j $ ( $ 1 \le i, j \le n $ ). You can choose $ i = j $ .
- Set $ s_i := s_j $ .
You need to m... |
2047 | A | Alyona and a Square Jigsaw Puzzle | ["implementation", "math"] | 800 | https://codeforces.com/problemset/problem/2047/A | 1733207100 | en | codeforces | # Alyona and a Square Jigsaw Puzzle
## Problem Description
Alyona assembles an unusual square Jigsaw Puzzle. She does so in $ n $ days in the following manner:
- On the first day, she starts by placing the central piece in the center of the table.
- On each day after the first one, she places a certain number of pie... |
2046 | F2 | Yandex Cuneiform (Hard Version) | ["constructive algorithms", "data structures", "greedy", "implementation"] | 3500 | https://codeforces.com/problemset/problem/2046/F2 | 1733207100 | en | codeforces | # Yandex Cuneiform (Hard Version)
## Problem Description
This is the hard version of the problem. The difference between the versions is that in this version, there is no restriction on the number of question marks. You can hack only if you solved all versions of this problem.
For a long time, no one could decipher ... |
2046 | F1 | Yandex Cuneiform (Easy Version) | ["constructive algorithms", "data structures", "greedy"] | 3300 | https://codeforces.com/problemset/problem/2046/F1 | 1733207100 | en | codeforces | # Yandex Cuneiform (Easy Version)
## Problem Description
This is the easy version of the problem. The difference between the versions is that in this version, there are no question marks. You can hack only if you solved all versions of this problem.
For a long time, no one could decipher Sumerian cuneiform. However,... |
2046 | E2 | Cheops and a Contest (Hard Version) | ["greedy", "implementation"] | 3500 | https://codeforces.com/problemset/problem/2046/E2 | 1733207100 | en | codeforces | # Cheops and a Contest (Hard Version)
## Problem Description
This is the hard version of the problem. The difference between the versions is that in this version, $ m $ is arbitrary. You can hack only if you solved all versions of this problem.
There is a problem-solving competition in Ancient Egypt with $ n $ parti... |
2046 | E1 | Cheops and a Contest (Easy Version) | ["constructive algorithms", "greedy"] | 2900 | https://codeforces.com/problemset/problem/2046/E1 | 1733207100 | en | codeforces | # Cheops and a Contest (Easy Version)
## Problem Description
This is the easy version of the problem. The difference between the versions is that in this version, $ m $ equals $ 2 $ . You can hack only if you solved all versions of this problem.
There is a problem-solving competition in Ancient Egypt with $ n $ part... |
2046 | D | For the Emperor! | ["flows", "graphs"] | 3100 | https://codeforces.com/problemset/problem/2046/D | 1733207100 | en | codeforces | # For the Emperor!
## Problem Description
In Ancient Rome, a plan to defeat the barbarians was developed, but for its implementation, each city must be informed about it.
The northern part of the Roman Empire consists of $ n $ cities connected by $ m $ one-way roads. Initially, the $ i $ -th city has $ a_i $ messeng... |
2046 | C | Adventurers | ["binary search", "data structures", "greedy", "sortings", "ternary search", "two pointers"] | 2100 | https://codeforces.com/problemset/problem/2046/C | 1733207100 | en | codeforces | # Adventurers
## Problem Description
Once, four Roman merchants met in a Roman mansion to discuss their trading plans. They faced the following problem: they traded the same type of goods, and if they traded in the same city, they would inevitably incur losses. They decided to divide up the cities between them where ... |
2046 | B | Move Back at a Cost | ["binary search", "data structures", "greedy", "sortings"] | 1600 | https://codeforces.com/problemset/problem/2046/B | 1733207100 | en | codeforces | # Move Back at a Cost
## Problem Description
You are given an array of integers $ a $ of length $ n $ . You can perform the following operation zero or more times:
- In one operation choose an index $ i $ ( $ 1 \le i \le n $ ), assign $ a_i := a_i + 1 $ , and then move $ a_i $ to the back of the array (to the rightm... |
2046 | A | Swap Columns and Find a Path | ["greedy", "sortings"] | 1200 | https://codeforces.com/problemset/problem/2046/A | 1733207100 | en | codeforces | # Swap Columns and Find a Path
## Problem Description
There is a matrix 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. Let's denote the cell on the intersection of the $ i $ -th row and the $ j ... |
2045 | M | Mirror Maze | ["brute force", "dfs and similar", "graphs", "implementation"] | 1800 | https://codeforces.com/problemset/problem/2045/M | 1733029500 | en | codeforces | # Mirror Maze
## Problem Description
You are given a grid of $ R $ rows (numbered from $ 1 $ to $ R $ from north to south) and $ C $ columns (numbered from $ 1 $ to $ C $ from west to east). Every cell in this grid is a square of the same size. The cell located at row $ r $ and column $ c $ is denoted as $ (r, c) $ .... |
2045 | L | Buggy DFS | ["constructive algorithms"] | 3000 | https://codeforces.com/problemset/problem/2045/L | 1733029500 | en | codeforces | # Buggy DFS
## Problem Description
You are currently studying a graph traversal algorithm called the Depth First Search (DFS). However, due to a bug, your algorithm is slightly different from the standard DFS. The following is an algorithm for your Buggy DFS (BDFS), assuming the graph has $ N $ nodes (numbered from $... |
2045 | K | GCDDCG | [] | 2900 | https://codeforces.com/problemset/problem/2045/K | 1733029500 | en | codeforces | # GCDDCG
## Problem Description
You are playing the Greatest Common Divisor Deck-Building Card Game (GCDDCG). There are $ N $ cards (numbered from $ 1 $ to $ N $ ). Card $ i $ has the value of $ A_i $ , which is an integer between $ 1 $ and $ N $ (inclusive).
The game consists of $ N $ rounds (numbered from $ 1 $ to... |
2045 | J | Xorderable Array | ["bitmasks", "data structures"] | 2600 | https://codeforces.com/problemset/problem/2045/J | 1733029500 | en | codeforces | # Xorderable Array
## Problem Description
You are given an array $ A $ of $ N $ integers: $ [A_1, A_2, \dots, A_N] $ .
The array $ A $ is $ (p, q) $ -xorderable if it is possible to rearrange $ A $ such that for each pair $ (i, j) $ that satisfies $ 1 \leq i < j \leq N $ , the following conditions must be satisfied... |
2045 | I | Microwavable Subsequence | ["data structures"] | 2100 | https://codeforces.com/problemset/problem/2045/I | 1733029500 | en | codeforces | # Microwavable Subsequence
## Problem Description
You are given an array of $ N $ integers: $ [A_1, A_2, \dots, A_N] $ .
A subsequence can be derived from an array by removing zero or more elements without changing the order of the remaining elements. For example, $ [2, 1, 2] $ , $ [3, 3] $ , $ [1] $ , and $ [3, 2, ... |
2045 | H | Missing Separators | ["dp", "sortings", "string suffix structures", "strings"] | 2200 | https://codeforces.com/problemset/problem/2045/H | 1733029500 | en | codeforces | # Missing Separators
## Problem Description
You have a dictionary, which is a list of distinct words sorted in alphabetical order. Each word consists of uppercase English letters.
You want to print this dictionary. However, there is a bug with the printing system, and all words in the list are printed next to each o... |
2045 | G | X Aura | ["graphs", "math", "shortest paths"] | 2200 | https://codeforces.com/problemset/problem/2045/G | 1733029500 | en | codeforces | # X Aura
## Problem Description
Mount ICPC can be represented as a grid of $ R $ rows (numbered from $ 1 $ to $ R $ ) and $ C $ columns (numbered from $ 1 $ to $ C $ ). The cell located at row $ r $ and column $ c $ is denoted as $ (r, c) $ and has a height of $ H_{r, c} $ . Two cells are adjacent to each other if th... |
2045 | F | Grid Game 3-angle | ["games", "math"] | 3000 | https://codeforces.com/problemset/problem/2045/F | 1733029500 | en | codeforces | # Grid Game 3-angle
## Problem Description
Your friends, Anda and Kamu decide to play a game called Grid Game and ask you to become the gamemaster. As the gamemaster, you set up a triangular grid of size $ N $ . The grid has $ N $ rows (numbered from $ 1 $ to $ N $ ). Row $ r $ has $ r $ cells; the $ c $ -th cell of ... |
2045 | E | Narrower Passageway | ["combinatorics", "data structures"] | 2700 | https://codeforces.com/problemset/problem/2045/E | 1733029500 | en | codeforces | # Narrower Passageway
## Problem Description
You are a strategist of The ICPC Kingdom. You received an intel that there will be monster attacks on a narrow passageway near the kingdom. The narrow passageway can be represented as a grid with $ 2 $ rows (numbered from $ 1 $ to $ 2 $ ) and $ N $ columns (numbered from $... |
2045 | D | Aquatic Dragon | [] | 3500 | https://codeforces.com/problemset/problem/2045/D | 1733029500 | en | codeforces | # Aquatic Dragon
## Problem Description
You live in an archipelago consisting of $ N $ islands (numbered from $ 1 $ to $ N $ ) laid out in a single line. Island $ i $ is adjacent to island $ i+1 $ , for $ 1 \leq i < N $ . Between adjacent islands $ i $ and $ i+1 $ , there is a pair of one-directional underwater tunne... |
2045 | C | Saraga | ["greedy", "strings"] | 1400 | https://codeforces.com/problemset/problem/2045/C | 1733029500 | en | codeforces | # Saraga
## Problem Description
The word saraga is an abbreviation of sarana olahraga, an Indonesian term for a sports facility. It is created by taking the prefix sara of the word sarana and the suffix ga of the word olahraga. Interestingly, it can also be created by the prefix sa of the word sarana and the suffix r... |
2045 | B | ICPC Square | ["math", "number theory"] | 2000 | https://codeforces.com/problemset/problem/2045/B | 1733029500 | en | codeforces | # ICPC Square
## Problem Description
ICPC Square is a hotel provided by the ICPC Committee for the accommodation of the participants. It consists of $ N $ floors (numbered from $ 1 $ to $ N $ ). This hotel has a very unique elevator. If a person is currently at floor $ x $ , by riding the elevator once, they can go t... |
2045 | A | Scrambled Scrabble | ["brute force", "greedy"] | 1700 | https://codeforces.com/problemset/problem/2045/A | 1733029500 | en | codeforces | # Scrambled Scrabble
## Problem Description
You are playing a word game using a standard set of $ 26 $ uppercase English letters: A โ Z. In this game, you can form vowels and consonants as follows.
- The letters A, E, I, O, and U can only form a vowel.
- The letter Y can form either a vowel or a consonant.
- Each of... |
2044 | H | Hard Demon Problem | ["constructive algorithms", "data structures", "dp", "implementation", "math"] | 2100 | https://codeforces.com/problemset/problem/2044/H | 1734273300 | en | codeforces | # Hard Demon Problem
## Problem Description
Swing is opening a pancake factory! A good pancake factory must be good at flattening things, so Swing is going to test his new equipment on 2D matrices.
Swing is given an $ n \times n $ matrix $ M $ containing positive integers. He has $ q $ queries to ask you.
For each ... |
2044 | G2 | Medium Demon Problem (hard version) | ["dfs and similar", "dp", "dsu", "graphs", "implementation", "trees"] | 1900 | https://codeforces.com/problemset/problem/2044/G2 | 1734273300 | en | codeforces | # Medium Demon Problem (hard version)
## Problem Description
This is the hard version of the problem. The key difference between the two versions is highlighted in bold.
A group of $ n $ spiders has come together to exchange plushies. Initially, each spider has $ 1 $ plushie. Every year, if spider $ i $ has at least... |
2044 | G1 | Medium Demon Problem (easy version) | ["dfs and similar", "graph matchings", "graphs", "implementation", "trees"] | 1700 | https://codeforces.com/problemset/problem/2044/G1 | 1734273300 | en | codeforces | # Medium Demon Problem (easy version)
## Problem Description
This is the easy version of the problem. The key difference between the two versions is highlighted in bold.
A group of $ n $ spiders has come together to exchange plushies. Initially, each spider has $ 1 $ plushie. Every year, if spider $ i $ has at least... |
2044 | F | Easy Demon Problem | ["binary search", "brute force", "data structures", "math", "number theory"] | 1900 | https://codeforces.com/problemset/problem/2044/F | 1734273300 | en | codeforces | # Easy Demon Problem
## Problem Description
For an arbitrary grid, Robot defines its beauty to be the sum of elements in the grid.
Robot gives you an array $ a $ of length $ n $ and an array $ b $ of length $ m $ . You construct a $ n $ by $ m $ grid $ M $ such that $ M_{i,j}=a_i\cdot b_j $ for all $ 1 \leq i \leq n... |
2044 | E | Insane Problem | ["binary search", "greedy", "implementation", "math", "number theory"] | 1300 | https://codeforces.com/problemset/problem/2044/E | 1734273300 | en | codeforces | # Insane Problem
## Problem Description
Wave is given five integers $ k $ , $ l_1 $ , $ r_1 $ , $ l_2 $ , and $ r_2 $ . Wave wants you to help her count the number of ordered pairs $ (x, y) $ such that all of the following are satisfied:
- $ l_1 \leq x \leq r_1 $ .
- $ l_2 \leq y \leq r_2 $ .
- There exists a non-ne... |
2044 | D | Harder Problem | ["constructive algorithms", "greedy", "math"] | 1100 | https://codeforces.com/problemset/problem/2044/D | 1734273300 | en | codeforces | # Harder Problem
## Problem Description
Given a sequence of positive integers, a positive integer is called a mode of the sequence if it occurs the maximum number of times that any positive integer occurs. For example, the mode of $ [2,2,3] $ is $ 2 $ . Any of $ 9 $ , $ 8 $ , or $ 7 $ can be considered to be a mode o... |
2044 | C | Hard Problem | ["greedy", "math"] | 800 | https://codeforces.com/problemset/problem/2044/C | 1734273300 | en | codeforces | # Hard Problem
## Problem Description
Ball is the teacher in Paperfold University. The seats of his classroom are arranged in $ 2 $ rows with $ m $ seats each.
Ball is teaching $ a + b + c $ monkeys, and he wants to assign as many monkeys to a seat as possible. Ball knows that $ a $ of them only want to sit in row $... |
2044 | B | Normal Problem | ["implementation", "strings"] | 800 | https://codeforces.com/problemset/problem/2044/B | 1734273300 | en | codeforces | # Normal Problem
## Problem Description
A string consisting of only characters 'p', 'q', and 'w' is painted on a glass window of a store. Ship walks past the store, standing directly in front of the glass window, and observes string $ a $ . Ship then heads inside the store, looks directly at the same glass window, an... |
2044 | A | Easy Problem | ["brute force", "math"] | 800 | https://codeforces.com/problemset/problem/2044/A | 1734273300 | en | codeforces | # Easy Problem
## Problem Description
Cube is given an integer $ n $ . She wants to know how many ordered pairs of positive integers $ (a,b) $ there are such that $ a=n-b $ . Since Cube is not very good at math, please help her!
## Input Format
The first line contains an integer $ t $ ( $ 1 \leq t \leq 99 $ ) โ the... |
2043 | G | Problem with Queries | ["brute force", "data structures", "implementation"] | https://codeforces.com/problemset/problem/2043/G | 1735050900 | en | codeforces | # Problem with Queries
## Problem Description
You are given an array $ a $ , consisting of $ n $ integers. Your task is to process $ q $ queries of two types:
- $ 1~p~x $ โ set the value of the element at index $ p $ equal to $ x $ ;
- $ 2~l~r $ โ count the number of pairs of indices $ (i, j) $ such that $ l \le i <... | |
2043 | F | Nim | ["bitmasks", "brute force", "combinatorics", "dp", "games", "greedy", "implementation", "shortest paths"] | https://codeforces.com/problemset/problem/2043/F | 1735050900 | en | codeforces | # Nim
## Problem Description
Recall the rules of the game "Nim". There are $ n $ piles of stones, where the $ i $ -th pile initially contains some number of stones. Two players take turns choosing a non-empty pile and removing any positive (strictly greater than $ 0 $ ) number of stones from it. The player unable to ... | |
2043 | E | Matrix Transformation | ["bitmasks", "brute force", "data structures", "dfs and similar", "graphs", "greedy", "implementation"] | https://codeforces.com/problemset/problem/2043/E | 1735050900 | en | codeforces | # Matrix Transformation
## Problem Description
You are given two matrices $ A $ and $ B $ of size $ n \times m $ , filled with integers between $ 0 $ and $ 10^9 $ . You can perform the following operations on matrix $ A $ in any order and any number of times:
- &=: choose two integers $ i $ and $ x $ ( $ 1 \le ... | |
2043 | D | Problem about GCD | ["brute force", "flows", "math", "number theory"] | https://codeforces.com/problemset/problem/2043/D | 1735050900 | en | codeforces | # Problem about GCD
## Problem Description
Given three integers $ l $ , $ r $ , and $ G $ , find two integers $ A $ and $ B $ ( $ l \le A \le B \le r $ ) such that their greatest common divisor (GCD) equals $ G $ and the distance $ |A - B| $ is maximized.
If there are multiple such pairs, choose the one where $ A $ ... | |
2043 | C | Sums on Segments | ["binary search", "brute force", "data structures", "dp", "greedy", "math"] | https://codeforces.com/problemset/problem/2043/C | 1735050900 | en | codeforces | # Sums on Segments
## Problem Description
You are given an array $ a $ of $ n $ integers, where all elements except for at most one are equal to $ -1 $ or $ 1 $ . The remaining element $ x $ satisfies $ -10^9 \le x \le 10^9 $ .
Find all possible sums of subarrays of $ a $ , including the empty subarray, whose sum is... | |
2043 | B | Digits | ["math", "number theory"] | https://codeforces.com/problemset/problem/2043/B | 1735050900 | en | codeforces | # Digits
## Problem Description
Artem wrote the digit $ d $ on the board exactly $ n! $ times in a row. So, he got the number $ dddddd \dots ddd $ (exactly $ n! $ digits).
Now he is curious about which odd digits from $ 1 $ to $ 9 $ divide the number written on the board.
## Input Format
The first line contains a ... | |
2043 | A | Coin Transformation | ["brute force", "math"] | https://codeforces.com/problemset/problem/2043/A | 1735050900 | en | codeforces | # Coin Transformation
## Problem Description
Initially, you have a coin with value $ n $ . You can perform the following operation any number of times (possibly zero):
- transform one coin with value $ x $ , where $ x $ is greater than $ 3 $ ( $ x>3 $ ), into two coins with value $ \lfloor \frac{x}{4} \rfloor $ .
... | |
2042 | F | Two Subarrays | ["data structures", "dp", "implementation", "matrices"] | 2600 | https://codeforces.com/problemset/problem/2042/F | 1733150100 | en | codeforces | # Two Subarrays
## Problem Description
You are given two integer arrays $ a $ and $ b $ , both of size $ n $ .
Let's define the cost of the subarray $ [l, r] $ as $ a_l + a_{l + 1} + \cdots + a_{r - 1} + a_r + b_l + b_r $ . If $ l=r $ , then the cost of the subarray is $ a_l + 2 \cdot b_l $ .
You have to perform qu... |
2042 | E | Vertex Pairs | ["binary search", "brute force", "data structures", "dfs and similar", "divide and conquer", "greedy", "implementation", "trees"] | 2900 | https://codeforces.com/problemset/problem/2042/E | 1733150100 | en | codeforces | # Vertex Pairs
## Problem Description
You are given a tree consisting of $ 2n $ vertices. Recall that a tree is a connected undirected graph with no cycles. Each vertex has an integer from $ 1 $ to $ n $ written on it. Each value from $ 1 $ to $ n $ is written on exactly two different vertices. Each vertex also has a... |
2042 | D | Recommendations | ["data structures", "implementation", "sortings", "two pointers"] | 1900 | https://codeforces.com/problemset/problem/2042/D | 1733150100 | en | codeforces | # Recommendations
## Problem Description
Suppose you are working in some audio streaming service. The service has $ n $ active users and $ 10^9 $ tracks users can listen to. Users can like tracks and, based on likes, the service should recommend them new tracks.
Tracks are numbered from $ 1 $ to $ 10^9 $ . It turned... |
2042 | C | Competitive Fishing | ["greedy"] | 1800 | https://codeforces.com/problemset/problem/2042/C | 1733150100 | en | codeforces | # Competitive Fishing
## Problem Description
Alice and Bob participate in a fishing contest! In total, they caught $ n $ fishes, numbered from $ 1 $ to $ n $ (the bigger the fish, the greater its index). Some of these fishes were caught by Alice, others โ by Bob.
Their performance will be evaluated as follows. First... |
2042 | B | Game with Colored Marbles | ["games", "greedy"] | 900 | https://codeforces.com/problemset/problem/2042/B | 1733150100 | en | codeforces | # Game with Colored Marbles
## Problem Description
Alice and Bob play a game. There are $ n $ marbles, the $ i $ -th of them has color $ c_i $ . The players take turns; Alice goes first, then Bob, then Alice again, then Bob again, and so on.
During their turn, a player must take one of the remaining marbles and remo... |
2042 | A | Greedy Monocarp | ["greedy", "sortings"] | 800 | https://codeforces.com/problemset/problem/2042/A | 1733150100 | en | codeforces | # Greedy Monocarp
## Problem Description
There are $ n $ chests; the $ i $ -th chest initially contains $ a_i $ coins. For each chest, you can choose any non-negative ( $ 0 $ or greater) number of coins to add to that chest, with one constraint: the total number of coins in all chests must become at least $ k $ .
Af... |
2041 | N | Railway Construction | [] | 3300 | https://codeforces.com/problemset/problem/2041/N | 1732431900 | en | codeforces | # Railway Construction
## Problem Description
The country of Truckski is located in a rugged, mountainous region, and the geological condition has engendered a wide range of issues. The challenging terrain separates the different states in the country, resulting in an extremely inconvenient inter-state commute and mo... |
2041 | M | Selection Sort | ["binary search", "data structures", "greedy", "two pointers"] | 2000 | https://codeforces.com/problemset/problem/2041/M | 1732431900 | en | codeforces | # Selection Sort
## Problem Description
Every student enrolled in the algorithms course is required to submit an assignment this week. The task is to implement an $ O(n^2) $ -time algorithm to sort $ n $ given integers... |
2041 | L | Building Castle | [] | 2900 | https://codeforces.com/problemset/problem/2041/L | 1732431900 | en | codeforces | # Building Castle
## Problem Description
A-Ju has a gorgeous castle in which she often enjoys living. However, she gets tired of living in the castle for a long time. Thus, she decides to rebuild her castle into some specific shape to make her it more beautiful.
Let's say we represent A-Ju's castle as a 2D convex po... |
2041 | K | Trophic Balance Species | ["binary search", "brute force", "dfs and similar", "graphs"] | 3100 | https://codeforces.com/problemset/problem/2041/K | 1732431900 | en | codeforces | # Trophic Balance Species
## Problem Description
 Image generated by ChatGPT 4o.In an interdisciplinary collaboration, an ecosystem scientist and a computer scientist join forces to analyze the structure of a complex e... |
2041 | J | Bottle Arrangement | ["data structures", "divide and conquer", "dp", "dsu", "greedy"] | 2700 | https://codeforces.com/problemset/problem/2041/J | 1732431900 | en | codeforces | # Bottle Arrangement
## Problem Description
 Image generated by ChatGPT 4o.Mayaw works in a renowned Epah (aboriginal Taiwanese millet wine; Epah is the Pangcah term for aboriginal Taiwanese millet wine, named in the l... |
2041 | I | Auto Complete | ["binary search", "data structures", "hashing", "implementation", "sortings", "strings", "trees"] | 2300 | https://codeforces.com/problemset/problem/2041/I | 1732431900 | en | codeforces | # Auto Complete
## Problem Description
You are designing a snazzy new text editor, and you want to add a nifty auto-complete feature to help users save time. Here is how it will work: if a user types "App", your editor... |
2041 | H | Sheet Music | ["combinatorics", "dp", "math"] | 2300 | https://codeforces.com/problemset/problem/2041/H | 1732431900 | en | codeforces | # Sheet Music
## Problem Description
 Image generated by ChatGPT 4o.Alice likes singing. As a singing enthusiast, Alice has listened to countless songs and has tried singing them many times. However, occasionally, some... |
2041 | G | Grid Game | [] | 3100 | https://codeforces.com/problemset/problem/2041/G | 1732431900 | en | codeforces | # Grid Game
## Problem Description
Claire loves drawing lines. She receives a sheet of paper with an $ n \times n $ grid and begins drawing "lines" on it. Wellโthe concept of a "line" here is not what we usually think of. Claire refers each line to be a set of consecutive vertical grid cells. When she draws a line, t... |
2041 | F | Segmentation Folds | ["brute force", "dfs and similar", "number theory"] | 2400 | https://codeforces.com/problemset/problem/2041/F | 1732431900 | en | codeforces | # Segmentation Folds
## Problem Description
Peter loves folding segments. There is a segment on a number line occupying the interval $ [\ell, r] $ . Since it is the prime time for folding the segments, Peter decides to fold the segment carefully. In each step, he chooses one of the two following operations whenever p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.