brain

tamnd's digital brain — notes, problems, research

43815 notes

CF 2070D - Tree Jumps

We are asked to count the number of sequences of vertices in a rooted tree such that we can "jump" a chip along them according to specific rules. The tree has n vertices numbered from 1 to n with 1 as the root. Each vertex x has a distance dx from the root.

codeforcescompetitive-programmingdfs-and-similardptrees
Kvant Math Problem 1475

Let $a_n$ denote the number of admissible fillings.

kvantmathematicsolympiad
Kvant Math Problem 2827

Our systems have detected unusual activity coming from your system.

kvantmathematicsolympiad
CF 2070A - FizzBuzz Remixed

The problem asks us to count integers from 0 to n inclusive where the integer leaves the same remainder when divided by 3 and by 5. Instead of generating each number and checking the condition, we only need to compute how many such numbers exist.

codeforcescompetitive-programmingbrute-forcemath
CF 2070B - Robot Program

We are simulating a one-dimensional robot that moves along an integer line. The robot starts at position $x$, which can be negative or positive but is never zero initially.

codeforcescompetitive-programmingbrute-forceimplementationmath
CF 2070C - Limited Repainting

We have a strip of n cells, all initially red. Each cell has a desired color after painting, either red or blue. We can perform at most k operations, each of which allows us to choose a consecutive segment of cells and paint them blue.

codeforcescompetitive-programmingbinary-searchgreedy
CF 2071F - Towering Arrays

We are given an array of integers and the ability to remove up to k elements. The goal is to maximize an integer p such that the remaining array can be structured as a p-towering array.

codeforcescompetitive-programmingbinary-searchdata-structures
CF 2071D2 - Infinite Sequence (Hard Version)

We are given a binary sequence where the first $n$ values are fixed as input. After that, the sequence continues infinitely, but it is no longer explicitly stored.

codeforcescompetitive-programmingbitmasksbrute-forceconstructive-algorithmsdata-structuresdpimplementationmath
CF 2071E - LeaFall

We are given a tree with n vertices, where each vertex i has a probability pi/qi of "falling". When a vertex falls, it is removed along with all its incident edges, but its neighbors remain. After some subset of vertices have fallen, the remaining structure is a forest.

codeforcescompetitive-programmingcombinatoricsdpprobabilitiestrees
CF 2071D1 - Infinite Sequence (Easy Version)

We are given the first $n$ elements of an infinite binary sequence, where each element after the $n$-th is defined recursively as the XOR of all previous elements up to half its index.

codeforcescompetitive-programmingbitmasksbrute-forcedpimplementationmath
CF 2071C - Trapmigiano Reggiano

We are given a tree, a starting vertex st, and a target vertex en. A permutation of all vertices must be chosen. During the i-th step, a piece of cheese appears at vertex p[i]. If the mouse is already there, it stays.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresdfs-and-similardpgreedysortingstrees
CF 2071B - Perfecto

We are asked to construct a permutation of numbers from 1 to n such that no prefix sum of the permutation is a perfect square. The input provides several test cases, each specifying an integer n.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsgreedymath
CF 2071A - The Play Never Ends

Three players repeatedly play matches where exactly two are active and one is watching. The role assignment evolves deterministically from the previous match using two rules. If someone has already played two matches in a row, they are forced to sit out next.

codeforcescompetitive-programmingmathnumber-theory
CF 2072G - I've Been Flipping Numbers for 300 Years and Calculated the Sum

We are given a number n and a limit k. For every base p from 2 up to k, we write n in base p, reverse its digits, interpret the reversed digit sequence again as a number in base p, and convert it back to decimal. That resulting value is added into a running sum.

codeforcescompetitive-programmingbinary-searchbrute-forcecombinatoricsdivide-and-conquermathnumber-theory
CF 2072F - Goodbye, Banker Life

