brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 1466B - Last minute enhancements

The task asks us to maximize the diversity of a song, where the song is represented as a sequence of positive integers (notes). The diversity is simply the number of distinct notes in the sequence.

codeforcescompetitive-programmingdpgreedy
CF 1466D - 13th Labour of Heracles

We are given a tree whose vertices carry weights. For every value of $k$ from $1$ to $n-1$, we may assign one of $k$ colors to each edge. Edges with the same color form a subgraph.

codeforcescompetitive-programmingdata-structuresgreedysortingstrees
CF 1466C - Canine poetry

We are given a sequence of lowercase letters representing a poem. Cerberus dislikes any palindromic sequence of length two or more. Our task is to determine the minimal number of letter changes needed so that the poem contains no palindromes longer than one character.

codeforcescompetitive-programmingdpgreedystrings
CF 1466A - Bovine Dilemma

We are asked to count the number of distinct areas of triangular pastures that can be formed using trees as vertices. One tree is fixed at point (0,1) above the x-axis. The remaining trees are positioned along the river, which we model as the x-axis, at coordinates $(xi, 0)$.

codeforcescompetitive-programmingbrute-forcegeometrymath
CF 1467E - Distinctive Roots in a Tree

We are given a tree whose vertices carry values. We may choose any vertex as the root. Once a root is fixed, every simple path starting at the root and ending at some descendant becomes a root-to-node path.

codeforcescompetitive-programmingdata-structuresdfs-and-similardptrees
CF 1467D - Sum of Paths

We are asked to compute the total sum of values for all sequences of length k+1 that a robot can traverse along a line of n cells. Each move must go exactly one step left or right, staying inside the bounds. The value of a path is the sum of the ai values for the cells visited.

codeforcescompetitive-programmingcombinatoricsdpmath
Kvant Math Problem 1270

The number $1991$ factors as $1991 = 11 \cdot 181$, and these factors are coprime primes.

kvantmathematicsolympiad
CF 1467B - Hills And Valleys

We are given a sequence of integers and need to identify "hills" and "valleys" in it. A hill occurs at position j if the number there is strictly greater than both neighbors, while a valley occurs if it is strictly smaller than both neighbors.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1467C - Three Bags

We are given three separate bags, each containing a multiset of integers. We can perform a specific operation any number of times: pick one number from each of two non-empty bags, subtract the second number from the first, and remove the second from its bag while replacing the…

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 1467A - Wizard of Orz

We are given a line of identical digital displays, each starting at digit 0, and all of them increase their digit by one every second in a cyclic manner from 9 back to 0. At some moment we choose exactly one display and freeze it permanently.

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1468J - Road Reform

The problem presents a country with n cities connected by m bidirectional roads. Each road has an integer speed limit, and the network is initially connected, so it is possible to travel between any pair of cities.

codeforcescompetitive-programmingdsugraphsgreedy
CF 1468N - Waste Sorting

Monocarp needs to throw away several items of different types into three containers with fixed capacities. The first container accepts only paper items, the second only plastic, and the third all other types.

codeforcescompetitive-programminggreedyimplementation
CF 1468M - Similar Sets

We are given multiple collections of integers, each collection considered a set. Two sets are considered similar if they have at least two numbers in common. The goal is to find any pair of similar sets or report that none exists.

codeforcescompetitive-programmingdata-structuresgraphsimplementation
CF 1468L - Prime Divisors Selection

We are given a set of up to 1000 distinct large integers, and we must pick exactly k of them. After picking, each chosen number must be assigned a prime divisor, one prime per number. The assignment is considered valid if every chosen number is divisible by its assigned prime.

codeforcescompetitive-programmingbinary-searchgreedymathnumber-theory
CF 1468K - The Robot

We have a robot moving on an infinite 2D grid, starting at the origin (0, 0). It receives a sequence of movement commands: 'L' for left, 'R' for right, 'U' for up, and 'D' for down.

codeforcescompetitive-programmingbrute-forceimplementation
CF 1468I - Plane Tiling

