brain

tamnd's digital brain — notes, problems, research

41650 notes

CF 2001B - Generate Permutation

We are asked to construct a permutation of integers from 1 to $n$ such that, no matter which of two typewriters Misuki uses, the number of required carriage returns to complete the permutation is identical.

codeforcescompetitive-programmingconstructive-algorithms
CF 2002H - Counting 101

We are asked to count sequences of integers with a very particular merging property. For a given sequence of length n, each element between 1 and m, we are allowed to repeatedly take three consecutive elements ai, a{i+1}, a{i+2} and merge them into a single number defined as…

codeforcescompetitive-programminggreedy
CF 2002F2 - Court Blue (Hard Version)

We are constructing a sequence of rounds where exactly one of two players gains a point in each round. After each round we maintain two counters, one for each player, and the process is only valid if at every prefix the greatest common divisor of the two counters never exceeds 1.

codeforcescompetitive-programmingbrute-forcedpmathnumber-theory
CF 2002F1 - Court Blue (Easy Version)

We are asked to plan a match between two performers, Lelle and Flamm, where each round produces a winner. The goal is to maximize the total score, which is computed as l WL + f WF, where WL and WF are the number of wins for Lelle and Flamm, respectively.

codeforcescompetitive-programmingbrute-forcedfs-and-similardpmathnumber-theory
CF 2002G - Lattice Optimizing

The problem asks only for existence or nonexistence in three classes. For part (1), it suffices to exhibit a tetrahedron that tiles space by congruent copies. For part (2), we must decide whether a congruent tiling by equifacial tetrahedra exists.

codeforcescompetitive-programmingbitmasksbrute-forcehashingmeet-in-the-middle
CF 2002E - Cosmic Rays

This is a Type C problem: a precise numerical count of admissible fillings is requested. The solution produces a combinatorial formula $an = 2^{n-1}$ and rigorously justifies it via bijection arguments and induction.

codeforcescompetitive-programmingbrute-forcedata-structuresdp
Kvant Math Problem 702

For the first values,

kvantmathematicsolympiad
CF 2002D2 - DFS Checker (Hard Version)

We are given a rooted tree where vertex 1 is the root. Alongside the tree, we maintain a permutation stored in an array indexed by positions, and we repeatedly swap two positions in this array.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similargraphshashingtrees
CF 2002B - Removals Game

We have two players, Alice and Bob, each holding a permutation of the numbers from 1 to n. They will alternately remove elements from either end of their respective arrays. After n-1 turns, only one element remains in each array.

codeforcescompetitive-programmingconstructive-algorithmsgames
CF 2002D1 - DFS Checker (Easy Version)

We are given a perfect binary tree whose vertices are numbered in heap order. Vertex 1 is the root, and for every vertex i 1, its parent is i // 2. A permutation p of all vertices is maintained. After every query, two positions in the permutation are swapped.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similargraphshashingtrees
CF 2002A - Distanced Coloring

We are given a rectangular grid with n rows and m columns. Each cell must be assigned a color, but colors are restricted by a distance rule: if two cells share the same color, then they must be sufficiently far apart in the Chebyshev sense, meaning the maximum of their row…

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 2002C - Black Circles

This is a counting problem, so it falls under Type C. The goal is to determine the exact number of admissible fillings of the strip. The solution must provide a precise count and justify the enumeration rigorously.

codeforcescompetitive-programmingbrute-forcegeometrygreedymath
CF 2003F - Turtle and Three Sequences

This is a counting problem, so it is closest to Type C in the supplied classification. The requirement is to determine the exact number of admissible fillings and justify the count rigorously.

codeforcescompetitive-programmingbrute-forcedata-structuresdpgreedymathprobabilitiestwo-pointers
CF 2003E1 - Turtle and Inversions (Easy Version)

We are asked to find the maximum number of inversions in permutations of length $n$ that satisfy a specific "interesting" property defined by a set of intervals.

codeforcescompetitive-programmingbrute-forcedivide-and-conquerdpgreedymath
CF 2003E2 - Turtle and Inversions (Hard Version)

The problem gives us a permutation of integers from 1 to $n$ and asks us to consider certain "interesting" permutations based on a set of intervals.

codeforcescompetitive-programmingbrute-forcedata-structuresdivide-and-conquerdpgreedymathtwo-pointers
CF 2003D2 - Turtle and a MEX Problem (Hard Version)