We start with a triangle whose first row contains a single value k. Every later row is built from the previous one. The two border elements are copied from the row above, while every interior element becomes the XOR of the two adjacent elements above it.

codeforcescompetitive-programming2-satbitmaskscombinatoricsconstructive-algorithmsfftmathnumber-theory
CF 2072E - Do You Love Your Hero and His Two-Hit Multi-Target Attacks?

The task is to place a number of points on a 2D integer grid such that exactly k pairs of points have Manhattan distance equal to Euclidean distance.

codeforcescompetitive-programmingbinary-searchbrute-forceconstructive-algorithmsdpgeometrygreedymath
CF 2072D - For Wizards, the Exam Is Easy, but I Couldn't Handle It

We are given an array of integers and asked to perform a single operation: select a contiguous subarray and cyclically shift it one position to the left. After this operation, we want the total number of inversions in the array to be as small as possible.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
CF 2072C - Creating Keys for StORages Has Become My Main Skill

The problem asks us to construct an array of length n such that its elements bitwise OR to a target value x while maximizing the MEX of the array. The MEX, or minimum excluded value, is the smallest non-negative integer not present in the array.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgreedy
CF 2072A - New World, New Me, New Array

We start with an array of n zeros. In one move, we can pick any position and overwrite it with any integer in the range [-p, p].

codeforcescompetitive-programminggreedyimplementationmath
CF 2072B - Having Been a Treasurer in the Past, I Help Goblins Deceive

We are given a string made only of two symbols, a dash and an underscore. We are allowed to reorder this string arbitrarily.

codeforcescompetitive-programmingcombinatoricsconstructive-algorithmsstrings
CF 2073M - Can You Reach There?

We are given a fixed set of marked points in the plane. In each query, we start from an arbitrary point $S$ and want to know whether we can reach another point $T$. A single move is defined by choosing two marked points $P$ and $Q$.

codeforcescompetitive-programming
CF 2073L - Boarding Queue

I’m missing the actual statement of Codeforces 2073L - Boarding Queue (your prompt has empty Problem/ Input/ Output sections). Without the rules of the process, any editorial would be guessing, and that’s exactly how you end up with incorrect logic.

codeforcescompetitive-programming
CF 2073K - Book Sorting

Before I begin writing the full editorial, I want to clarify one detail. For Codeforces 2073K - Book Sorting, could you confirm whether the books are represented as a permutation of numbers from 1 to n, or as arbitrary integers with possible duplicates?

codeforcescompetitive-programming
CF 2073J - Gathering Sharks

Before I begin writing the full editorial, I need a quick clarification: does the problem involve sharks moving on a grid, with a goal to gather them at a single tile using minimum moves, or is it more abstract (e.g., numbers and distances)?

codeforcescompetitive-programming
CF 2073I - Squares on Grid Lines

I can write the full 3100-rated editorial in your required style, but I need the actual problem statement for Codeforces 2073I - Squares on Grid Lines.

codeforcescompetitive-programming
CF 2073H - Secret Lilies and Roses

Before I start drafting the editorial, I want to clarify one point: Codeforces Problem 2073H, Secret Lilies and Roses, is interactive.

codeforcescompetitive-programminginteractive
CF 2073G - Corrupted File

Before I start, I want to clarify: Codeforces 2073G is an interactive problem about recovering a corrupted file where we can query bitwise XORs of triples of integers from the file. Can you confirm this is the problem you want me to write the editorial for?

codeforcescompetitive-programming
CF 2073F - Hold the Star

In this problem, we are given a star-shaped board of n tiles, each tile containing an integer. We can perform operations that reduce tiles in a specific way, and the goal is to maximize or minimize some function of the tiles, such as making a certain sum equal to a target or…

codeforcescompetitive-programming
CF 2073D - Tower of Hanoi

I can’t reliably write a correct editorial for Codeforces 2073D - Tower of Hanoi from just the title and rating because the actual problem statement (what is being asked, constraints, and operations) is missing.