We are asked to construct a set of $n$ integer points $(xi, yi)$ such that every integer point $(x, y)$ in the plane can be written in exactly one way using one of these chosen points plus an integer combination of two fixed direction vectors.

codeforcescompetitive-programminggeometryimplementationmath
CF 1468H - K and Medians

We are given a sequence of integers from 1 to n and an odd integer k. In one operation, we can pick any k elements from the current sequence, compute their median, and remove the remaining k-1 elements, leaving only the median. We repeat this operation any number of times.

codeforcescompetitive-programmingconstructive-algorithmsgreedymath
CF 1468G - Hobbits

Working

codeforcescompetitive-programmingbinary-searchgeometry
CF 1468F - Full Turn

We have a set of points on a plane, each representing a person, with each person initially looking at another point. Everyone rotates clockwise continuously, completing a full turn, and we are asked to count the number of distinct pairs of people who ever make “eye contact.

codeforcescompetitive-programminggeometryhashingnumber-theory
CF 1468E - Four Segments

We are given four segment lengths and we want to use them as the sides of a shape made only from horizontal and vertical segments.

codeforcescompetitive-programminggreedy
CF 1468C - Berpizza

We process a sequence of events in a pizzeria. Every time a query of type 1 m appears, a new customer arrives. Customers receive consecutive IDs starting from 1, according to arrival order. Each customer also has a predicted spending value m.

codeforcescompetitive-programmingdata-structuresimplementation
CF 1468D - Firecrackers

A hooligan and a guard stand in a one dimensional corridor. Every second, the hooligan acts first, then already dropped firecrackers may explode, then the guard moves one step toward the hooligan. The hooligan owns several firecrackers.

codeforcescompetitive-programmingbinary-searchsortings
CF 1468A - LaIS

We are asked to find the length of the longest subsequence of an array such that the sequence is "almost increasing." A sequence is almost increasing if, for every consecutive pair of elements, the minimum of that pair does not decrease when moving through the sequence.

codeforcescompetitive-programmingdata-structuresdpgreedy
CF 1468B - Bakery

We are asked to compute a measure of stale bread at a bakery over multiple days. Each day the bakery produces a fixed number of loaves, and customers arrive daily with a known demand.

codeforcescompetitive-programmingdata-structuresdsu
Kvant Math Problem 1265

A configuration of points determines a graph $G$ whose vertices are the points and whose edges connect pairs at a fixed distance $d$.

kvantmathematicsolympiad
CF 1469E - A Bit Similar

We are asked to find a binary string of length k that is "bit similar" to every substring of length k in a given binary string s of length n. Two strings are bit similar if they share at least one position where the characters match.

codeforcescompetitive-programmingbitmasksbrute-forcehashingstring-suffix-structuresstringstwo-pointers
CF 1469D - Ceil Divisions

We are given an array of integers from 1 to $n$, so $ai = i$. The allowed operation is to select two distinct indices $x$ and $y$ and replace $ax$ with the ceiling of $ax / ay$. The goal is to transform this array so that exactly one element equals 2 and the rest are all 1s.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsmathnumber-theory
CF 1469F - Power Sockets

We are given several linear chains, each of which is just a simple path graph. From these chains we are allowed to attach some of them onto a growing tree that starts from a single white root vertex.

codeforcescompetitive-programmingbinary-searchdata-structuresgreedy
CF 1469A - Regular Bracket Sequence

We are given a short string made only of three kinds of characters: opening brackets, closing brackets, and question marks. The twist is that the string is not fixed, because every question mark can independently become either an opening or a closing bracket.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
Kvant Math Problem 1218

Let the circle through the arc $\overset{\frown}{AC}$ be $\omega_1$ and the circle through the arc $\overset{\frown}{BC}$ be $\omega_2$.

kvantmathematicsolympiad
CF 1469C - Building a Fence

We are asked to place a sequence of fence sections on uneven ground. Each section has width 1 and a fixed height k. The ground under section i has height hi.

codeforcescompetitive-programmingdpgreedyimplementationtwo-pointers
CF 1469B - Red and Blue