The problem involves a turtle playing with several integer sequences and a non-negative integer $x$. For each sequence, the turtle can perform an operation exactly once: he sets $x$ to the $text{mex}$ of its current value together with the numbers in the chosen sequence.

codeforcescompetitive-programmingdfs-and-similardpgraphsgreedyimplementationmath
Kvant Math Problem 630

The point $M$ is defined from the circle through $P,Q,K$.

kvantmathematicsolympiad
CF 2003D1 - Turtle and a MEX Problem (Easy Version)

We are given several sequences of non-negative integers, and an initial integer $x$. Turtle can repeatedly choose any sequence and replace $x$ with the mex of $x$ together with all numbers in that sequence.

codeforcescompetitive-programminggreedymath
Kvant Math Problem 583

Let the stone masses be $x_1,\dots,x_n$ with $0<x_i\le 2$ and $\sum_{i=1}^n x_i=50$.

kvantmathematicsolympiad
CF 2003C - Turtle and Good Pairs

We are given a string consisting of lowercase letters, and our task is to reorder it to maximize the number of "good pairs.

codeforcescompetitive-programmingconstructive-algorithmsgreedysortingsstrings
CF 2003A - Turtle and Good Strings

We are asked to determine whether a given string can be split into two or more contiguous substrings such that no substring starts with a character that appears at the end of a later substring.

codeforcescompetitive-programminggreedystrings
CF 2003B - Turtle and Piggy Are Playing a Game 2

We are given a sequence of numbers and two players who repeatedly shrink it until only one value remains at the front position. Each move removes one element, but before removing it, the left element of the chosen adjacent pair is updated.

codeforcescompetitive-programminggamesgreedysortings
CF 2004D - Colored Portals

We are given a sequence of cities arranged on a line, each equipped with exactly two portals of different colors from a fixed set of four: blue, green, red, and yellow.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresgraphsgreedyimplementationshortest-paths
CF 2005E2 - Subtangle Game (Hard Version)

We have a sequence $a$ and an $n times m$ matrix $b$. The game follows the sequence from left to right. On move $k$, the current player must choose a cell whose value equals $ak$.

codeforcescompetitive-programmingdata-structuresdpgamesgreedyimplementation
CF 2005E1 - Subtangle Game (Easy Version)

This is a Type B (prove) problem. The solution correctly interprets the statement: it aims to prove that any triangle admitting a circle tangent to two sides and two medians must be isosceles.

codeforcescompetitive-programmingdpgamesgreedyimplementation
CF 2005D - Alter the GCD

We are given two arrays of equal length. At every index we can either keep the pair as it is, or swap the two values at that position. The operation we are allowed to perform is more structured: we must choose one contiguous segment and swap all pairs inside it simultaneously.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdivide-and-conquerimplementationnumber-theory
CF 2005B2 - The Strict Teacher (Hard Version)

We are asked to simulate a pursuit on a one-dimensional line with cells numbered from 1 to $n$. David, a student, starts in a given cell and can move left, right, or stay in place.

codeforcescompetitive-programmingbinary-searchgreedymathsortings
CF 2005C - Lazy Narek

This is a Type B (prove) problem. The solution correctly interprets the statement: it aims to prove that any triangle admitting a circle tangent to two sides and two medians must be isosceles.

codeforcescompetitive-programmingdpimplementationstrings
CF 2005A - Simple Palindrome

We are asked to construct a string consisting solely of the English vowels a, e, i, o, u of a given length n such that the number of palindrome subsequences in the string is minimized.

codeforcescompetitive-programmingcombinatoricsconstructive-algorithmsgreedymath
CF 2005B1 - The Strict Teacher (Easy Version)

This is a Type B (prove) problem. The solution correctly interprets the statement: it aims to prove that any triangle admitting a circle tangent to two sides and two medians must be isosceles.

codeforcescompetitive-programminggreedymathsortings
Kvant Math Problem 579

For $n=1$ the inequality becomes

kvantmathematicsolympiad
CF 2006E - Iris's Full Binary Tree

We are building a tree incrementally, one node at a time. After each insertion, we are asked to evaluate how “close” the current tree is to a perfect full binary tree shape.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similartrees
CF 2006F - Dora's Paint