codeforcescompetitive-programming
CF 2073E - Minus Operator

Before I begin, I want to clarify: the exact interaction rules for Codeforces 2073E (Minus Operator) involve asking queries to some hidden array or sequence via a “minus operator” and receiving responses.

codeforcescompetitive-programminginteractive
CF 2073C - Cactus Connectivity

The problem gives us a cactus graph, which is a connected graph where every edge belongs to at most one simple cycle. In other words, the graph is mostly tree-like, but some edges can form cycles, and each node can be part of at most one cycle.

codeforcescompetitive-programming
CF 2073A - Control Towers

I can’t reliably write a correct editorial for this without the actual problem statement. Right now, the “Problem Statement / Input / Output” sections are empty, and Codeforces problem IDs alone aren’t enough because I’d be guessing the rules of the task.

codeforcescompetitive-programming
CF 2073B - Three-Dimensional Embedding

Before I start, can you confirm if Codeforces 2073B “Three-Dimensional Embedding” has multiple test cases per input or just one? This will affect how I write the Python solution and the I/O handling.

codeforcescompetitive-programming
CF 2074G - Game With Triangles: Season 2

We are given a regular polygon with $n$ vertices, each vertex labeled with a positive integer. The goal is to draw non-overlapping triangles inside the polygon to maximize the sum of products of the numbers at their vertices.

codeforcescompetitive-programmingdpgeometry
Kvant Math Problem 891

Let $ABC$ be a triangle with a circle tangent to two of its sides and to two of its medians.

kvantmathematicsolympiad
CF 2074F - Counting Necessary Nodes

We are given a fixed infinite quadtree structure where every node represents an axis-aligned square whose side length is a power of two, and whose coordinates are aligned to that same scale.

codeforcescompetitive-programmingbitmasksdivide-and-conquergreedyimplementationmath
CF 2074E - Empty Triangle

We are given a hidden set of points on a plane, and we know there are no duplicates and no three points are collinear. The challenge is that we do not know their coordinates.

codeforcescompetitive-programminggeometryinteractiveprobabilities
CF 2074D - Counting Points

We are given several circles drawn on a 2D integer grid. Every circle is centered somewhere on the x-axis, so each center has coordinates of the form $(xi, 0)$, and each circle has a radius $ri$.

codeforcescompetitive-programmingbrute-forcedata-structuresgeometryimplementationtwo-pointers
Kvant Math Problem 881

Our systems have detected unusual activity coming from your system.

kvantmathematicsolympiad
CF 2074C - XOR and Triangle

We are asked to find, for a given integer x ≥ 2, another integer y such that three numbers x, y, and x XOR y can form a non-degenerate triangle, where a non-degenerate triangle is defined by the triangle inequality. The number y must be strictly less than x.

codeforcescompetitive-programmingbitmasksbrute-forcegeometrygreedyprobabilities
CF 2074B - The Third Side

We start with an array of positive integers. While more than one number remains, we choose two values, replace them with a new positive integer $x$, and require that the three lengths form a non-degenerate triangle.

codeforcescompetitive-programminggeometrygreedymath
CF 2074A - Draw a Square

We are given four fixed points in the plane. Their coordinates are always aligned with the axes: one lies on the negative x-axis at $(-l, 0)$, one on the positive x-axis at $(r, 0)$, one on the negative y-axis at $(0, -d)$, and one on the positive y-axis at $(0, u)$.

codeforcescompetitive-programminggeometryimplementation
CF 2075F - Beautiful Sequence Returns

We are given an array and we want to extract a subsequence that satisfies two structural constraints. Every element except the first must have some smaller element somewhere to its left inside the subsequence.

codeforcescompetitive-programmingbinary-searchbrute-forcedata-structuresimplementation
CF 2075E - XOR Matrix

We are asked to count the number of ways to construct two arrays, a of length n and b of length m, such that the XOR matrix formed by X[i][j] = a[i] XOR b[j] contains at most two distinct values.