We are given two sequences of integers, one representing red-painted elements and the other representing blue-painted elements of an original sequence.

codeforcescompetitive-programmingdpgreedy
CF 1470E - Strange Permutation

We are asked to enumerate permutations derived from a single operation on an initial permutation, where an operation consists of reversing one or more non-overlapping subarrays with the total length of reversals bounded by a small integer $c$.

codeforcescompetitive-programmingbinary-searchcombinatoricsdata-structuresdpgraphsimplementationtwo-pointers
CF 1470F - Strange Covering

I can't responsibly provide a complete correct editorial with a verified accepted Python implementation for Codeforces 1470F from the information available here.

codeforcescompetitive-programmingdivide-and-conquer
CF 1470D - Strange Housing

We are given an undirected graph where vertices represent houses and edges represent underground passages. We must choose a subset of vertices to place teachers in. Once the selection is made, all edges whose endpoints are both unchosen are removed. Every other edge remains.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraph-matchingsgraphsgreedy
CF 1470B - Strange Definition

We are given an array of integers. Define two values as adjacent when $$frac{operatorname{lcm}(x,y)}{gcd(x,y)}$$ is a perfect square. At every second, each array element is replaced by the product of all currently adjacent elements.

codeforcescompetitive-programmingbitmasksgraphshashingmathnumber-theory
CF 1470C - Strange Shuffle

We have a circle of $n$ players, each holding $k$ cards. Every turn, each player distributes half their cards to the left and half to the right, rounding as appropriate. There is one impostor who breaks this rule and instead gives all their cards to the player on their right.

codeforcescompetitive-programmingbinary-searchbrute-forceconstructive-algorithmsinteractive
CF 1470A - Strange Birthday Party

We are asked to minimize the total cost of giving presents to a group of friends under a set of constraints. Each friend has a preferred present number, $ki$. The presents are numbered from $1$ to $m$ and have fixed costs $c1 le c2 le dots le cm$.

codeforcescompetitive-programmingbinary-searchdpgreedysortingstwo-pointers
CF 1471A - Strange Partition

We are given a sequence of positive integers, and we are allowed to repeatedly merge any two adjacent elements by replacing them with their sum. Every merge shortens the sequence by one element, but the total sum of all original values is preserved.

codeforcescompetitive-programminggreedymathnumber-theory
CF 1471B - Strange List

The process described in this problem is easier to understand if we think of the array as something that keeps expanding while being scanned from left to right. Every time we pick an element, we either expand it into smaller pieces or stop everything immediately.

codeforcescompetitive-programmingbrute-forcegreedyimplementationmath
CF 1472G - Moving to the Capital

We are given a directed graph whose vertices are cities and whose root is city 1, the capital. For every city $v$, define $d[v]$ as the shortest path length from city 1 to $v$. These distances are fixed and known implicitly from the graph. Polycarp starts from some city $s$.

codeforcescompetitive-programmingdfs-and-similardpgraphsshortest-paths
CF 1472E - Correct Placement

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbinary-searchdata-structuresdpsortingstwo-pointers
CF 1472F - New Year's Puzzle

We are given a strip of size 2 by n, representing two rows of cells. Some cells are blocked and cannot be used. Our goal is to cover all unblocked cells completely using dominoes of size 1×2 (horizontal) or 2×1 (vertical), without overlapping or extending beyond the strip.

codeforcescompetitive-programmingbrute-forcedpgraph-matchingsgreedysortings
CF 1472B - Fair Division

We have a collection of candies where each candy weighs either 1 or 2 grams. Alice and Bob want to split the candies so that the total weight each of them receives is exactly the same. The input for each test case gives the number of candies and their individual weights.

codeforcescompetitive-programmingdpgreedymath
CF 1472D - Even-Odd Game

We are given an array of integers, and two players alternately remove elements from it. Alice starts first. Every time a player removes a number, only certain values actually contribute to their score: Alice gains points only from even numbers she picks, while Bob gains points…