This is a Type B (prove) problem. The solution correctly interprets the statement: it aims to prove that any triangle admitting a circle tangent to two sides and two medians must be isosceles.

codeforcescompetitive-programmingbrute-forcecombinatoricsconstructive-algorithmsgraphsimplementation
CF 2006C - Eri and Expanded Sets

For every subarray of the given array, we throw all of its values into a set, removing duplicates. Starting from that set, we may repeatedly pick two existing numbers whose average is an integer and insert that average.

codeforcescompetitive-programmingdata-structuresdivide-and-conquermathnumber-theorytwo-pointers
CF 2006D - Iris and Adjacent Products

I can't reliably provide a complete editorial with a correct accepted Python solution for Codeforces 2006D from the problem statement alone.

codeforcescompetitive-programmingdata-structuresgreedyimplementationmath
CF 2006A - Iris and Game on the Tree

We are given a rooted tree with root fixed at vertex 1. Each vertex carries a label that is either 0, 1, or unknown. The unknown entries are the only things we are allowed to choose during the game, and the two players alternate assigning them values until every vertex is fixed.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similargamesgraphsgreedytrees
CF 2006B - Iris and the Tree

This is a Type B (prove) problem. The requirement is to show that any triangle admitting a circle tangent to two of its sides and to two of its medians must necessarily be isosceles. The statement is exact and requires a complete geometric or analytic proof.

codeforcescompetitive-programmingbrute-forcedata-structuresdfs-and-similardsumathtrees
CF 2007A - Dora's Set

We start with all integers in the interval $[l,r]$. In one operation, we must choose three distinct numbers whose pairwise greatest common divisors are all equal to $1$. After choosing them, those three numbers are removed permanently.

codeforcescompetitive-programminggreedymathnumber-theory
Kvant Math Problem 588

For the planar analogue, take a triangle $ABC$ and a point $P$ inside it.

kvantmathematicsolympiad
CF 2007B - Index and Maximum Value

We are given an array, but the operations do not directly modify positions. Instead, each operation targets values: whenever we see a range $[l, r]$, every element whose current value lies in that numeric interval is incremented or decremented by exactly one.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2008H - Sakurako's Test

We are given an array and a parameter $x$. With this $x$, we are allowed to repeatedly pick any element that is at least $x$ and reduce it by exactly $x$.

codeforcescompetitive-programmingbinary-searchbrute-forcegreedymathnumber-theory
CF 2008G - Sakurako's Task

This is a Type B (prove) problem. The requirement is to prove that for every point $P$ in the plane and for every choice of the distinguished vertex of the isosceles trapezoid, the sum of the distances from $P$ to the other three vertices is strictly greater than the distance…

codeforcescompetitive-programmingbinary-searchgreedymathnumber-theory
CF 2008E - Alternating String

We are given a string of lowercase letters. An alternating string has a very specific form. All characters at even indices must be identical, all characters at odd indices must be identical, and the final length must be even.

codeforcescompetitive-programmingbrute-forcedata-structuresdpgreedyimplementationstrings
Kvant Math Problem 517

A convex $n$-gon $A_1A_2\dots A_n$ is inscribed in a circle of radius $R$ with center $O$.

kvantmathematicsolympiad
CF 2008B - Square or Not

We are given a binary string that was originally formed by flattening a rectangular grid row by row. The grid is known to be “beautiful”, meaning its border cells are all 1 and all interior cells are 0.

codeforcescompetitive-programmingbrute-forcemathstrings
CF 2008F - Sakurako's Box

This is a Type B (prove) problem. The requirement is to prove that for every point $P$ in the plane and for every choice of the distinguished vertex of the isosceles trapezoid, the sum of the distances from $P$ to the other three vertices is strictly greater than the distance…

codeforcescompetitive-programmingcombinatoricsmathnumber-theory
CF 2008D - Sakurako's Hobby

We are given a permutation of integers from 1 to n, and each number is colored black or white. From any starting integer i, we can repeatedly apply the permutation to jump from i to pi, then to p{pi}, and so on.

codeforcescompetitive-programmingdpdsugraphsmath
CF 2008A - Sakurako's Exam

We are asked to decide whether it is possible to assign a positive or negative sign to each element in an array made up of a certain number of ones and twos such that the total sum becomes zero.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymath
CF 2008C - Longest Good Array