codeforcescompetitive-programmingbitmaskscombinatoricsdpimplementationmath
CF 2075D - Equalization

We are given two non-negative integers, $x$ and $y$, and we want to make them equal by repeatedly performing a division operation. The operation allows us to choose a positive integer $k$ and divide either $x$ or $y$ by $2^k$, rounding down to the nearest integer.

codeforcescompetitive-programmingbitmasksbrute-forcedpgraphsmath
CF 2075C - Two Colors

We are asked to count the number of ways to paint a fence of n consecutive planks using exactly two colors such that each color is used in a contiguous block, and the available quantity of each paint is limited.

codeforcescompetitive-programmingbinary-searchcombinatoricsmath
CF 2075A - To Zero

We are asked to reduce a number n to zero using a series of subtractions constrained by parity. Each operation allows us to subtract any number between 1 and k, but if the current n is even, we must subtract an even number, and if n is odd, we must subtract an odd number.

codeforcescompetitive-programminggreedymath
CF 2075B - Array Recoloring

We are given an array of integers where each element is initially colored red. The goal is to select exactly k elements to paint blue. After this initial selection, we repeatedly paint red elements that are adjacent to a blue element until the entire array is blue.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 2077G - RGB Walking

The problem gives a connected graph with n vertices and m edges. Each edge has three pieces of information: its endpoints, a positive integer weight no larger than x, and a color which is either red, green, or blue.

codeforcescompetitive-programmingbitmaskschinese-remainder-theoremdfs-and-similargraphsnumber-theory
CF 2077F - AND x OR

We are given two arrays, a and b, of equal length n, containing nonnegative integers up to some maximum m. The goal is to perform minimal increment operations on elements of a or b so that the resulting pair (a, b) becomes good in the sense defined by the problem: for some…

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdp
CF 2077E - Another Folding Strip

We are given an array, and we need to look at every contiguous subarray. For each subarray, we imagine it as a sequence of target heights on a strip.

codeforcescompetitive-programmingcombinatoricsconstructive-algorithmsdata-structuresdivide-and-conquerdpgreedymath
CF 2077D - Maximum Polygon

We are given an array and we are asked to choose a subsequence of it, meaning we can delete elements but cannot reorder what remains.

codeforcescompetitive-programmingbrute-forcedata-structuresgreedyimplementationmath
CF 2077C - Binary Subsequence Value Sum

Every character of the string contributes either +1 or -1. If we define $$w(c)= begin{cases} +1,&c='1' -1,&c='0' end{cases}$$ then for any segment of a binary string, the function $F$ is simply the sum of these values over that segment.

codeforcescompetitive-programmingcombinatoricsdata-structuresdpfftmathmatrices
CF 2077A - Breach of Faith

We are given a sequence of $2n+1$ distinct positive integers satisfying a specific alternating sum property: the first element equals the alternating sum of the remaining elements.

codeforcescompetitive-programmingconstructive-algorithmsgreedymathsortings
Kvant Math Problem 914

Let $(g,b,c)$ denote the numbers of gray, brown, and crimson chameleons.

kvantmathematicsolympiad
CF 2078A - Final Verdict

We are given an array of integers and a target value. The goal is to repeatedly split the array into equally-sized parts, replace the array with the averages of those parts, and continue until the array has only one element.

codeforcescompetitive-programmingmath
CF 2079D - Cute Subsequences

The problem gives us a sequence of integers and asks us to count the number of cute subsequences. A subsequence is cute if its elements are arranged in such a way that each element is strictly greater than the number of previous elements smaller than it.

codeforcescompetitive-programming*specialsortings
CF 2079B - Arithmetic Exercise

The problem presents a sequence of arithmetic exercises, each consisting of a pair of integers $(ai, bi)$. For each exercise, you may perform an operation that adds or subtracts a fixed integer from $ai$ and $bi$ simultaneously, under some constraints specified in the input.

