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 |
|---|---|---|---|---|---|---|---|---|---|
2029 | D | Cool Graph | ["constructive algorithms", "data structures", "dfs and similar", "dsu", "graphs", "greedy", "trees"] | 1900 | https://codeforces.com/problemset/problem/2029/D | 1731162900 | en | codeforces | # Cool Graph
## Problem Description
You are given an undirected graph with $ n $ vertices and $ m $ edges.
You can perform the following operation at most $ 2\cdot \max(n,m) $ times:
- Choose three distinct vertices $ a $ , $ b $ , and $ c $ , then for each of the edges $ (a,b) $ , $ (b,c) $ , and $ (c,a) $ , do th... |
2029 | C | New Rating | ["binary search", "data structures", "dp", "greedy"] | 1700 | https://codeforces.com/problemset/problem/2029/C | 1731162900 | en | codeforces | # New Rating
## Problem Description
Hello, Codeforces Forcescode!
Kevin used to be a participant of Codeforces. Recently, the KDOI Team has developed a new Online Judge called Forcescode.
Kevin has participated in $ n $ contests on Forcescode. In the $ i $ -th contest, his performance rating is $ a_i $ .
Now h... |
2029 | B | Replacement | ["constructive algorithms", "games", "strings"] | 1100 | https://codeforces.com/problemset/problem/2029/B | 1731162900 | en | codeforces | # Replacement
## Problem Description
You have a binary string $ ^{\text{โ}} $ $ s $ of length $ n $ , and Iris gives you another binary string $ r $ of length $ n-1 $ .
Iris is going to play a game with you. During the game, you will perform $ n-1 $ operations on $ s $ . In the $ i $ -th operation ( $ 1 \le i \le n-... |
2029 | A | Set | ["greedy", "math"] | 800 | https://codeforces.com/problemset/problem/2029/A | 1731162900 | en | codeforces | # Set
## Problem Description
You are given a positive integer $ k $ and a set $ S $ of all integers from $ l $ to $ r $ (inclusive).
You can perform the following two-step operation any number of times (possibly zero):
1. First, choose a number $ x $ from the set $ S $ , such that there are at least $ k $ multiples... |
2028 | F | Alice's Adventures in Addition | ["bitmasks", "brute force", "dp", "implementation"] | 2700 | https://codeforces.com/problemset/problem/2028/F | 1731252900 | en | codeforces | # Alice's Adventures in Addition
## Problem Description
Note that the memory limit is unusual.
The Cheshire Cat has a riddle for Alice: given $ n $ integers $ a_1, a_2, \ldots, a_n $ and a target $ m $ , is there a way to insert $ + $ and $ \times $ into the circles of the expression $ $$$a_1 \circ a_2 \circ \cdots ... |
2028 | E | Alice's Adventures in the Rabbit Hole | ["combinatorics", "dfs and similar", "dp", "games", "greedy", "math", "probabilities", "trees"] | 2300 | https://codeforces.com/problemset/problem/2028/E | 1731252900 | en | codeforces | # Alice's Adventures in the Rabbit Hole
## Problem Description
Alice is at the bottom of the rabbit hole! The rabbit hole can be modeled as a tree $ ^{\text{โ}} $ which has an exit at vertex $ 1 $ , and Alice starts at some vertex $ v $ . She wants to get out of the hole, but unfortunately, the Queen of Hearts has or... |
2028 | D | Alice's Adventures in Cards | ["constructive algorithms", "data structures", "dp", "graphs", "greedy", "implementation", "ternary search"] | 2000 | https://codeforces.com/problemset/problem/2028/D | 1731252900 | en | codeforces | # Alice's Adventures in Cards
## Problem Description
Alice is playing cards with the Queen of Hearts, King of Hearts, and Jack of Hearts. There are $ n $ different types of cards in their card game. Alice currently has a card of type $ 1 $ and needs a card of type $ n $ to escape Wonderland. The other players have on... |
2028 | C | Alice's Adventures in Cutting Cake | ["binary search", "dp", "greedy", "two pointers"] | 1600 | https://codeforces.com/problemset/problem/2028/C | 1731252900 | en | codeforces | # Alice's Adventures in Cutting Cake
## Problem Description
Alice is at the Mad Hatter's tea party! There is a long sheet cake made up of $ n $ sections with tastiness values $ a_1, a_2, \ldots, a_n $ . There are $ m $ creatures at the tea party, excluding Alice.
Alice will cut the cake into $ m + 1 $ pieces. Formal... |
2028 | B | Alice's Adventures in Permuting | ["binary search", "implementation", "math"] | 1400 | https://codeforces.com/problemset/problem/2028/B | 1731252900 | en | codeforces | # Alice's Adventures in Permuting
## Problem Description
Alice mixed up the words transmutation and permutation! She has an array $ a $ specified via three integers $ n $ , $ b $ , $ c $ : the array $ a $ has length $ n $ and is given via $ a_i = b\cdot (i - 1) + c $ for $ 1\le i\le n $ . For example, if $ n=3 $ , $ ... |
2028 | A | Alice's Adventures in ''Chess'' | ["brute force", "implementation", "math"] | 900 | https://codeforces.com/problemset/problem/2028/A | 1731252900 | en | codeforces | # Alice's Adventures in "Chess"
## Problem Description
Alice is trying to meet up with the Red Queen in the countryside! Right now, Alice is at position $ (0, 0) $ , and the Red Queen is at position $ (a, b) $ . Alice can only move in the four cardinal directions (north, east, south, west).
More formally, if Alice i... |
2027 | E2 | Bit Game (Hard Version) | ["bitmasks", "dp", "math"] | 3100 | https://codeforces.com/problemset/problem/2027/E2 | 1729953300 | en | codeforces | # Bit Game (Hard Version)
## Problem Description
This is the hard version of this problem. The only difference is that you need to output the number of choices of games where Bob wins in this version, where the number of stones in each pile are not fixed. You must solve both versions to be able to hack.
Alice and Bo... |
2027 | E1 | Bit Game (Easy Version) | ["bitmasks", "brute force", "games", "math"] | 2800 | https://codeforces.com/problemset/problem/2027/E1 | 1729953300 | en | codeforces | # Bit Game (Easy Version)
## Problem Description
This is the easy version of this problem. The only difference is that you need to output the winner of the game in this version, and the number of stones in each pile are fixed. You must solve both versions to be able to hack.
Alice and Bob are playing a familiar game... |
2027 | D2 | The Endspeaker (Hard Version) | ["binary search", "data structures", "dp", "greedy", "implementation", "two pointers"] | 2200 | https://codeforces.com/problemset/problem/2027/D2 | 1729953300 | en | codeforces | # The Endspeaker (Hard Version)
## Problem Description
This is the hard version of this problem. The only difference is that you need to also output the number of optimal sequences in this version. You must solve both versions to be able to hack.
You're given an array $ a $ of length $ n $ , and an array $ b $ of le... |
2027 | D1 | The Endspeaker (Easy Version) | ["binary search", "dp", "graphs", "greedy", "implementation", "two pointers"] | 1700 | https://codeforces.com/problemset/problem/2027/D1 | 1729953300 | en | codeforces | # The Endspeaker (Easy Version)
## Problem Description
This is the easy version of this problem. The only difference is that you only need to output the minimum total cost of operations in this version. You must solve both versions to be able to hack.
You're given an array $ a $ of length $ n $ , and an array $ b $ ... |
2027 | C | Add Zeros | ["brute force", "data structures", "dfs and similar", "dp", "graphs", "greedy"] | 1500 | https://codeforces.com/problemset/problem/2027/C | 1729953300 | en | codeforces | # Add Zeros
## Problem Description
You're given an array $ a $ initially containing $ n $ integers. In one operation, you must do the following:
- Choose a position $ i $ such that $ 1 < i \le |a| $ and $ a_i = |a| + 1 - i $ , where $ |a| $ is the current size of the array.
- Append $ i - 1 $ zeros onto the end of $... |
2027 | B | Stalin Sort | ["brute force", "greedy"] | 1100 | https://codeforces.com/problemset/problem/2027/B | 1729953300 | en | codeforces | # Stalin Sort
## Problem Description
Stalin Sort is a humorous sorting algorithm designed to eliminate elements which are out of place instead of bothering to sort them properly, lending itself to an $ \mathcal{O}(n) $ time complexity.
It goes as follows: starting from the second element in the array, if it is stric... |
2027 | A | Rectangle Arrangement | ["geometry", "implementation", "math"] | 800 | https://codeforces.com/problemset/problem/2027/A | 1729953300 | en | codeforces | # Rectangle Arrangement
## Problem Description
You are coloring an infinite square grid, in which all cells are initially white. To do this, you are given $ n $ stamps. Each stamp is a rectangle of width $ w_i $ and height $ h_i $ .
You will use each stamp exactly once to color a rectangle of the same size as the st... |
2026 | F | Bermart Ice Cream | ["data structures", "dfs and similar", "divide and conquer", "dp", "implementation", "trees"] | 2700 | https://codeforces.com/problemset/problem/2026/F | 1730126100 | en | codeforces | # Bermart Ice Cream
## Problem Description
In the Bermart chain of stores, a variety of ice cream is sold. Each type of ice cream has two parameters: price and tastiness.
Initially, there is one store numbered $ 1 $ , which sells nothing. You have to process $ q $ queries of the following types:
- $ 1~x $ โ a new s... |
2026 | E | Best Subsequence | ["bitmasks", "dfs and similar", "flows", "graph matchings", "graphs"] | 2500 | https://codeforces.com/problemset/problem/2026/E | 1730126100 | en | codeforces | # Best Subsequence
## Problem Description
Given an integer array $ a $ of size $ n $ .
Let's define the value of the array as its size minus the number of set bits in the bitwise OR of all elements of the array.
For example, for the array $ [1, 0, 1, 2] $ , the bitwise OR is $ 3 $ (which contains $ 2 $ set bits), a... |
2026 | D | Sums of Segments | ["binary search", "data structures", "dp", "implementation", "math"] | 1900 | https://codeforces.com/problemset/problem/2026/D | 1730126100 | en | codeforces | # Sums of Segments
## Problem Description
You are given a sequence of integers $ [a_1, a_2, \dots, a_n] $ . Let $ s(l,r) $ be the sum of elements from $ a_l $ to $ a_r $ (i. e. $ s(l,r) = \sum\limits_{i=l}^{r} a_i $ ).
Let's construct another sequence $ b $ of size $ \frac{n(n+1)}{2} $ as follows: $ b = [s(1,1), s(1... |
2026 | C | Action Figures | ["binary search", "brute force", "constructive algorithms", "data structures", "greedy", "implementation"] | 1500 | https://codeforces.com/problemset/problem/2026/C | 1730126100 | en | codeforces | # Action Figures
## Problem Description
There is a shop that sells action figures near Monocarp's house. A new set of action figures will be released shortly; this set contains $ n $ figures, the $ i $ -th figure costs $ i $ coins and is available for purchase from day $ i $ to day $ n $ .
For each of the $ n $ days... |
2026 | B | Black Cells | ["binary search", "brute force", "constructive algorithms", "greedy"] | 1300 | https://codeforces.com/problemset/problem/2026/B | 1730126100 | en | codeforces | # Black Cells
## Problem Description
You are given a strip divided into cells, numbered from left to right from $ 0 $ to $ 10^{18} $ . Initially, all cells are white.
You can perform the following operation: choose two white cells $ i $ and $ j $ , such that $ i \ne j $ and $ |i - j| \le k $ , and paint them black.
... |
2026 | A | Perpendicular Segments | ["constructive algorithms", "geometry", "greedy", "math"] | 900 | https://codeforces.com/problemset/problem/2026/A | 1730126100 | en | codeforces | # Perpendicular Segments
## Problem Description
You are given a coordinate plane and three integers $ X $ , $ Y $ , and $ K $ . Find two line segments $ AB $ and $ CD $ such that
1. the coordinates of points $ A $ , $ B $ , $ C $ , and $ D $ are integers;
2. $ 0 \le A_x, B_x, C_x, D_x \le X $ and $ 0 \le A_y, B_y, C... |
2025 | G | Variable Damage | ["data structures", "flows"] | 3000 | https://codeforces.com/problemset/problem/2025/G | 1728916500 | en | codeforces | # Variable Damage
## Problem Description
Monocarp is gathering an army to fight a dragon in a videogame.
The army consists of two parts: the heroes and the defensive artifacts. Each hero has one parameter โ his health. Each defensive artifact also has one parameter โ its durability.
Before the battle begins, Monoca... |
2025 | F | Choose Your Queries | ["constructive algorithms", "dfs and similar", "dp", "graphs", "greedy", "trees"] | 2700 | https://codeforces.com/problemset/problem/2025/F | 1728916500 | en | codeforces | # Choose Your Queries
## Problem Description
You are given an array $ a $ , consisting of $ n $ integers (numbered from $ 1 $ to $ n $ ). Initially, they are all zeroes.
You have to process $ q $ queries. The $ i $ -th query consists of two different integers $ x_i $ and $ y_i $ . During the $ i $ -th query, you hav... |
2025 | E | Card Game | ["combinatorics", "dp", "fft", "greedy", "math"] | 2200 | https://codeforces.com/problemset/problem/2025/E | 1728916500 | en | codeforces | # Card Game
## Problem Description
In the most popular card game in Berland, a deck of $ n \times m $ cards is used. Each card has two parameters: suit and rank. Suits in the game are numbered from $ 1 $ to $ n $ , and ranks are numbered from $ 1 $ to $ m $ . There is exactly one card in the deck for each combination... |
2025 | D | Attribute Checks | ["brute force", "data structures", "dp", "implementation", "math", "two pointers"] | 1800 | https://codeforces.com/problemset/problem/2025/D | 1728916500 | en | codeforces | # Attribute Checks
## Problem Description
Imagine a game where you play as a character that has two attributes: "Strength" and "Intelligence", that are at zero level initially.
During the game, you'll acquire $ m $ attribute points that allow you to increase your attribute levels โ one point will increase one of the... |
2025 | C | New Game | ["binary search", "brute force", "greedy", "implementation", "sortings", "two pointers"] | 1300 | https://codeforces.com/problemset/problem/2025/C | 1728916500 | en | codeforces | # New Game
## Problem Description
There's a new game Monocarp wants to play. The game uses a deck of $ n $ cards, where the $ i $ -th card has exactly one integer $ a_i $ written on it.
At the beginning of the game, on the first turn, Monocarp can take any card from the deck. During each subsequent turn, Monocarp ca... |
2025 | B | Binomial Coefficients, Kind Of | ["combinatorics", "dp", "math"] | 1100 | https://codeforces.com/problemset/problem/2025/B | 1728916500 | en | codeforces | # Binomial Coefficients, Kind Of
## Problem Description
Recently, akshiM met a task that needed binomial coefficients to solve. He wrote a code he usually does that looked like this:
```
<pre class="verbatim"> for (int n = 0; n < N; n++) { // loop over n from 0 to N-1 (inclusive)<br></br> C[n][0] = 1;<br><... |
2025 | A | Two Screens | ["binary search", "greedy", "strings", "two pointers"] | 800 | https://codeforces.com/problemset/problem/2025/A | 1728916500 | en | codeforces | # Two Screens
## Problem Description
There are two screens which can display sequences of uppercase Latin letters. Initially, both screens display nothing.
In one second, you can do one of the following two actions:
- choose a screen and an uppercase Latin letter, and append that letter to the end of the sequence d... |
2024 | B | Buying Lemonade | ["binary search", "constructive algorithms", "sortings"] | 1100 | https://codeforces.com/problemset/problem/2024/B | 1729415100 | en | codeforces | # Buying Lemonade
## Problem Description
There is a vending machine that sells lemonade. The machine has a total of $ n $ slots. You know that initially, the $ i $ -th slot contains $ a_i $ cans of lemonade. There are also $ n $ buttons on the machine, each button corresponds to a slot, with exactly one button corres... |
2024 | A | Profitable Interest Rate | ["greedy", "math"] | 800 | https://codeforces.com/problemset/problem/2024/A | 1729415100 | en | codeforces | # Profitable Interest Rate
## Problem Description
Alice has $ a $ coins. She can open a bank deposit called "Profitable", but the minimum amount required to open this deposit is $ b $ coins.
There is also a deposit called "Unprofitable", which can be opened with any amount of coins. Alice noticed that if she opens t... |
2023 | F | Hills and Pits | ["data structures", "greedy", "math", "matrices"] | 3500 | https://codeforces.com/problemset/problem/2023/F | 1729415100 | en | codeforces | # Hills and Pits
## Problem Description
In a desert city with a hilly landscape, the city hall decided to level the road surface by purchasing a dump truck. The road is divided into $ n $ sections, numbered from $ 1 $ to $ n $ from left to right. The height of the surface in the $ i $ -th section is equal to $ a_i $ ... |
2023 | E | Tree of Life | ["dp", "greedy", "trees"] | 3300 | https://codeforces.com/problemset/problem/2023/E | 1729415100 | en | codeforces | # Tree of Life
## Problem Description
In the heart of an ancient kingdom grows the legendary Tree of Life โ the only one of its kind and the source of magical power for the entire world. The tree consists of $ n $ nodes. Each node of this tree is a magical source, connected to other such sources through magical chann... |
2023 | D | Many Games | ["brute force", "dp", "greedy", "math", "probabilities"] | 2900 | https://codeforces.com/problemset/problem/2023/D | 1729415100 | en | codeforces | # Many Games
## Problem Description
Recently, you received a rare ticket to the only casino in the world where you can actually earn something, and you want to take full advantage of this opportunity.
The conditions in this casino are as follows:
- There are a total of $ n $ games in the casino.
- You can play each... |
2023 | C | C+K+S | ["constructive algorithms", "dfs and similar", "graphs", "greedy", "hashing", "implementation", "strings"] | 2400 | https://codeforces.com/problemset/problem/2023/C | 1729415100 | en | codeforces | # C+K+S
## Problem Description
You are given two strongly connected $ ^{\dagger} $ directed graphs, each with exactly $ n $ vertices, but possibly different numbers of edges. Upon closer inspection, you noticed an important feature โ the length of any cycle in these graphs is divisible by $ k $ .
Each of the $ 2n $ ... |
2023 | B | Skipping | ["binary search", "dp", "graphs", "shortest paths"] | 1700 | https://codeforces.com/problemset/problem/2023/B | 1729415100 | en | codeforces | # Skipping
## Problem Description
It is already the year $ 3024 $ , ideas for problems have long run out, and the olympiad now takes place in a modified individual format. The olympiad consists of $ n $ problems, numbered from $ 1 $ to $ n $ . The $ i $ -th problem has its own score $ a_i $ and a certain parameter $ ... |
2023 | A | Concatenation of Arrays | ["constructive algorithms", "greedy", "math", "sortings"] | 1300 | https://codeforces.com/problemset/problem/2023/A | 1729415100 | en | codeforces | # Concatenation of Arrays
## Problem Description
You are given $ n $ arrays $ a_1 $ , $ \ldots $ , $ a_n $ . The length of each array is two. Thus, $ a_i = [a_{i, 1}, a_{i, 2}] $ . You need to concatenate the arrays into a single array of length $ 2n $ such that the number of inversions $ ^{\dagger} $ in the resultin... |
2022 | E2 | Billetes MX (Hard Version) | ["binary search", "combinatorics", "data structures", "dsu", "graphs"] | 2600 | https://codeforces.com/problemset/problem/2022/E2 | 1728848100 | en | codeforces | # Billetes MX (Hard Version)
## Problem Description
This is the hard version of the problem. In this version, it is guaranteed that $ q \leq 10^5 $ . You can make hacks only if both versions of the problem are solved.
An integer grid $ A $ with $ p $ rows and $ q $ columns is called beautiful if:
- All elements of ... |
2022 | E1 | Billetes MX (Easy Version) | ["2-sat", "binary search", "combinatorics", "constructive algorithms", "dfs and similar", "dsu", "graphs"] | 2500 | https://codeforces.com/problemset/problem/2022/E1 | 1728848100 | en | codeforces | # Billetes MX (Easy Version)
## Problem Description
This is the easy version of the problem. In this version, it is guaranteed that $ q = 0 $ . You can make hacks only if both versions of the problem are solved.
An integer grid $ A $ with $ p $ rows and $ q $ columns is called beautiful if:
- All elements of the gr... |
2022 | D2 | Asesino (Hard Version) | ["constructive algorithms", "dp", "interactive"] | 2700 | https://codeforces.com/problemset/problem/2022/D2 | 1728848100 | en | codeforces | # Asesino (Hard Version)
## Problem Description
This is the hard version of the problem. In this version, you must use the minimum number of queries possible. You can make hacks only if both versions of the problem are solved.
This is an interactive problem.
It is a tradition in Mexico's national IOI trainings to p... |
2022 | D1 | Asesino (Easy Version) | ["binary search", "brute force", "constructive algorithms", "implementation", "interactive"] | 1900 | https://codeforces.com/problemset/problem/2022/D1 | 1728848100 | en | codeforces | # Asesino (Easy Version)
## Problem Description
This is the easy version of the problem. In this version, you can ask at most $ n+69 $ questions. You can make hacks only if both versions of the problem are solved.
This is an interactive problem.
It is a tradition in Mexico's national IOI trainings to play the game ... |
2022 | C | Gerrymandering | ["dp", "implementation"] | 1800 | https://codeforces.com/problemset/problem/2022/C | 1728848100 | en | codeforces | # Gerrymandering
## Problem Description
We all steal a little bit. But I have only one hand, while my adversaries have two.
รlvaro Obregรณn
รlvaro and Josรฉ are the only candidates running for the presidency of Tepito, a rectangular grid of $ 2 $ rows and $ n $ columns, where each cell represents a house. It is gua... |
2022 | B | Kar Salesman | ["binary search", "greedy", "math"] | 1300 | https://codeforces.com/problemset/problem/2022/B | 1728848100 | en | codeforces | # Kar Salesman
## Problem Description
Karel is a salesman in a car dealership. The dealership has $ n $ different models of cars. There are $ a_i $ cars of the $ i $ -th model. Karel is an excellent salesperson and can convince customers to buy up to $ x $ cars (of Karel's choice), as long as the cars are from differ... |
2022 | A | Bus to Pรฉnjamo | ["constructive algorithms", "greedy", "implementation", "math"] | 800 | https://codeforces.com/problemset/problem/2022/A | 1728848100 | en | codeforces | # Bus to Pรฉnjamo
## Problem Description
Ya vamos llegando a Pรฉeeenjamoo โซโซโซ
There are $ n $ families travelling to Pรฉnjamo to witness Mexico's largest-ever "walking a chicken on a leash" marathon. The $ i $ -th family has $ a_i $ family members. All families will travel using a single bus consisting of $ r $ ro... |
2021 | E3 | Digital Village (Extreme Version) | ["data structures", "dfs and similar", "dp", "dsu", "graphs", "greedy", "math", "trees"] | 2800 | https://codeforces.com/problemset/problem/2021/E3 | 1728194700 | en | codeforces | # Digital Village (Extreme Version)
## Problem Description
This is the extreme version of the problem. In the three versions, the constraints on $ n $ and $ m $ are different. You can make hacks only if all the versions of the problem are solved.
Pak Chanek is setting up internet connections for the village of Khunt... |
2021 | E2 | Digital Village (Hard Version) | ["data structures", "dp", "dsu", "graphs", "math", "trees"] | 2500 | https://codeforces.com/problemset/problem/2021/E2 | 1728194700 | en | codeforces | # Digital Village (Hard Version)
## Problem Description
This is the hard version of the problem. In the three versions, the constraints on $ n $ and $ m $ are different. You can make hacks only if all the versions of the problem are solved.
Pak Chanek is setting up internet connections for the village of Khuntien. T... |
2021 | E1 | Digital Village (Easy Version) | ["brute force", "data structures", "dfs and similar", "dp", "dsu", "fft", "graphs", "greedy", "implementation", "math", "trees"] | 2300 | https://codeforces.com/problemset/problem/2021/E1 | 1728194700 | en | codeforces | # Digital Village (Easy Version)
## Problem Description
This is the easy version of the problem. In the three versions, the constraints on $ n $ and $ m $ are different. You can make hacks only if all the versions of the problem are solved.
Pak Chanek is setting up internet connections for the village of Khuntien. T... |
2021 | D | Boss, Thirsty | ["dp", "greedy", "implementation"] | 2500 | https://codeforces.com/problemset/problem/2021/D | 1728194700 | en | codeforces | # Boss, Thirsty
## Problem Description
Pak Chanek has a friend who runs a drink stall in a canteen. His friend will sell drinks for $ n $ days, numbered from day $ 1 $ to day $ n $ . There are also $ m $ types of drinks, numbered from $ 1 $ to $ m $ .
The profit gained from selling a drink on a particular day can va... |
2021 | C2 | Adjust The Presentation (Hard Version) | ["constructive algorithms", "data structures", "greedy", "implementation", "sortings"] | 1900 | https://codeforces.com/problemset/problem/2021/C2 | 1728194700 | en | codeforces | # Adjust The Presentation (Hard Version)
## Problem Description
This is the hard version of the problem. In the two versions, the constraints on $ q $ and the time limit are different. In this version, $ 0 \leq q \leq 2 \cdot 10^5 $ . You can make hacks only if all the versions of the problem are solved.
A team cons... |
2021 | C1 | Adjust The Presentation (Easy Version) | ["constructive algorithms", "greedy"] | 1300 | https://codeforces.com/problemset/problem/2021/C1 | 1728194700 | en | codeforces | # Adjust The Presentation (Easy Version)
## Problem Description
This is the easy version of the problem. In the two versions, the constraints on $ q $ and the time limit are different. In this version, $ q=0 $ . You can make hacks only if all the versions of the problem are solved.
A team consisting of $ n $ members... |
2021 | B | Maximize Mex | ["brute force", "greedy", "math", "number theory"] | 1200 | https://codeforces.com/problemset/problem/2021/B | 1728194700 | en | codeforces | # Maximize Mex
## Problem Description
You are given an array $ a $ of $ n $ positive integers and an integer $ x $ . You can do the following two-step operation any (possibly zero) number of times:
1. Choose an index $ i $ ( $ 1 \leq i \leq n $ ).
2. Increase $ a_i $ by $ x $ , in other words $ a_i := a_i + x $ .
F... |
2021 | A | Meaning Mean | ["data structures", "greedy", "math", "sortings"] | 800 | https://codeforces.com/problemset/problem/2021/A | 1728194700 | en | codeforces | # Meaning Mean
## Problem Description
Pak Chanek has an array $ a $ of $ n $ positive integers. Since he is currently learning how to calculate the floored average of two numbers, he wants to practice it on his array $ a $ .
While the array $ a $ has at least two elements, Pak Chanek will perform the following three... |
2020 | F | Count Leaves | ["dp", "math", "number theory"] | 2900 | https://codeforces.com/problemset/problem/2020/F | 1727624100 | en | codeforces | # Count Leaves
## Problem Description
Let $ n $ and $ d $ be positive integers. We build the the divisor tree $ T_{n,d} $ as follows:
- The root of the tree is a node marked with number $ n $ . This is the $ 0 $ -th layer of the tree.
- For each $ i $ from $ 0 $ to $ d - 1 $ , for each vertex of the $ i $ -th layer,... |
2020 | E | Expected Power | ["bitmasks", "dp", "math", "probabilities"] | 2000 | https://codeforces.com/problemset/problem/2020/E | 1727624100 | en | codeforces | # Expected Power
## Problem Description
You are given an array of $ n $ integers $ a_1,a_2,\ldots,a_n $ . You are also given an array $ p_1, p_2, \ldots, p_n $ .
Let $ S $ denote the random multiset (i. e., it may contain equal elements) constructed as follows:
- Initially, $ S $ is empty.
- For each $ i $ from $ 1... |
2020 | D | Connect the Dots | ["brute force", "dp", "dsu", "graphs", "math", "trees"] | 1800 | https://codeforces.com/problemset/problem/2020/D | 1727624100 | en | codeforces | # Connect the Dots
## Problem Description
One fine evening, Alice sat down to play the classic game "Connect the Dots", but with a twist.
To play the game, Alice draws a straight line and marks $ n $ points on it, indexed from $ 1 $ to $ n $ . Initially, there are no arcs between the points, so they are all disjoint... |
2020 | C | Bitwise Balancing | ["bitmasks", "hashing", "implementation", "math", "schedules", "ternary search"] | 1400 | https://codeforces.com/problemset/problem/2020/C | 1727624100 | en | codeforces | # Bitwise Balancing
## Problem Description
You are given three non-negative integers $ b $ , $ c $ , and $ d $ .
Please find a non-negative integer $ a \in [0, 2^{61}] $ such that $ (a\, |\, b)-(a\, \&\, c)=d $ , where $ | $ and $ \& $ denote the [bitwise OR operation](https://en.wikipedia.org/wiki/Bitwise_operation... |
2020 | B | Brightness Begins | ["binary search", "math"] | 1200 | https://codeforces.com/problemset/problem/2020/B | 1727624100 | en | codeforces | # Brightness Begins
## Problem Description
Imagine you have $ n $ light bulbs numbered $ 1, 2, \ldots, n $ . Initially, all bulbs are on. To flip the state of a bulb means to turn it off if it used to be on, and to turn it on otherwise.
Next, you do the following:
- for each $ i = 1, 2, \ldots, n $ , flip the state... |
2020 | A | Find Minimum Operations | ["bitmasks", "brute force", "greedy", "math", "number theory"] | 800 | https://codeforces.com/problemset/problem/2020/A | 1727624100 | en | codeforces | # Find Minimum Operations
## Problem Description
You are given two integers $ n $ and $ k $ .
In one operation, you can subtract any power of $ k $ from $ n $ . Formally, in one operation, you can replace $ n $ by $ (n-k^x) $ for any non-negative integer $ x $ .
Find the minimum number of operations required to mak... |
2019 | B | All Pairs Segments | ["implementation", "math"] | 1200 | https://codeforces.com/problemset/problem/2019/B | 1727444100 | en | codeforces | # All Pairs Segments
## Problem Description
[Shirobon - FOX](https://soundcloud.com/shirobon/fox?in=mart_207/sets/fav)
โ
You are given $ n $ points on the $ x $ axis, at increasing positive integer coordinates $ x_1 < x_2 < \ldots < x_n $ .
For each pair $ (i, j) $ with $ 1 \leq i < j \leq n $ , you draw the seg... |
2019 | A | Max Plus Size | ["brute force", "dp", "greedy"] | 800 | https://codeforces.com/problemset/problem/2019/A | 1727444100 | en | codeforces | # Max Plus Size
## Problem Description
[EnV - Dynasty](https://soundcloud.com/envyofficial/env-dynasty)
โ
You are given an array $ a_1, a_2, \ldots, a_n $ of positive integers.
You can color some elements of the array red, but there cannot be two adjacent red elements (i.e., for $ 1 \leq i \leq n-1 $ , at least ... |
2018 | F3 | Speedbreaker Counting (Hard Version) | ["dp", "greedy", "math"] | 3100 | https://codeforces.com/problemset/problem/2018/F3 | 1727444100 | en | codeforces | # Speedbreaker Counting (Hard Version)
## Problem Description
[DRG - Limbo](https://soundcloud.com/drg72711/limbo)
โ
This is the hard version of the problem. In the three versions, the constraints on $ n $ and the time limit are different. You can make hacks only if all the versions of the problem are solved.
Th... |
2018 | F2 | Speedbreaker Counting (Medium Version) | ["dp", "greedy", "math"] | 3000 | https://codeforces.com/problemset/problem/2018/F2 | 1727444100 | en | codeforces | # Speedbreaker Counting (Medium Version)
## Problem Description
[DRG - Limbo](https://soundcloud.com/drg72711/limbo)
โ
This is the medium version of the problem. In the three versions, the constraints on $ n $ and the time limit are different. You can make hacks only if all the versions of the problem are solved.... |
2018 | F1 | Speedbreaker Counting (Easy Version) | ["combinatorics", "dp", "greedy", "math"] | 2900 | https://codeforces.com/problemset/problem/2018/F1 | 1727444100 | en | codeforces | # Speedbreaker Counting (Easy Version)
## Problem Description
[DRG - Limbo](https://soundcloud.com/drg72711/limbo)
โ
This is the easy version of the problem. In the three versions, the constraints on $ n $ and the time limit are different. You can make hacks only if all the versions of the problem are solved.
Th... |
2018 | E2 | Complex Segments (Hard Version) | ["binary search", "data structures", "divide and conquer", "dsu", "greedy", "math", "sortings"] | 3400 | https://codeforces.com/problemset/problem/2018/E2 | 1727444100 | en | codeforces | # Complex Segments (Hard Version)
## Problem Description
[Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)
โ
This is the hard version of the problem. In this version, the constraints on $ n $ and the time limit are higher. You can make hacks only if both versions of the problem are solved.
A set... |
2018 | E1 | Complex Segments (Easy Version) | ["binary search", "data structures", "divide and conquer", "dsu", "greedy", "math", "sortings"] | 3300 | https://codeforces.com/problemset/problem/2018/E1 | 1727444100 | en | codeforces | # Complex Segments (Easy Version)
## Problem Description
[Ken Arai - COMPLEX](https://soundcloud.com/diatomichail2/complex)
โ
This is the easy version of the problem. In this version, the constraints on $ n $ and the time limit are lower. You can make hacks only if both versions of the problem are solved.
A set ... |
2018 | D | Max Plus Min Plus Size | ["data structures", "dp", "dsu", "greedy", "implementation", "matrices", "sortings"] | 2200 | https://codeforces.com/problemset/problem/2018/D | 1727444100 | en | codeforces | # Max Plus Min Plus Size
## Problem Description
[EnV - The Dusty Dragon Tavern](https://soundcloud.com/envyofficial/env-the-dusty-dragon-tavern)
โ
You are given an array $ a_1, a_2, \ldots, a_n $ of positive integers.
You can color some elements of the array red, but there cannot be two adjacent red elements (i.... |
2018 | C | Tree Pruning | ["brute force", "dfs and similar", "greedy", "sortings", "trees"] | 1700 | https://codeforces.com/problemset/problem/2018/C | 1727444100 | en | codeforces | # Tree Pruning
## Problem Description
[t+pazolite, ginkiha, Hommarju - Paved Garden](https://soundcloud.com/fractalex-gd/ginkiha-paved-garden-little)
โ
You are given a tree with $ n $ nodes, rooted at node $ 1 $ . In this problem, a leaf is a non-root node with degree $ 1 $ .
In one operation, you can remove a l... |
2018 | B | Speedbreaker | ["binary search", "data structures", "dp", "greedy", "implementation", "two pointers"] | 1900 | https://codeforces.com/problemset/problem/2018/B | 1727444100 | en | codeforces | # Speedbreaker
## Problem Description
[Djjaner - Speedbreaker](https://soundcloud.com/luciano-ferrari-151560131/speedbreaker)
โ
There are $ n $ cities in a row, numbered $ 1, 2, \ldots, n $ left to right.
- At time $ 1 $ , you conquer exactly one city, called the starting city.
- At time $ 2, 3, \ldots, n $ , yo... |
2018 | A | Cards Partition | ["2-sat", "brute force", "greedy", "implementation", "math"] | 1600 | https://codeforces.com/problemset/problem/2018/A | 1727444100 | en | codeforces | # Cards Partition
## Problem Description
[DJ Genki vs Gram - Einherjar Joker](https://soundcloud.com/leon-hwang-368077289/einherjar-joker-dj-genki-vs-gram)
โ
You have some cards. An integer between $ 1 $ and $ n $ is written on each card: specifically, for each $ i $ from $ 1 $ to $ n $ , you have $ a_i $ cards w... |
2014 | H | Robin Hood Archery | ["data structures", "divide and conquer", "greedy", "hashing"] | 1900 | https://codeforces.com/problemset/problem/2014/H | 1726929900 | en | codeforces | # Robin Hood Archery
## Problem Description
At such times archery was always the main sport of the day, for the Nottinghamshire yeomen were the best hand at the longbow in all merry England, but this year the Sheriff hesitated...
Sheriff of Nottingham has organized a tournament in archery. It's the final round and... |
2014 | G | Milky Days | ["brute force", "data structures", "greedy", "implementation"] | 2200 | https://codeforces.com/problemset/problem/2014/G | 1726929900 | en | codeforces | # Milky Days
## Problem Description
What is done is done, and the spoilt milk cannot be helped.
Little John is as little as night is day โ he was known to be a giant, at possibly $ 2.1 $ metres tall. It has everything to do with his love for milk.
His dairy diary has $ n $ entries, showing that he acquired $ a_i ... |
2014 | F | Sheriff's Defense | ["dfs and similar", "dp", "greedy", "trees"] | 2000 | https://codeforces.com/problemset/problem/2014/F | 1726929900 | en | codeforces | # Sheriff's Defense
## Problem Description
"Why, master," quoth Little John, taking the bags and weighing them in his hand, "here is the chink of gold."
The folk hero Robin Hood has been troubling Sheriff of Nottingham greatly. Sheriff knows that Robin Hood is about to attack his camps and he wants to be prepared.... |
2014 | E | Rendez-vous de Marian et Robin | ["dfs and similar", "graphs", "shortest paths"] | 1800 | https://codeforces.com/problemset/problem/2014/E | 1726929900 | en | codeforces | # Rendez-vous de Marian et Robin
## Problem Description
In the humble act of meeting, joy doth unfold like a flower in bloom.
Absence makes the heart grow fonder. Marian sold her last ware at the Market at the same time Robin finished training at the Major Oak. They couldn't wait to meet, so they both start withou... |
2014 | D | Robert Hood and Mrs Hood | ["brute force", "data structures", "greedy", "sortings"] | 1400 | https://codeforces.com/problemset/problem/2014/D | 1726929900 | en | codeforces | # Robert Hood and Mrs Hood
## Problem Description
Impress thy brother, yet fret not thy mother.
Robin's brother and mother are visiting, and Robin gets to choose the start day for each visitor.
All days are numbered from $ 1 $ to $ n $ . Visitors stay for $ d $ continuous days, all of those $ d $ days must be bet... |
2014 | C | Robin Hood in Town | ["binary search", "greedy", "math"] | 1100 | https://codeforces.com/problemset/problem/2014/C | 1726929900 | en | codeforces | # Robin Hood in Town
## Problem Description
In Sherwood, we judge a man not by his wealth, but by his merit.
Look around, the rich are getting richer, and the poor are getting poorer. We need to take from the rich and give to the poor. We need Robin Hood!
There are $ n $ people living in the town. Just now, the w... |
2014 | B | Robin Hood and the Major Oak | ["math"] | 800 | https://codeforces.com/problemset/problem/2014/B | 1726929900 | en | codeforces | # Robin Hood and the Major Oak
## Problem Description
In Sherwood, the trees are our shelter, and we are all children of the forest.
The Major Oak in Sherwood is known for its majestic foliage, which provided shelter to Robin Hood and his band of merry men and women.
The Major Oak grows $ i^i $ new leaves in the ... |
2014 | A | Robin Helps | ["greedy", "implementation"] | 800 | https://codeforces.com/problemset/problem/2014/A | 1726929900 | en | codeforces | # Robin Helps
## Problem Description
There is a little bit of the outlaw in everyone, and a little bit of the hero too.
The heroic outlaw Robin Hood is famous for taking from the rich and giving to the poor.
Robin encounters $ n $ people starting from the $ 1 $ -st and ending with the $ n $ -th. The $ i $ -th per... |
2013 | F2 | Game in Tree (Hard Version) | ["binary search", "data structures", "trees"] | 3500 | https://codeforces.com/problemset/problem/2013/F2 | 1726842900 | en | codeforces | # Game in Tree (Hard Version)
## Problem Description
This is the hard version of the problem. In this version, it is not guaranteed that $ u = v $ . You can make hacks only if both versions of the problem are solved.
Alice and Bob are playing a fun game on a tree. This game is played on a tree with $ n $ vertices, n... |
2013 | F1 | Game in Tree (Easy Version) | ["binary search", "brute force", "data structures", "dp", "games", "greedy", "implementation", "trees"] | 2700 | https://codeforces.com/problemset/problem/2013/F1 | 1726842900 | en | codeforces | # Game in Tree (Easy Version)
## Problem Description
This is the easy version of the problem. In this version, $ \mathbf{u = v} $ . You can make hacks only if both versions of the problem are solved.
Alice and Bob are playing a fun game on a tree. This game is played on a tree with $ n $ vertices, numbered from $ 1 ... |
2013 | E | Prefix GCD | ["brute force", "dp", "greedy", "math", "number theory"] | 2200 | https://codeforces.com/problemset/problem/2013/E | 1726842900 | en | codeforces | # Prefix GCD
## Problem Description
Since Mansur is tired of making legends, there will be no legends for this task.
You are given an array of positive integer numbers $ a_1, a_2, \ldots, a_n $ . The elements of the array can be rearranged in any order. You need to find the smallest possible value of the expression ... |
2013 | D | Minimize the Difference | ["binary search", "greedy"] | 1900 | https://codeforces.com/problemset/problem/2013/D | 1726842900 | en | codeforces | # Minimize the Difference
## Problem Description
Zhan, tired after the contest, gave the only task that he did not solve during the contest to his friend, Sungat. However, he could not solve it either, so we ask you to try to solve this problem.
You are given an array $ a_1, a_2, \ldots, a_n $ of length $ n $ . We c... |
2013 | C | Password Cracking | ["constructive algorithms", "interactive", "strings"] | 1400 | https://codeforces.com/problemset/problem/2013/C | 1726842900 | en | codeforces | # Password Cracking
## Problem Description
Dimash learned that Mansur wrote something very unpleasant about him to a friend, so he decided to find out his password at all costs and discover what exactly he wrote.
Believing in the strength of his password, Mansur stated that his password โ is a binary string of lengt... |
2013 | B | Battle for Survive | ["constructive algorithms", "greedy", "math"] | 900 | https://codeforces.com/problemset/problem/2013/B | 1726842900 | en | codeforces | # Battle for Survive
## Problem Description
Eralim, being the mafia boss, manages a group of $ n $ fighters. Fighter $ i $ has a rating of $ a_i $ .
Eralim arranges a tournament of $ n - 1 $ battles, in each of which two not yet eliminated fighters $ i $ and $ j $ ( $ 1 \le i < j \le n $ ) are chosen, and as a resul... |
2013 | A | Zhan's Blender | ["constructive algorithms", "math"] | 800 | https://codeforces.com/problemset/problem/2013/A | 1726842900 | en | codeforces | # Zhan's Blender
## Problem Description
Today, a club fair was held at "NSPhM". In order to advertise his pastry club, Zhan decided to demonstrate the power of his blender.
To demonstrate the power of his blender, Zhan has $ n $ fruits.
The blender can mix up to $ x $ fruits per second.
In each second, Zhan can pu... |
2010 | C2 | Message Transmission Error (hard version) | ["hashing", "string suffix structures", "strings", "two pointers"] | 1700 | https://codeforces.com/problemset/problem/2010/C2 | 1724877300 | en | codeforces | # Message Transmission Error (hard version)
## Problem Description
This is a more difficult version of the problem. It differs from the easy one only by the constraints.
At the Berland State University, the local network between servers does not always operate without errors. When transmitting two identical messages... |
2010 | C1 | Message Transmission Error (easy version) | ["brute force", "strings"] | 1400 | https://codeforces.com/problemset/problem/2010/C1 | 1724877300 | en | codeforces | # Message Transmission Error (easy version)
## Problem Description
This is a simplified version of the problem. It differs from the difficult one only in its constraints.
At the Berland State University, the local network between servers does not always operate without errors. When transmitting two identical message... |
2010 | B | Three Brothers | ["brute force", "implementation", "math"] | 800 | https://codeforces.com/problemset/problem/2010/B | 1724877300 | en | codeforces | # Three Brothers
## Problem Description
Three brothers agreed to meet. Let's number the brothers as follows: the oldest brother is number $ 1 $ , the middle brother is number $ 2 $ , and the youngest brother is number $ 3 $ .
When it was time for the meeting, one of the brothers was late. Given the numbers of the tw... |
2010 | A | Alternating Sum of Numbers | ["brute force", "implementation", "math"] | 800 | https://codeforces.com/problemset/problem/2010/A | 1724877300 | en | codeforces | # Alternating Sum of Numbers
## Problem Description
You are given a sequence of integers. Output the alternating sum of this sequence. In other words, output $ a_1 - a_2 + a_3 - a_4 + a_5 - \dots $ . That is, the signs of plus and minus alternate, starting with a plus.
## Input Format
The first line of the test con... |
2009 | G3 | Yunli's Subarray Queries (extreme version) | ["data structures", "dp", "implementation"] | 2700 | https://codeforces.com/problemset/problem/2009/G3 | 1725374100 | en | codeforces | # Yunli's Subarray Queries (extreme version)
## Problem Description
This is the extreme version of the problem. In this version, the output of each query is different from the easy and hard versions. It is also guaranteed that $ r \geq l+k-1 $ for all queries.
For an arbitrary array $ b $ , Yunli can perform the fol... |
2009 | G2 | Yunli's Subarray Queries (hard version) | ["binary search", "data structures", "dp"] | 2200 | https://codeforces.com/problemset/problem/2009/G2 | 1725374100 | en | codeforces | # Yunli's Subarray Queries (hard version)
## Problem Description
This is the hard version of the problem. In this version, it is guaranteed that $ r \geq l+k-1 $ for all queries.
For an arbitrary array $ b $ , Yunli can perform the following operation any number of times:
- Select an index $ i $ . Set $ b_i = x $ w... |
2009 | G1 | Yunli's Subarray Queries (easy version) | ["binary search", "data structures", "two pointers"] | 1900 | https://codeforces.com/problemset/problem/2009/G1 | 1725374100 | en | codeforces | # Yunli's Subarray Queries (easy version)
## Problem Description
This is the easy version of the problem. In this version, it is guaranteed that $ r=l+k-1 $ for all queries.
For an arbitrary array $ b $ , Yunli can perform the following operation any number of times:
- Select an index $ i $ . Set $ b_i = x $ where ... |
2009 | F | Firefly's Queries | ["bitmasks", "data structures", "flows", "math"] | 1700 | https://codeforces.com/problemset/problem/2009/F | 1725374100 | en | codeforces | # Firefly's Queries
## Problem Description
Firefly is given an array $ a $ of length $ n $ . Let $ c_i $ denote the $ i $ 'th cyclic shift $ ^{\text{โ}} $ of $ a $ . She creates a new array $ b $ such that $ b = c_1 + c_2 + \dots + c_n $ where $ + $ represents concatenation $ ^{\text{โ }} $ .
Then, she asks you $ q $... |
2009 | E | Klee's SUPER DUPER LARGE Array!!! | ["binary search", "math", "ternary search"] | 1400 | https://codeforces.com/problemset/problem/2009/E | 1725374100 | en | codeforces | # Klee's SUPER DUPER LARGE Array!!!
## Problem Description
Klee has an array $ a $ of length $ n $ containing integers $ [k, k+1, ..., k+n-1] $ in that order. Klee wants to choose an index $ i $ ( $ 1 \leq i \leq n $ ) such that $ x = |a_1 + a_2 + \dots + a_i - a_{i+1} - \dots - a_n| $ is minimized. Note that for an ... |
2009 | D | Satyam and Counting | ["geometry", "math"] | 1400 | https://codeforces.com/problemset/problem/2009/D | 1725374100 | en | codeforces | # Satyam and Counting
## Problem Description
Satyam is given $ n $ distinct points on the 2D coordinate plane. It is guaranteed that $ 0 \leq y_i \leq 1 $ for all given points $ (x_i, y_i) $ . How many different nondegenerate right triangles $ ^{\text{โ}} $ can be formed from choosing three different points as its ve... |
2009 | C | The Legend of Freya the Frog | ["implementation", "math"] | 1100 | https://codeforces.com/problemset/problem/2009/C | 1725374100 | en | codeforces | # The Legend of Freya the Frog
## Problem Description
Freya the Frog is traveling on the 2D coordinate plane. She is currently at point $ (0,0) $ and wants to go to point $ (x,y) $ . In one move, she chooses an integer $ d $ such that $ 0 \leq d \leq k $ and jumps $ d $ spots forward in the direction she is facing.
... |
2009 | B | osu!mania | ["brute force", "implementation"] | 800 | https://codeforces.com/problemset/problem/2009/B | 1725374100 | en | codeforces | # osu!mania
## Problem Description
You are playing your favorite rhythm game, osu!mania. The layout of your beatmap consists of $ n $ rows and $ 4 $ columns. Because notes at the bottom are closer, you will process the bottommost row first and the topmost row last. Each row will contain exactly one note, represented ... |
2009 | A | Minimize! | ["brute force", "math"] | 800 | https://codeforces.com/problemset/problem/2009/A | 1725374100 | en | codeforces | # Minimize!
## Problem Description
You are given two integers $ a $ and $ b $ ( $ a \leq b $ ). Over all possible integer values of $ c $ ( $ a \leq c \leq b $ ), find the minimum value of $ (c - a) + (b - c) $ .
## Input Format
The first line contains $ t $ ( $ 1 \leq t \leq 55 $ ) โ the number of test cases.
Eac... |
2008 | H | Sakurako's Test | ["binary search", "brute force", "greedy", "math", "number theory"] | 2100 | https://codeforces.com/problemset/problem/2008/H | 1725201300 | en | codeforces | # Sakurako's Test
## Problem Description
Sakurako will soon take a test. The test can be described as an array of integers $ n $ and a task on it:
Given an integer $ x $ , Sakurako can perform the following operation any number of times:
- Choose an integer $ i $ ( $ 1\le i\le n $ ) such that $ a_i\ge x $ ;
- Chang... |
2008 | G | Sakurako's Task | ["binary search", "greedy", "math", "number theory"] | 1800 | https://codeforces.com/problemset/problem/2008/G | 1725201300 | en | codeforces | # Sakurako's Task
## Problem Description
Sakurako has prepared a task for you:
She gives you an array of $ n $ integers and allows you to choose $ i $ and $ j $ such that $ i \neq j $ and $ a_i \ge a_j $ , and then assign $ a_i = a_i - a_j $ or $ a_i = a_i + a_j $ . You can perform this operation any number of times... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.