We are asked to construct an array of integers between two given bounds, l and r, such that the array is strictly increasing and the differences between consecutive elements are also strictly increasing. Our goal is to find the maximum possible length of such an array.

codeforcescompetitive-programmingbinary-searchbrute-forcemath
CF 2009G3 - Yunli's Subarray Queries (extreme version)

We are given an array and many range queries. For each query range $[l, r]$, we look at every subarray inside it whose length is at least $k$.

codeforcescompetitive-programmingdata-structuresdpimplementation
Kvant Math Problem 556

The answer is **yes**.

kvantmathematicsolympiad
Kvant Math Problem 574

Let

kvantmathematicsolympiad
Kvant Math Problem 576

Represent each chosen vector by an oriented edge of a directed graph whose vertices are the given points.

kvantmathematicsolympiad
CF 2009G2 - Yunli's Subarray Queries (hard version)

We are given an array a of size n. For each subarray of a, Yunli can perform an operation on any element to set it to any integer she wants. The goal is to form a consecutive increasing sequence of length at least k within that subarray.

codeforcescompetitive-programmingbinary-searchdata-structuresdp
CF 2009F - Firefly's Queries

We are given an array a of length n, and we are asked to handle queries on a much larger array b. This array b is constructed by taking all n cyclic shifts of a and concatenating them in order.

codeforcescompetitive-programmingbitmasksdata-structuresflowsmath
CF 2009G1 - Yunli's Subarray Queries (easy version)

We are given an array of integers and need to answer multiple queries. Each query asks for the minimum number of changes required to create a consecutive increasing subarray of length exactly k within a specified slice of the array.

codeforcescompetitive-programmingbinary-searchdata-structurestwo-pointers
CF 2009E - Klee's SUPER DUPER LARGE Array!!!

We are given a conceptual array that contains a strictly increasing sequence of integers starting at $k$ and ending at $k+n-1$.

codeforcescompetitive-programmingbinary-searchmathternary-search
CF 2009D - Satyam and Counting

Let $ABCD$ be an isosceles trapezoid with $ABparallel CD,$ and let $AB$ be the longer base. Then $ABCD.$ For a point $P$ in the plane, consider the quantity $S=PA+PB+PC+PD.

codeforcescompetitive-programminggeometrymath
CF 2009B - osu!mania

Each test case describes a small osu!mania beatmap with 4 columns. Every row contains exactly one note, marked by , and the remaining cells contain ..

codeforcescompetitive-programmingbrute-forceimplementation
CF 2009A - Minimize!

We are given multiple independent queries. Each query provides two integers a and b, and we are allowed to choose any integer c in the inclusive range between them. For each choice of c, we compute a cost defined as the distance from a to c plus the distance from c to b.

codeforcescompetitive-programmingbrute-forcemath
CF 2009C - The Legend of Freya the Frog

Codeforces 2009C: The Legend of Freya the Frog

codeforcescompetitive-programmingimplementationmath
CF 2010C2 - Message Transmission Error (hard version)

We are asked to determine whether a given string could have resulted from a very specific transmission error in a network. The error occurs when a message s is sent twice consecutively, and the second copy partially overlaps the first at some non-zero length.

codeforcescompetitive-programminghashingstring-suffix-structuresstringstwo-pointers
CF 2010A - Alternating Sum of Numbers

The task is to compute an alternating sum over a sequence of integers. Specifically, for each sequence, you start with the first number, add it, subtract the second number, add the third, subtract the fourth, and continue in this alternating pattern.

codeforcescompetitive-programmingbrute-forceimplementationmath
CF 2010B - Three Brothers

This is a Type B (proof) problem. To succeed, the solution must rigorously establish the stated vector identities for: 1. An equilateral triangle. 2. An arbitrary regular $n$-gon. 3. A regular tetrahedron.

codeforcescompetitive-programmingbrute-forceimplementationmath
CF 2010C1 - Message Transmission Error (easy version)

We receive a single string t that represents a message captured by a server. The server originally sends some string s twice in a row.

codeforcescompetitive-programmingbrute-forcestrings
CF 2011I - Stack and Queue

We maintain two evolving ordered structures over patients: one behaves like a FIFO queue (first in, first out) and the other like a stack (last in, first out). Each patient has a fixed service duration.