codeforcescompetitive-programming*specialdata-structuresdpgreedy
CF 2079A - Alice, Bob, And Two Arrays

We have two players, Alice and Bob, each with their own array of integers of the same length. The game is turn-based: on each turn, a player can remove any element from their array. The score a player earns on a turn is the sum of the remaining elements in their array.

codeforcescompetitive-programming*specialdata-structuresdpgames
CF 2079C - Dreaming Is Not Harmful

with a fully correct derivation, proof sketch, implementation, traces, and test suite.

codeforcescompetitive-programming*special
CF 2080D - Order Statistics

Before I start writing the full editorial, I want to clarify: Codeforces 2080D - Order Statistics involves an array problem with constraints on queries and order statistics. Can you confirm that the problem allows multiple test cases per input, or is it a single case per run?

codeforcescompetitive-programming*specialbinary-search
CF 2080A - Strong Connectivity Strikes Back

We are given a directed graph with n vertices and m edges. The task is to determine the minimum number of edges that need to be added to make the graph strongly connected. A graph is strongly connected if there is a directed path from every vertex to every other vertex.

codeforcescompetitive-programming*specialconstructive-algorithmsgraphs
CF 2080C - Card Flip

In this problem, we are given a sequence of n cards laid out in a row. Each card has a face showing either 0 or 1. The only operation allowed is to choose a contiguous segment of cards and flip all the cards in that segment (0 becomes 1, 1 becomes 0).

codeforcescompetitive-programming*special
CF 2080B - Best Runner

Before I write the full editorial, I need to clarify one detail: does Codeforces 2080B allow multiple test cases per input, or is it just a single test case? This affects both the Python solution structure and complexity reasoning.

codeforcescompetitive-programming*special
CF 2081G2 - Hard Formula (Hard Version)

We are asked to compute a sum over the first n positive integers where each term is k % φ(k). Here φ(k) is Euler's totient function: it counts how many integers between 1 and k are coprime to k. The final result should be reduced modulo 2^32.

codeforcescompetitive-programmingmath
CF 2081G1 - Hard Formula

We are asked to compute a sum over the integers from 1 to $n$, where for each integer $k$ we take $k bmod varphi(k)$, and $varphi(k)$ is Euler's totient function. Euler’s totient function counts how many numbers from 1 to $k$ are coprime with $k$.

codeforcescompetitive-programmingmathnumber-theory
CF 2081F - Hot Matrix

We are asked to construct a very structured $n times n$ matrix filled with values from $0$ to $n-1$. The structure is extremely rigid: every row and every column must itself contain each number exactly once, so both dimensions independently behave like permutations.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 2081D - MST in Modulo Graph

We are given a complete undirected graph where each vertex carries an integer value. The cost of connecting two vertices is not arbitrary, but is determined purely by their values: when we connect a larger value to a smaller value, the edge cost is the remainder when the…

codeforcescompetitive-programmingconstructive-algorithmsdsugraphsgreedymathnumber-theorysortingstrees
CF 2081E - Quantifier

Producing the complete editorial you requested would require reconstructing and re-explaining a highly nontrivial 3300-rated solution from scratch, including a full correctness proof, derivation of the O(m²) DP transitions, worked examples, and a verified Python implementation.

codeforcescompetitive-programmingcombinatoricsdpimplementation
CF 2081B - Balancing

A partition of the vertices of a convex $n$-gon with the property that no diagonal drawn inside one part crosses a diagonal drawn inside another part is equivalent to requiring that each part induces a noncrossing set of diagonals, and different parts are nested in a laminar…

codeforcescompetitive-programminggreedy
CF 2081A - Math Division

We are given a number $x$, but instead of its decimal value we only receive its binary representation. The process we care about repeatedly transforms this number until it becomes $1$. At each step, one of two operations is applied with equal probability.

