brain
tamnd's digital brain — notes, problems, research
43815 notes
We are given a binary string and we want to transform it into a string of all ones. Two types of operations are available: we can reverse any contiguous segment for a cost, or we can flip all bits in a contiguous segment for a cost.
We are given several packets, each packet containing a known number of balloons. The task is to split these packets between two people so that each packet goes entirely to exactly one of them. No packet can be broken, and both people must receive at least one packet.
We are given a directed graph where cities are nodes and roads are one-way edges. One city is designated as the capital. The goal is to ensure that every city can be reached by following directed roads starting from the capital.
We are given a list of problems arranged in a fixed order from left to right, where each problem has a difficulty value. Mishka has a skill level k, meaning he can only solve problems whose difficulty does not exceed k.
We are given a string that has already been transformed by a deterministic process involving repeated reversals of prefixes.
We are working on a weighted tree where every vertex has a positive value and every edge has a positive cost. A path is not required to be simple in the usual sense: edges are allowed to be traversed up to two times, and vertices can be visited multiple times.
We are given a static array and many independent queries, each query asking us to inspect a contiguous segment of the array and return any value that appears exactly once inside that segment. If no such value exists in that segment, the answer is zero.
We are given a time interval from 0 to M during which a lamp is initially on. The lamp has a predefined list of switching moments. At each moment in this list, the lamp flips between on and off instantly.
We are given a collection of segments on a very large number line. Each segment covers every integer point between its endpoints, including both ends. Different segments may overlap in arbitrary ways: they can be disjoint, nested, identical, or partially intersecting.
We are given access to a black-box quantum oracle that encodes a boolean function over all $2^N$ binary inputs of length $N$. For any input bitstring $x$, the oracle evaluates $f(x)$ without revealing the function explicitly.
We are given a register of qubits representing an integer in binary form, along with an additional qubit that acts as a target bit.
We are given a very small quantum program interface: an array of qubits x, a single qubit y, and an index k. The task is to implement a reversible transformation that encodes a classical function into a quantum oracle. The function itself is extremely simple.
We are given an array of qubits, but the important promise is simpler than the quantum framing suggests: the system is guaranteed to be in one of two classical computational basis states.
We are given a small register of up to eight qubits, all initially prepared in the all-zero computational basis state.
We are given a single qubit that has been prepared in one of two possible states. These two states are not computational basis states like The task is to interact with this qubit using allowed quantum operations, perform a measurement, and return an integer that identifies…
We are given a pair of qubits that were prepared in one of four specific two-qubit entangled states. These four states form the Bell basis, meaning they are maximally entangled and differ only by relative phase and bit flips, not by local classical information on each qubit.
We are working in a quantum setting with two qubits that initially form the computational basis state corresponding to both being zero. The task is to transform these two qubits in-place into one of four specific entangled states, chosen by an integer index from 0 to 3.
We are working in a quantum programming setting where a single qubit is already in a known initial basis state, and we are asked to transform it into one of two target basis states depending on the value of an integer parameter called sign.
We are given a black-box quantum operation that acts on N input qubits plus one auxiliary qubit. Internally, this operation encodes a hidden binary array of length N.
We are interacting with an oracle that hides a binary string of length $N$. Each position in this hidden string is either 0 or 1. The oracle does not reveal the string directly.
We are working in a quantum setting where three input qubits represent a binary vector of length three, and an additional qubit acts as an output register.
We are given a small quantum circuit setting where the input consists of an $N$-qubit register $x$, a single target qubit $y$, and a classical binary vector $b$ of length $N$.
We are given a single qubit guaranteed to be in one of two possible pure states. One state is the classical basis state $ The output of the operation must be one of three integers.
We are given a very small quantum system consisting of two parts: an input register of N qubits and a single output qubit. Alongside this, we are given a classical binary vector b of length N.
We are given a single qubit that is prepared in one of two possible pure states with equal probability. One of them is the computational basis state $ The task is not to deterministically identify the state, but to implement a quantum procedure that produces a classical bit…
We are given a system of two qubits that is guaranteed to be in one of four mutually orthogonal entangled states. These states form a complete basis for two-qubit space, so exactly one of them is present, and the task is to identify which one.
We are given a 2-qubit system that is guaranteed to be in exactly one of four mutually orthogonal quantum states. Each of these states is a different encoding of a two-bit piece of information, but not in the standard computational basis.
We are working with a register of $N = 2^k$ qubits, where $k le 4$, so $N le 16$. The system starts in the all-zero computational basis state, meaning every qubit is in $ A W state over $N$ qubits is a uniform superposition of all basis states that contain exactly one qubit in…
We are given a small system of qubits, at most eight of them, prepared in one of two highly structured quantum states. One of them is the GHZ state, which behaves like a perfect global correlation between all qubits being simultaneously zero or simultaneously one when measured.
We are given a very small system of qubits, at most eight of them, and the system is guaranteed to be prepared in exactly one of two highly structured quantum states.
We are working in a quantum setting where an initial register of $N le 8$ qubits starts in the all-zero computational basis state. Alongside this register, we are given two classical bitstrings of equal length, each describing a valid basis state on these qubits.
We start with a register of up to eight qubits, all initialized in the all-zero computational basis state. Alongside this, we are given a classical description of another basis state as a boolean array, where each entry indicates whether the corresponding qubit should be in…
We start with a system of N independent two-level quantum bits, all initially in the state corresponding to zero. In computational terms, this is the single basis state where every qubit is 0.
We are asked to build a tree with a fixed number of nodes such that two structural constraints hold simultaneously: the longest simple path in the tree has length exactly d, and every vertex is incident to at most k edges. If no such tree can exist, we must report impossibility.
We are given a multiset of coin values, where every coin is a power of two. Each query asks whether we can form a target sum using a subset of these coins, and if so, what the minimum number of coins needed is.
We are given a document as a sequence of words. The structure is fixed: words are separated by single spaces, so the underlying object is really just an array of strings.
We are asked to construct a binary string made of zeros and ones with two constraints that interact with each other in a nontrivial way. First, the string must contain exactly a zeros and exactly b ones, so the total length is fixed as n = a + b.
We are given a sequence of daily temperatures and asked to evaluate all contiguous time intervals whose length is at least a given threshold. For each such interval, we compute its average temperature, meaning the sum of its values divided by its length.
We are given a multiset of coin values, and we need to place every coin into a collection of “pockets” under a simple restriction: inside any single pocket, no value is allowed to repeat.
We are given an array that changes over time and we must repeatedly answer queries about subarrays inside a given segment. For any segment $[l, r]$, we consider every contiguous subarray $[L, R]$ fully contained inside it.
We are given a weighted tree with up to $10^5$ vertices. Each edge has a positive length, so distances are standard shortest-path distances on the tree. We must choose a set of vertices that forms a single simple path in the tree, containing at most $k$ vertices.
We are given a multiset of integers that is known to come from a very specific geometric construction. Somewhere on an unknown grid of size $n times m$, there is exactly one cell containing a zero. Every other cell is filled with its Manhattan distance to that zero cell.
We are given a row of positions, each of which must be filled with one of two possible types. You can think of this as constructing a binary string of length $n$, where each position is either type A or type B.
We are given a set of existing hotels placed on integer points along an infinite number line. We want to open one additional hotel at some integer coordinate. The requirement is that the closest existing hotel to this new one must be at distance exactly $d$.
We are given an array of integers laid out on a line. Two robots start just outside the array, one at the far left moving rightward and one at the far right moving leftward.
We are given a connected undirected graph of cities where city 1 is the capital. From this graph we must select exactly $n-1$ roads so that the selected edges still connect all cities, meaning they form a spanning tree.
We are given a sequence of integers and a fixed value $m$. The task is to count how many contiguous subarrays have the property that when you sort the subarray, its median equals exactly $m$, where for even-length subarrays the median is defined as the left middle element.
We are given a permutation of the integers from 1 to n, and a distinguished value m that appears exactly once somewhere in the array. The task is to count how many contiguous subarrays have the property that, if we sort that subarray, the median element equals m.
We are given a single sequence of integers that represents what Tanya says while climbing stairs in a building. Each time she starts a new stairway, she always begins counting from 1 and increases by 1 for each step until she reaches the last step of that stairway.
We are given a very long decimal string and we are allowed to insert cuts between adjacent digits, splitting it into contiguous chunks.
We are given a multiset of integers, and we are allowed to delete any subset of them. After deletions, we want the remaining elements to satisfy a pairing condition: every remaining value must be able to find at least one other remaining value such that their sum equals a…
We are given two strings, and we are allowed to repeatedly delete only the leftmost character from either string. Each deletion shortens one of the strings by exactly one character.
We are given a rectangular grid where each cell contains a non-negative integer. A path starts at the top-left cell and moves only right or down until it reaches the bottom-right cell.
We are given a rooted tree of officers where each officer has a unique direct superior except the root officer 1. This creates a hierarchy where every node represents an officer and edges point from superior to subordinate.
We are given two strings of equal length, and we are allowed to manipulate them using a small set of swap operations. Each position forms a vertical pair of characters, one from the first string and one from the second.
We are given a sequence of problem difficulties in a fixed order, and we must split this sequence into exactly k consecutive segments. Each segment corresponds to one day of practice, and every problem must belong to exactly one segment.
We are given a sequence of integers, each lying in a very large range up to $10^9$. Mishka repeatedly applies a global transformation rule that acts independently on each value: every pair of consecutive integers $(1,2)$, $(3,4)$, $(5,6)$, and so on, gets swapped in place, but…
We are given a sequence of numbers arranged in a line, and we want to cut this line into three consecutive segments. The first segment starts at the beginning, the second sits in the middle, and the third ends at the last element.
We are dealing with a linear sequence of subway stations, where each station continuously accumulates passengers over time. Initially, each station already has some number of waiting people.
We are given a tree and a collection of “ants”. Each ant comes with two alternative vertex pairs. For each ant, we must decide which of its two pairs it will use.
We are given an array of numbers and allowed to freely reorder them. After rearranging, we compare the new array against the original array position by position.
We are dealing with a hidden pair of integers, both lying in a very large range up to $10^{18}$. The only way to learn about this pair is by repeatedly asking queries of the form $(x, y)$.
We are given a fixed rectangular box with side lengths $A, B, C$. We want to count how many different triples $(a,b,c)$, ordered so that $a le b le c$, can serve as a building block such that copies of this smaller box can exactly tile the larger one, provided every copy is…
We are given a single lowercase word and asked to verify whether it follows a specific phonetic rule. The rule constrains how consonants and vowels can appear in sequence.
We are given a sequence of rectangular tiles placed in a fixed left-to-right order. Each tile has two possible orientations: we can either keep it as width-by-height or rotate it by 90 degrees, which swaps the two values.
We are given a string made only from the first six lowercase letters. We are allowed to rearrange its characters arbitrarily by swapping any positions any number of times, so effectively we can treat it as a multiset of letters with full permutation freedom.
We are given a road split into $n$ unit segments, and each segment has a “base fatigue cost” $ai$ that applies when Leha starts a fresh driving session.
We are working with a rooted tree where vertex 1 is considered the root. For every vertex $x$, we conceptually look at all nodes in its subtree and group them by their distance from $x$ in terms of edges downward in the tree.
We start with an array of length $n$ that initially contains only zeros. Bob performs $m$ operations. Each operation is defined by a pair $(x, d)$, and Bob is allowed to pick a center position $i$ in the array.
We are asked to build a simple undirected graph on vertices numbered from 1 to n. The graph must have exactly m edges, must be connected, and must avoid both self-loops and repeated edges.
We are given a string made only of digits 0, 1, and 2. We are allowed to repeatedly swap adjacent pairs if they are 0 and 1 in either direction, or 1 and 2 in either direction.
The shop presents a line of games, each with a fixed price, and Maxim walks through them strictly from left to right.
We are given a 3D calendar system where every moment is uniquely identified by a triple consisting of a month, a day inside that month, and a second inside that day.
We are given a rooted tree where the root is fixed at vertex 1 and every vertex has at most two children. After a process of “pruning”, we keep a connected set of vertices that must still contain the root.
We are given a set of banknotes, each with a fixed positive value. Natasha can use any number of each type of banknote, including zero, so in effect she can form any total sum that is a non-negative integer linear combination of the given values.
The structure we are given is a rooted tree where every node behaves like a logic component. Leaves are fixed boolean inputs, while internal nodes compute boolean values from their children using standard gates such as AND, OR, XOR, and NOT.
We are trying to determine an unknown integer $x$ in the range from 1 to $m$, but we are not allowed to see it directly. Instead, we can probe it by asking queries with a chosen number $y$.
We are given a fixed route of space travel that starts at Earth, visits several intermediate planets in order, reaches Mars, and then returns back to Earth.
We are given a multiset of characters, each character representing a rocket stage with an intrinsic cost equal to its position in the alphabet.
We are given a collection of food packages, each labeled by a type. There are also $n$ participants in an expedition, and time is measured in days. Each day, every participant consumes exactly one package.
We are given a small collection of trips, each with a fixed start day and duration, and for each trip a visa process time that determines how long a passport is tied up after an application. Gleb has at most two passports, and each visa must be assigned to one of them.
We are given an array of integers and allowed to rearrange it using a very specific primitive: we can take any set of indices and rotate the values sitting at those positions cyclically.
We are given two binary strings, each consisting only of the characters a and b. The only allowed operation is to choose a prefix of the first string and a prefix of the second string, then swap those prefixes in a single move.
We are given a line of hills, each with a fixed initial height. We are allowed to repeatedly pick any single hill and decrease its height by one unit per operation.
We are given an $n times m$ grid where each cell is a distinct chemical element. Some of these cells are already available in the laboratory. From any three elements forming three corners of an axis-aligned rectangle, the scientists can always synthesize the fourth corner.
We are given a multiset of numbers of size 2n, and we are told that these numbers originally came from n points in the plane, where each point contributes exactly two integers: its x-coordinate and its y-coordinate.
We are given a list of integers and a special integer x. The only allowed transformation is choosing an index and replacing that element with its bitwise AND with x. This operation can only decrease bits, since AND can only turn 1 bits into 0 depending on x.
We are given two snapshots of the same system of stone piles. In the first snapshot, each pile has some number of stones, and in the second snapshot the piles have different counts.
The grid contains two kinds of cells, filled and empty. We are allowed to place geometric objects called stars, where each star consists of one central filled cell and four straight arms extending in the four cardinal directions.
We are asked to build full valid bracket sequences of length 2n, and we want to count how many of those sequences contain a given string s as a contiguous block somewhere inside them. So conceptually, imagine all balanced parentheses strings of fixed size 2n.
We are standing at the leftmost house in a long line of houses numbered from 1 to $n$. We must perform exactly $k$ moves, and each move consists of jumping from our current house to any different house.
We are given a rectangular grid filled with two types of cells, occupied cells marked as and empty cells marked as .. The task is to explain the grid as a superposition of geometric objects called stars.
We are given a collection of songs, each with an original size and a smaller size if we choose to compress it. All songs must be copied onto a flash drive whose total capacity is fixed. The only decision available is which songs to compress.
We are given two strings of equal length, where one string represents a starting arrangement of characters and the other represents a target arrangement. The only allowed operation is swapping two adjacent characters in the starting string.
We are given a one-dimensional number line from 1 to m, and several closed intervals placed on it. Each interval covers every integer point between its endpoints, including both ends.
We are given a list of candidate values, and we want to count how many ordered pairs of candidates can simultaneously support a hidden integer value $v$ under two arithmetic constraints involving gcd and lcm with fixed constants $X$ and $Y$.
We are asked to construct a grid of size n by m where each cell contains a non-negative integer. What we know in advance is not the grid itself, but two sets of constraints derived from it: the XOR of every row is fixed, and the XOR of every column is fixed.
We are given a weighted tree whose nodes are cities and whose edges are existing roads with travel times. The structure guarantees a unique simple path between any two cities, so distances are well-defined tree distances.
The task revolves around a point light source moving horizontally at a fixed negative height, and a set of disjoint segments lying on the x-axis that act as obstacles.
We are given a grid with two rows and $n$ columns. Each cell contains a value that represents how many mushrooms grow per minute in that cell. Vasya starts at the top-left cell and must move every minute to a neighboring cell sharing an edge.