codeforcescompetitive-programming*specialdata-structuresdivide-and-conquer
CF 2011F - Good Subarray

We are asked to count all contiguous subarrays of a given integer array such that each subarray can be generated by a process that starts with a single integer and repeatedly appends either the same number, one less, or one more than an element already in the array.

codeforcescompetitive-programming*specialdata-structuresgreedy
CF 2011D - Among Wolves

We are given a 2-row by $n$-column grid representing a field, where each cell can be empty, contain a sheep, or contain a wolf. There is exactly one sheep, and some cells contain wolves.

codeforcescompetitive-programming*special
CF 2011H - Strange Matrix

This is a Type B (proof) problem. The required task is to prove the stated vector identities for: 1. An equilateral triangle. 2. A regular $n$-gon. 3. A regular tetrahedron. A valid solution must establish the identities themselves.

codeforcescompetitive-programming*specialgraphsgreedy
CF 2011G - Removal of a Permutation

Connection interrupted. Waiting for the complete answer

codeforcescompetitive-programming*special
CF 2011C - Split the Expression

We are given a string consisting of blocks of digits separated by plus signs, where each block has between 2 and 13 digits, and every digit is non-zero.

codeforcescompetitive-programming*special
CF 2011E - Rock-Paper-Scissors Bot

Working

codeforcescompetitive-programming*specialgreedystrings
Kvant Math Problem 561

The condition says that corresponding sides are parallel, but the directions are reversed.

kvantmathematicsolympiad
CF 2011A - Problem Solving

Jane has a list of problems with known difficulties. The last problem in the list is strictly harder than every earlier problem. Her skill level is some integer $x$.

codeforcescompetitive-programming*special
CF 2011B - Shuffle

We need to construct a permutation of numbers from 1 to n such that every adjacent pair follows a rule that depends on divisibility. If two neighboring numbers have a divisibility relationship, the sequence must increase at that point.

codeforcescompetitive-programming*special
Kvant Math Problem 482

Let the regular tetrahedron be $ABCD$, with edge length $a$.

kvantmathematicsolympiad
CF 2013F1 - Game in Tree (Easy Version)

We are given a tree. One player, Alice, always starts at vertex 1. The other player, Bob, starts at a vertex that lies on a fixed simple path between two vertices u and v.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresdpgamesgreedyimplementationtrees
CF 2013A - Zhan's Blender

Zhan has a number of fruits, and he wants to blend all of them as quickly as possible using a blender with two constraints. Each second, he can put at most a fixed number of fruits into the blender, and the blender can process a maximum number of fruits per second.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 2014H - Robin Hood Archery

For each query we look only at the subarray $al, a{l+1}, dots, ar$. Robin moves first. On every turn a player chooses any remaining target, gains its value, and removes it.

codeforcescompetitive-programmingdata-structuresdivide-and-conquergreedyhashing
CF 2014G - Milky Days

We are tracking Little John's milk consumption over time. He receives milk in discrete batches, each associated with a day and a quantity. Milk has a freshness limit k days, meaning that milk acquired on day di will spoil after day di + k - 1.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedyimplementation
CF 2014F - Sheriff's Defense

We are given a tree where each node represents a camp holding some amount of gold. We may choose certain camps to “strengthen”. Strengthening a camp does not change its own gold directly, but it reduces the gold of all its neighbors by a fixed amount $c$.

codeforcescompetitive-programmingdfs-and-similardpgreedytrees
CF 2014D - Robert Hood and Mrs Hood

Each job occupies an interval of days [l, r]. A visitor stays for exactly d consecutive days, so choosing a start day s means the visit covers the interval [s, s + d - 1]. A job is counted if it overlaps the visit at least once. The amount of overlap does not matter.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedysortings
CF 2014E - Rendez-vous de Marian et Robin

We are working on a weighted undirected graph where two people start from opposite ends and want to meet as quickly as possible. One starts at vertex 1 and the other at vertex n.

codeforcescompetitive-programmingdfs-and-similargraphsshortest-paths
CF 2014C - Robin Hood in Town

We are asked to determine how much extra gold must be added to the richest person in a town so that strictly more than half of the population becomes unhappy. Each person's happiness depends on whether their wealth is less than half of the average wealth of the town.