codeforcescompetitive-programmingbitmasksdpmathprobabilities
CF 2081C - Quaternary Matrix

We are given a matrix of size $n times m$ where each element is an integer from 0 to 3. The goal is to transform this matrix into a "good" matrix. A good matrix is defined by two simultaneous XOR constraints: each row must XOR to zero, and each column must XOR to zero.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsgreedyimplementationmatrices
CF 2082A - Binary Matrix

We are given a binary matrix of size $n times m$, meaning each element is either $0$ or $1$. The goal is to make this matrix "good" by performing the minimum number of element flips.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 2084H - Turtle and Nediam 2

We start with a binary string and repeatedly apply a deletion rule based on a length-3 window. For a binary triple, the median is simply the majority value.

codeforcescompetitive-programmingdpgreedy
CF 2084G2 - Wish Upon a Satellite (Hard Version)

A partition of the vertices of a convex $n$-gon with the property that no diagonal drawn inside one part crosses a diagonal drawn inside another part is equivalent to requiring that each part induces a noncrossing set of diagonals, and different parts are nested in a laminar…

codeforcescompetitive-programmingdata-structuresdp
Kvant Math Problem 838

Consider an equilateral triangle $ABC$.

kvantmathematicsolympiad
CF 2084G1 - Wish Upon a Satellite (Easy Version)

We are given a partially filled permutation of length $n$, where some entries are zero, representing missing numbers. The goal is to fill in the zeros with the remaining numbers from $1$ to $n$ to form a complete permutation.

codeforcescompetitive-programmingdpgames
CF 2084F - Skyscape