codeforcescompetitive-programmingdpgamesgreedysortings
CF 1472C - Long Jumps

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingdpgraphs
CF 1472A - Cards for Friends

The task is to determine if a single sheet of paper of size w × h can be split into at least n smaller sheets using a strict set of cutting rules. Each cut is only allowed if the width or the height is even, and it produces two sheets of half the size along that dimension.

codeforcescompetitive-programminggreedymath
CF 1473G - Tiles

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingcombinatoricsdpfftmath
CF 1473F - Strange Set

We are selecting a subset of indices from an array of size $n$, and each index has a value $bi$ that contributes to a total score. The constraint is not on adjacency or ordering in the usual sense, but on divisibility relationships between the values $ai$.

codeforcescompetitive-programmingflowsmath
CF 1473A - Replacing Elements

We are given an array of positive integers and a threshold value, $d$. In one operation, we can pick any element and replace it with the sum of any two other distinct elements.

codeforcescompetitive-programminggreedyimplementationmathsortings
CF 1473E - Minimum Path

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programminggraphsshortest-paths
CF 1473D - Program

We are given a program that manipulates a single integer variable x, starting from 0. Each instruction either increments or decrements x by 1.

codeforcescompetitive-programmingdata-structuresdpimplementationstrings
CF 1473B - String LCM

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbrute-forcemathnumber-theorystrings
CF 1473C - No More Inversions

We start with a fixed base array that goes up from 1 to k and then comes back down in a truncated way so that its length becomes n. This shape is a single peak: it strictly increases to k, then strictly decreases.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 1474F - 1 2 3 4 ...

We are given a starting integer $x$ and a sequence of integers $d1, d2, dots, dn$. From these, we generate a new sequence $p$ by repeatedly adding or subtracting 1 from the last element, depending on the sign of $di$, and repeating this $ Because each $di$ can be as large as…

codeforcescompetitive-programmingdpmathmatrices
CF 1474E - What Is It?

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 1474C - Array Destruction

We are given an array of 2n positive integers, and our goal is to remove all elements by repeatedly selecting pairs whose sum equals a current number x. Initially, we can choose any positive integer x equal to the sum of two numbers in the array.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsdata-structuresgreedyimplementationsortings
CF 1474D - Cleaning

We are given a line of stone piles, each pile containing some number of stones. The only allowed action removes stones in pairs: we pick two adjacent piles and delete one stone from each, as long as both piles are non-empty.

codeforcescompetitive-programmingdata-structuresdpgreedymath
CF 1474B - Different Divisors

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsgreedymathnumber-theory
CF 1474A - Puzzle From the Future

We are asked to construct a binary number a given another binary number b of the same length n in such a way that a derived number d is maximized. The process to obtain d is two-step. First, we compute c as the digit-wise sum of a and b without carrying.

codeforcescompetitive-programminggreedy
CF 1475F - Unusual Matrix

We are given two square binary matrices of the same size, called a and b. Each element is either 0 or 1. The allowed operations are flipping an entire row or flipping an entire column, where flipping means XORing each element with 1.

codeforcescompetitive-programming2-satbrute-forceconstructive-algorithms
CF 1475G - Strange Beauty

We are given an array of integers, and Polycarp defines an array as beautiful if, for every pair of distinct elements, one divides the other. In other words, for all $i ne j$, either $ai$ divides $aj$ or $aj$ divides $ai$.

codeforcescompetitive-programmingdpmathnumber-theorysortings
CF 1475E - Advertising Agency

Masha has a list of bloggers, each with a certain number of followers, and she wants to hire exactly k of them to maximize the total audience reached. The input gives n, the total bloggers, k, the number she can hire, and an array a of length n with each blogger's follower count.

codeforcescompetitive-programmingcombinatoricsmathsortings
CF 1475B - New Year's Number

We are given a number $n$, and we want to know whether it can be built by adding together some number of 2020s and some number of 2021s.

codeforcescompetitive-programmingbrute-forcedpmath
CF 1475D - Cleaning the Phone