codeforcescompetitive-programmingbinary-searchgreedymath
CF 2014A - Robin Helps

This is a construction and impossibility problem (type D/B hybrid). For each case, the task is either to construct an explicit set of numbers such that all sums of three distinct elements are prime, or to prove that no such set exists. Each of the four subcases is independent.

codeforcescompetitive-programminggreedyimplementation
CF 2014B - Robin Hood and the Major Oak

The tree produces new leaves every year. In year $i$, it grows $i^i$ leaves. Leaves do not stay forever. A leaf created in year $i$ remains on the tree for exactly $k$ years, meaning it is present during years $i, i+1, dots, i+k-1$.

codeforcescompetitive-programmingmath
Kvant Math Problem 475

Assume that an equilateral triangle has all three vertices at lattice points.

kvantmathematicsolympiad
CF 2018F3 - Speedbreaker Counting (Hard Version)

We are asked to count arrays of integers representing "time limits" for conquering cities in a row, and then categorize those arrays by how many starting cities allow a valid conquest.

codeforcescompetitive-programmingdpgreedymath
CF 2018F1 - Speedbreaker Counting (Easy Version)

The problem asks us to count arrays of length $n$ where each element $ai$ is a positive integer between 1 and $n$, and to categorize these arrays based on how many starting cities allow a sequential conquest without violating the upper limits $ai$.

codeforcescompetitive-programmingcombinatoricsdpgreedymath
CF 2018F2 - Speedbreaker Counting (Medium Version)

I can't provide a complete, correct editorial and implementation for this problem from the information available here. I was able to retrieve the official editorial hints and the high-level solution outline.

codeforcescompetitive-programmingdpgreedymath
CF 2018E1 - Complex Segments (Easy Version)

We are given a collection of closed segments on a number line, each defined by a left and right endpoint. The goal is to identify the largest possible subset of these segments that forms a "complex" set.

codeforcescompetitive-programmingbinary-searchdata-structuresdivide-and-conquerdsugreedymathsortings
CF 2018E2 - Complex Segments (Hard Version)

Producing a fully correct editorial for Codeforces 2018E2 requires reconstructing a fairly intricate DSU-based optimization and the divide-and-conquer evaluation of all values of $f(m)$.

codeforcescompetitive-programmingbinary-searchdata-structuresdivide-and-conquerdsugreedymathsortings
CF 2018D - Max Plus Min Plus Size

We are given a one-dimensional array of positive integers and the ability to color some elements red. The restriction is that no two consecutive elements can be red.

codeforcescompetitive-programmingdata-structuresdpdsugreedyimplementationmatricessortings
CF 2018C - Tree Pruning

We are given a tree rooted at node 1, and we can remove leaves one by one along with their connecting edges. The goal is to make all remaining leaves equidistant from the root. A leaf is any node with degree 1 that is not the root.

codeforcescompetitive-programmingbrute-forcedfs-and-similargreedysortingstrees
CF 2018A - Cards Partition

We are given multiple independent scenarios. In each one, we start with a multiset of cards where each integer value from $1$ to $n$ appears a certain number of times. We are allowed to add up to $k$ extra cards of any values we choose.

codeforcescompetitive-programming2-satbrute-forcegreedyimplementationmath
CF 2018B - Speedbreaker

We are given a line of cities, each city indexed from left to right, and each city comes with a deadline that tells us how late it is allowed to be conquered.

codeforcescompetitive-programmingbinary-searchdata-structuresdpgreedyimplementationtwo-pointers
CF 2019B - All Pairs Segments

We are given a set of points on the number line, each at a distinct positive integer coordinate, and we want to understand coverage by segments formed between every pair of points.

codeforcescompetitive-programmingimplementationmath
CF 2019A - Max Plus Size

We are given an array of positive integers and asked to select a subset of elements to color red, subject to a simple restriction: no two red elements can be adjacent.

codeforcescompetitive-programmingbrute-forcedpgreedy
CF 2020E - Expected Power

We are given an array of integers, each with an independent probability of being included in a random multiset. The task is to compute the expected value of the square of the XOR of all selected elements.

codeforcescompetitive-programmingbitmasksdpmathprobabilities
Kvant Math Problem 496

A six-digit number can be written as the product of two three-digit numbers if and only if it belongs to the set

kvantmathematicsolympiad