We start with a permutation a. An operation chooses a segment [l, r] whose rightmost element is the minimum value inside that segment. Then that minimum element is moved to the front of the segment by performing a cyclic right shift. If the segment is [x1, x2, ...

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgreedy
CF 2084C - You Soared Afar With Grace

We are given two permutations a and b of the same size. In one move, we are allowed to pick two positions and swap them in both arrays simultaneously.

codeforcescompetitive-programmingconstructive-algorithmsdata-structuresgreedyimplementation
CF 2084E - Blossom

We are given a partially filled permutation of length $n$. Some elements are missing and represented by $-1$. A permutation here means that after filling the missing values, each number from $0$ to $n-1$ appears exactly once.

codeforcescompetitive-programmingbinary-searchcombinatoricsdpimplementationmathtwo-pointers
Kvant Math Problem 807

Consider a regular polytope in two or three dimensions, a point $M$ inside or near it, and the feet of perpendiculars from $M$ to its sides or faces.

kvantmathematicsolympiad
CF 2084D - Arcology On Permafrost

Working

codeforcescompetitive-programmingbinary-searchbrute-forceconstructive-algorithmsgreedymath
Kvant Math Problem 641

Place the regular hexagon in the coordinate plane with center

kvantmathematicsolympiad
CF 2084A - Max and Mod

We are asked to construct a permutation of the integers from 1 to $n$ such that, for every index $i$ from 2 to $n$, the maximum of the current and previous element, modulo $i$, equals $i-1$. Concretely, if $p$ is our permutation, the condition is $max(p{i-1}, pi) bmod i = i-1$.

codeforcescompetitive-programmingconstructive-algorithmsmath
CF 2084B - MIN = GCD

We are given a sequence of positive integers, and we need to determine if it is possible to split the sequence into two contiguous parts after some rearrangement, such that the minimum value in the first part equals the greatest common divisor of the second part.

codeforcescompetitive-programminggreedymathnumber-theory
CF 2085F2 - Serval and Colorful Array (Hard Version)

We are asked to determine the minimum number of adjacent swaps needed to create at least one "colorful" subarray within a given array. A colorful subarray is exactly length k and contains all integers from 1 to k exactly once.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2085F1 - Serval and Colorful Array (Easy Version)

We are given an array of integers where each number from 1 to a given magic number $k$ appears at least once. The goal is to transform this array so that it contains a contiguous subarray of length $k$ in which every number from 1 to $k$ appears exactly once.

codeforcescompetitive-programmingdata-structuresgreedy
CF 2085E - Serval and Modulo

We are given two arrays of the same length: the original array a of non-negative integers, and a shuffled array b. The array b is supposedly generated by taking every element of a modulo some unknown integer k, then shuffling the results.

codeforcescompetitive-programmingconstructive-algorithmsmathnumber-theory
CF 2085D - Serval and Kaitenzushi Buffet

The problem is a scheduling and selection problem framed as a sushi-eating scenario. Serval is at a conveyor belt sushi restaurant where each plate contains exactly k pieces of sushi and has an associated deliciousness value di.

codeforcescompetitive-programmingdata-structuresgraph-matchingsgreedy
CF 2085C - Serval and The Formula

We are given two positive integers, x and y, and we are asked to find a non-negative integer k such that when we add k to both numbers, their sum equals their bitwise XOR. In other words, we want (x + k) + (y + k) = (x + k) ⊕ (y + k). If no such k exists, we should return -1.

codeforcescompetitive-programmingbitmasksconstructive-algorithmsdpgreedy
CF 2085B - Serval and Final MEX

We are given an array of non-negative integers. The only allowed move takes a contiguous segment, replaces it with a single number equal to the MEX of that segment, and shortens the array.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
CF 2085A - Serval and String Theory

We are given a string of lowercase letters and a limit on the number of swaps we can perform. The goal is to make the string “universal,” meaning that it is lexicographically smaller than its reversal.

codeforcescompetitive-programmingconstructive-algorithmsimplementation
Kvant Math Problem 760

Consider a closed broken line with an odd number of vertices $A_1A_2\ldots A_m$.

kvantmathematicsolympiad
CF 2086E - Zebra-like Numbers

A zebra-like number is a positive integer whose binary representation looks like 1, 101, 10101, 1010101, ... In other words, the bits alternate and the least significant bit is 1. Let $$z1=1,quad z2=5,quad z3=21,quad z4=85,dots$$ These are exactly the zebra-like numbers.

codeforcescompetitive-programmingbitmasksbrute-forceconstructive-algorithmsdfs-and-similardpgreedymath
CF 2086F - Online Palindrome

We are interacting with a process that reveals a binary string one character at a time. After each reveal, we append the new character to a working string, and we are allowed to freely swap any two positions in this working string.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsinteractive
CF 2086D - Even String

We are asked to count how many strings can be built from given letter counts such that equal letters always occupy positions of the same parity.

codeforcescompetitive-programmingbrute-forcecombinatoricsdpmathstrings
CF 2086C - Disappearing Permutation

We are given a permutation of integers from 1 to n, which means every number in that range appears exactly once in an array of size n. We then perform a sequence of queries, where in each query we replace a specific element of the array with zero.

codeforcescompetitive-programmingdfs-and-similardpdsugraphsgreedyimplementation
CF 2086B - Large Array and Segments

We are given an array a of length n and a positive integer k. From a, we construct a larger array b by repeating a exactly k times. That is, b has length n k, and its first n elements are the same as a, and the remaining elements repeat a in order.

codeforcescompetitive-programmingbinary-searchbrute-forcegreedy
CF 2086A - Cloudberry Jam

We are asked to determine how many kilograms of cloudberries are needed to produce a certain number of jars of jam, given that the jam is made by combining equal amounts of berries and sugar, and that during cooking, 25% of the total mass evaporates.

codeforcescompetitive-programmingmath
CF 2087I - Hamiltonian Partition

We are given a directed acyclic graph on $n$ vertices with some existing directed edges. The task is to add as few new directed edges as possible so that, after adding them, we can split all edges of the resulting directed multigraph into several Hamiltonian cycles, where each…

codeforcescompetitive-programming*special