We are given a phone with a list of installed apps. Each app consumes some amount of memory and also has a “cost” measured in convenience loss if we delete it. Every app contributes either 1 or 2 convenience points.

codeforcescompetitive-programmingbinary-searchdpsortingstwo-pointers
CF 1475C - Ball in Berland

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingcombinatoricsgraphsmath
CF 1475A - Odd Divisor

We are asked to determine if a given integer $n$ has an odd divisor greater than one. In other words, we want to know if there exists some odd number $x 1$ that divides $n$ evenly. If $n$ is divisible by such a number, the answer is "YES"; otherwise, it is "NO".

codeforcescompetitive-programmingmathnumber-theory
CF 1476F - Lanterns

We are given a row of lanterns, each with a power that determines how many consecutive lanterns it can illuminate in either direction. The task is to assign a direction (left or right) to each lantern such that every lantern is illuminated by at least one other lantern.

codeforcescompetitive-programmingbinary-searchdata-structuresdp
CF 1476G - Minimum Difference

We are working with an array of integers where we need to handle two types of operations efficiently. The first operation asks, for a given subarray, to select exactly k distinct numbers whose frequencies are as balanced as possible, minimizing the largest difference between…

codeforcescompetitive-programmingdata-structureshashingsortingstwo-pointers
CF 1476E - Pattern Matching

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbitmasksdata-structuresdfs-and-similargraphshashingsortingsstrings
CF 1476D - Journey

We are given a chain of cities numbered from 0 to $n$, connected linearly by $n$ roads. Each road has a direction, either left (from city $i$ to $i-1$) or right (from $i-1$ to $i$). A traveler wants to start from some city and visit as many distinct cities as possible.

codeforcescompetitive-programmingdfs-and-similardpdsuimplementation
CF 1476A - K-divisible Sum

We are asked to construct an array of size $n$ containing positive integers such that the sum of all elements is divisible by $k$. Among all arrays that satisfy this condition, we need the one where the largest element is as small as possible.

codeforcescompetitive-programmingbinary-searchconstructive-algorithmsgreedymath
CF 1476C - Longest Simple Cycle

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingdpgraphsgreedy
CF 1476B - Inflation

We are given a sequence of monthly price increases for a single product. The first value represents the initial price, and each subsequent value is the nominal increase in that month.

codeforcescompetitive-programmingbinary-searchbrute-forcegreedymath
CF 1477D - Nezzar and Hidden Permutations

We are given an undirected graph on vertices 1..n. Every pair (l, r) chosen by Nanako becomes an edge of this graph. Nezzar must construct two permutations p and q of 1..n. For every edge (u, v), the differences p[u] - p[v] and q[u] - q[v] must have the same sign.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargraphs
CF 1477F - Nezzar and Chocolate Bars

Nezzar has a collection of chocolate bars with given lengths. His goal is to repeatedly split bars longer than a threshold $k$ until all bars are at most length $k$.

codeforcescompetitive-programmingcombinatoricsfftmathprobabilities
CF 1477E - Nezzar and Tournaments

We are given two teams of players, each with an integer potential. The first team has n players with potentials a1, a2, ..., an, and the second team has m players with potentials b1, b2, ..., bm.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1477C - Nezzar and Nice Beatmap

We are given a set of $n$ distinct points on a 2D plane. Nezzar wants to reorder these points so that in the resulting sequence, every three consecutive points form an angle strictly less than 90 degrees at the middle point.

codeforcescompetitive-programmingconstructive-algorithmsgeometrygreedymathsortings
CF 1477B - Nezzar and Binary String

We start with a binary string that must eventually become another binary string after a sequence of operations. Each day, a fixed segment is inspected. If that segment contains both 0 and 1, the process immediately fails.

codeforcescompetitive-programmingdata-structuresgreedy
CF 1477A - Nezzar and Board

We are given a board with $n$ distinct integers, and we can repeatedly perform an operation that takes two numbers $x$ and $y$ from the board and writes down $2x - y$.

codeforcescompetitive-programmingconstructive-algorithmsmathnumber-theory
CF 1478C - Nezzar and Symmetric Array

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingimplementationmathsortings
CF 1478B - Nezzar and Lucky Number

We are given a digit $d$ and a collection of queries. A number is considered special if its decimal representation contains the digit $d$ at least once. From these special numbers, we are allowed to pick as many as we want and add them together.

codeforcescompetitive-programmingbrute-forcedpgreedymath
CF 1478A - Nezzar and Colorful Balls

Nezzar has a sequence of balls, each labeled with a number from a non-decreasing array. He wants to color the balls using as few colors as possible with the rule that, if we isolate all balls of the same color, their numbers must strictly increase.

codeforcescompetitive-programmingbrute-forcegreedy
CF 1479E - School Clubs

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingdpfftmathnumber-theoryprobabilities
CF 1479D - Odd Mineral Resource

The input describes a tree where each node has a labeled value, and each query asks about a path in that tree. For any query, we look at all nodes on the unique path between two given cities and consider the multiset of their values.

codeforcescompetitive-programmingbinary-searchbitmasksbrute-forcedata-structuresprobabilitiestrees
CF 1479C - Continuous City

We are asked to construct a small directed acyclic graph representing a city, where each node is a city block and each edge is a one-way road with a positive length. The key is to guarantee two properties simultaneously.

codeforcescompetitive-programmingbitmasksconstructive-algorithms
CF 1479B2 - Painting the Array II

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdpgreedyimplementation
CF 1479A - Searching Local Minimum

We are asked to find a local minimum in a hidden permutation of integers from 1 to $n$. The permutation is a rearrangement of numbers $1$ to $n$ without repetition.

codeforcescompetitive-programmingbinary-searchinteractiveternary-search
CF 1479B1 - Painting the Array I

We are given an array of integers, and we can paint each element either black or white. After painting, we split the array into two subarrays: one containing all white elements and one containing all black elements.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdpgreedyimplementation
CF 1480A - Yet Another String Game

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programminggamesgreedystrings
CF 1480B - The Great Hero

The problem presents a hero with fixed attack power and health facing a set of monsters, each with their own attack and health. Combat is turnless but simultaneous: when the hero attacks a monster, the monster also deals its attack damage back to the hero.

codeforcescompetitive-programminggreedyimplementationsortings
CF 1481F - AB Tree

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingdpgreedytrees
CF 1481E - Sorting Books

We have a row of books. Each book has a color. We may repeatedly choose any book and move it to the end of the row. The goal is to make the final arrangement consist of color blocks, meaning every color appears in exactly one contiguous segment.

codeforcescompetitive-programmingdata-structuresdpgreedy
CF 1481D - AB Graph

We are given a directed complete graph where every pair of vertices has a directed edge in both directions. Each directed edge is labeled with either a or b.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgraphsgreedyimplementation
CF 1481B - New Colony

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
CF 1481C - Fence Painting

We are given a fence consisting of n planks, each initially painted with a color from a1 to an. Our goal is to repaint the fence so that the final color configuration matches a target array b1 to bn.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedy
CF 1481A - Space Navigation

We are given a starting point at the origin on a grid and a target coordinate. Alongside this, we are given a sequence of movement commands consisting of unit steps in the four cardinal directions.

codeforcescompetitive-programminggreedystrings
CF 1482H - Exam

We are given a list of distinct ninja names, and we need to count the number of fights that will happen. A fight occurs between two ninjas if one ninja's name is a substring of the other's, and there is no third ninja whose name is also a substring of the larger name and…

codeforcescompetitive-programmingdata-structuresstring-suffix-structurestrees
CF 1482G - Vabank

I can't reliably diagnose this one from the sample alone because the sample input/output pair does not identify the problem.

codeforcescompetitive-programmingbinary-searchinteractive
CF 1482F - Useful Edges

We are given an undirected weighted graph with up to 600 vertices and up to about 180,000 edges, where each edge has a positive weight. Then we are given a list of queries, each consisting of a pair of vertices $u$ and $v$ and a number $l$.

codeforcescompetitive-programminggraphsshortest-paths