brain
tamnd's digital brain — notes, problems, research
41230 notes
We are given a structure on $n$ labeled people where each person has either zero or exactly one child. If a person has no child, their outgoing pointer is 0. Otherwise, every person points to exactly one child index in $[1, n]$.
A reduced ordered binary decision diagram (BDD) for a Boolean function $f(x_1,\dots,x_n)$ consists of a rooted directed acyclic graph in which each non-sink node $v$ has a variable index $V(v)\in{1,\d...
We are given a bouquet that must contain exactly n flowers, and there are m flower types. Each type can be used any number of times. The reward model for a type is not constant per flower.
We are working with a cyclic daily timetable split into minutes. A passenger railway service must run forever with a fixed periodic pattern: trains depart exactly every m/2 minutes, and each departure occupies the platform for a fixed interval before it.
We are asked to construct three integers $a, b, c$, all chosen from a fixed interval $[l, r]$, together with a positive integer $n$, such that a linear expression holds exactly: $$n cdot a + b - c = m.$$ The input gives us the bounds $l$ and $r$, and a target value $m$.
We are simulating a sequence of battles where each battle consists of fighting a small group of identical monsters. Each monster has a fixed amount of health, and every attack reduces the chosen monster’s health by exactly one.
We are given an array of integers and a fixed integer $K$. For each query, we look at a subsegment of the array, from index $l$ to $r$, and we want to choose a contiguous subarray inside this segment that maximizes its length under a constraint on XOR.
We are given a circular string, so substrings are allowed to wrap from the end back to the beginning. Each position in this circle has a lowercase character and an associated integer value.
We are given a collection of n clubs, and we must assign each club one of m badge types. Multiple clubs can share the same badge type, but every badge type must appear at least once. After the assignment is fixed, a participant repeatedly visits clubs.
We are given a fixed 10×10 board where each cell represents a battlefield tile. Some cells are walls and cannot be used. Every other cell may initially contain a number of troops and also belongs to a category such as core, keep, lawn, or neutral territory.
We are given a set of points in the plane, each representing an asteroid of equal mass. We must split these points into two nonempty groups.
We are given a rooted tree where each node represents a folder. Folder 1 is fixed as the root, and every other folder has exactly one parent. So the structure is a hierarchy of directories.
We are asked to count how many valid “distribution plans” Kanade can follow while serving a row of $n$ rooms arranged in a line. The process always moves strictly from left to right, never revisiting rooms.
We are simulating a very small randomized process on a fixed set of ports and cables, where each cable ultimately ends up plugged into exactly one port. There are n ports labeled from 1 to n and n cables also labeled from 1 to n.
We are dealing with a system of three rotating components. Each component has a position on a circular scale, and each full rotation brings it back to the starting point after a fixed number of steps. The twist is that we do not directly choose how much each component rotates.
We are given a binary string representing a row of pearls, where each pearl is either white or black. The system supports two operations over time. One operation flips the colors of all pearls in a range, turning white into black and black into white.
We are given a process involving a collection of USB disks, where each disk initially holds a unique file. The computer has a very unusual constraint: at any moment, it only interacts with the two most recently inserted disks, and when two disks are inserted together they…
Let $f$ be a read-once Boolean function of $22m+1$ variables, represented by a rooted formula tree in which each variable appears exactly once.
We are given a system of atoms, where each atom is defined by a subset of at most 20 possible elementary particle types. Each particle type has a fixed energy value.
We are given many independent queries. Each query provides a number $n$, and for that value we first imagine all integers from $2$ up to $n$. For each integer $i$, we define a value $f(i)$, where $f(i)$ is the smallest number of prime numbers whose sum equals exactly $i$.
We are given a directed graph where every edge has unit cost, and the graph is guaranteed to be strongly connected. Two workers start at vertex 1. A sequence of requests arrives, and each request specifies a vertex that must be visited to perform a repair.
Two competitors each have a single integer score. The task is to compare these two numbers and declare who has the higher score, or whether they are equal. The input consists of exactly two integers, representing the scores of the two players.
We are given a collection of 3D vectors. From these vectors we may choose any subset, including the empty set, and sum the chosen vectors component-wise to obtain a single resultant vector.
We are placing streetlights along a one-dimensional segment of length $n$. We are allowed to choose up to $k$ positions for these lights.
We are given a long decimal string, interpreted as a sequence of digits placed left to right. Between every adjacent pair of digits, we independently decide whether to insert a plus sign.
We are given a collection of triangular surfaces in 3D space. Each triangle is a flat solid piece defined by three vertices.
We are simulating a chat group that changes over time. People either join the group or send messages, and the group has strict rules that can forcibly remove members. The first rule is a capacity constraint. The group can hold at most N people.
We are given a collection of segments on a number line. From these segments, we consider every possible subset of them. For any chosen subset, we imagine painting all of its segments onto the number line, where overlapping parts are still counted only once.
The town is a rectangular grid of intersections with roads connecting adjacent intersections in the usual four-direction structure. Vehicles enter from any boundary road endpoint and must eventually leave through some boundary endpoint.
We are given a collection of axis-aligned line segments on an infinite 2D plane. Each segment is either vertical or horizontal. Two segments are considered connected if they physically intersect at any point, including touching at endpoints.
We are given several wooden boards, each with a fixed length. The “strength” or “capacity” of a cask built from these boards is defined as the length of the shortest board used in it.
Let a read-once Boolean function $f(x_1,\dots,x_n)$ be given, and let $B(f)$ denote the number of BDD nodes including sinks, as defined in Section 7.
We are given a convex polygon described by its vertices in counterclockwise order. The task is to choose two distinct vertices and draw a chord between them, but not every pair is allowed: the chord must actually split the polygon into two regions, and both resulting pieces…
We are given a very large graph on vertices labeled from 1 to n, where every pair of vertices is connected by an edge, so the graph is complete.
We are asked to choose two bases, one for $x$ and one for $y$, so that when both numbers are written in their respective bases, the resulting digit sequences are identical when read from least significant digit to most significant digit.
We are given a very small chessboard, at most six rows by six columns, with up to six pegs placed on distinct cells.
We are given a grid where every cell contains a distinct integer from the range $[0, n cdot m - 1]$. We start at the top-left cell and can only move right or down until reaching the bottom-right cell.
We are given a sequence of length $n$, initially filled with zeros. We also have $m$ operations. Each operation selects two positions $li < ri$ and assigns values $xi$ and $yi$ to those positions, overwriting whatever is currently there.
We are given an array of non-negative integers. For any split point $k$, we can divide the array into a prefix and a suffix. For that split, we compute the bitwise AND of the prefix and the bitwise AND of the suffix, then sum the two results.
We are given a line of cells, each cell having a fixed position, a color, and a value associated with a single removable ball. The structure changes over time because both colors and values of individual cells can be updated.
We are given a collection of strings and we are allowed to pick exactly k of them. Once the subset is fixed, we look at every pair inside it and compute their longest common prefix. Among all these pairwise LCP values, we take the lexicographically largest one.
We are given a line of houses indexed from 1 to m, and we must place n people into distinct houses. Two people are considered neighbors only when they occupy adjacent house indices.
We are given a street with several shops, each shop offering the same type of product at a fixed price. In each shop, the price is symmetric: if you buy or sell one unit there, the cost or revenue is exactly the same value.
We are given a line of positions from 1 to n, where each position has a cost for building a base station. We are allowed to choose any subset of positions to build base stations, paying the sum of their costs.
We are looking at a yearly event that starts at some initial year y1. From that year onward, the contest is intended to happen once every year. However, there is a small list of exceptional years where the contest did not take place.
We restart from the structural characterization of read-once Boolean functions and the defining property of reduced ordered binary decision diagrams.
We are given an undirected graph where each edge has a very special weight: the i-th edge in input order has weight $2^i$.
We are building a tree incrementally. The structure starts with a single node, and each operation either attaches a new node to an existing node with a weighted edge or changes the color of an existing node.
We are given a collection of strings, each representing a vertex in a complete undirected graph. Every pair of vertices is connected, and the weight of an edge is defined by how similar the two strings are: specifically, it is the length of the longest substring that appears…
We are given a rooted tree with $n$ labeled vertices. We consider all permutations of the vertices, but we only keep those permutations that respect the tree’s ancestor structure: whenever a node $u$ is an ancestor of node $v$, then $u$ must appear earlier in the permutation.
We are given a circular array that contains a permutation of the numbers from 1 to n. There is a fixed window of size k that represents the “visible” part of the buffer, specifically the first k positions at any moment.
The algorithm in the statement is a modified shortest path routine that behaves like SPFA but uses a priority queue instead of a FIFO queue. Every time a vertex is extracted from the queue, it relaxes its outgoing edges.
We are given a complete graph with $n$ vertices, where every vertex is connected to every other vertex. Each vertex starts with some number of chips.
We are given a directed mapping over n children. Each child always passes whatever ball they currently hold to exactly one fixed destination child p[i].
We are given a length $n$, and we must construct two binary strings of that length: a pattern string and a target string. The pattern is not purely binary; it also contains two special symbols that define a recursive matching process against the binary string.
We are given a square grid of size $n times n$, where every cell contains a distinct integer from 1 to $n^2$. You can think of this grid as a weighted graph laid out on a lattice: each cell is a node, and edges exist between orthogonally adjacent cells.
We are given a set of points in the plane. Each point acts as a laser generator, and every pair of generators is connected by a straight laser segment. So for n points, the system forms a complete geometric graph where every edge is a segment between two given coordinates.
We restart the argument from the formal semantics of ordered binary decision diagrams and build canonicity directly from evaluation, without assuming any uniqueness of a construction procedure.
The game can be modeled as a directed graph where each level is a node and each prerequisite relation is a directed edge. If there is an edge from level u to level v, then finishing u unlocks v, so v becomes playable after u is completed.
We are given an array of integers where each value represents a “jumping energy” of a substance. When two substances with energies $a$ and $b$ are mixed, they contribute an energy of $ab$.
We are given a circular arrangement of candy blocks, where each block has a flavor represented by a lowercase letter. The circularity means the first and last positions are adjacent, so any segment we take can wrap around the end of the string.
We are given a tree where every node carries a positive weight. A process runs for exactly $n$ rounds. In each round, one remaining node is chosen uniformly at random.
We are given a collection of words and a long string written on a monster’s body. The task is to determine how many ways we can cut this long string into consecutive pieces so that each piece exactly matches one of the given words.
We are given a pile of chips and two players who alternate turns, starting with Jane. On each turn, the player removes between 1 and a bounded number of chips, where the bound grows with the turn index.
We are given a company hierarchy that forms a rooted tree. Each employee corresponds to a node, and every node has a subtree consisting of all employees they supervise directly or indirectly, including themselves. The company processes a sequence of bonus events.
We maintain a multiset of integers with two operations: inserting or modifying the structure in a specific ordered way, and answering how many elements lie inside a numeric interval. The collection is not just a static bag.
We restart the argument from the ROBDD construction rules and avoid manipulating the coupled recurrences in an unjustified way.
We are given a set of points in the plane, each representing a star. We want to count how many valid “spoke constellations” can be formed. A configuration is defined by choosing one star as a center and then selecting other stars around it in a very structured way.
Each person’s full name is given as a sequence of words. From that name, a compact identifier called a NAME is constructed by taking the first letter of every word and concatenating these letters in order. So a name like “jose osorio jimenez orozco” becomes “jojo”.
We are given a situation where coffee is first packed into several identical small containers. Each small container always holds exactly $K$ units of coffee, and there are $N$ such containers. So the total amount of coffee is simply $N times K$.
We are given a set of points in the plane, each point carrying a positive or negative value. A fisherman stands at the origin and can deploy a net in a very flexible way.
We are given a sequence of 2×2 matrices that play the role of convolution kernels, and another implicit sequence of 2×2 matrices that acts as the inverse under the same convolution rule. More concretely, each input test case gives a list of matrices $A0, A1, dots, A{n-1}$.
We are given a fixed-height ASCII picture consisting of 5 rows and 18 columns. Each column contains either a star character or a dot-like blank representation, and together these characters encode three digits written side by side.
We are given a sequence of integers, and we are asked to count how many of its subsequences satisfy a structural constraint that depends on the MEX of every prefix of that subsequence.
We are given two players, each owning a collection of string “tiles”. The first player has $n$ distinct tile types, and each type can be used an unlimited number of times. The second player has $m$ tile types, also with unlimited supply.
We are given a full matrix describing the outcome probabilities between every pair of 8 teams. For any two teams $i$ and $j$, the entry $a{i,j}$ gives the probability that $i$ defeats $j$ in a single match, with the complementary probability $a{j,i}$ ensuring that exactly one…
We are given a sequence of $n$ pillars, each with a height. From this sequence we are allowed to choose a non-empty subsequence while preserving the original order. After selecting, we only keep the chosen pillars.
We are given a list of integers and asked to select the largest value in that list that satisfies a specific structural property: every prime factor of that value must also appear somewhere in the list.
A Boolean function $f(x_1,\dots,x_n)$ is **read-once** if it can be expressed by a formula in which each variable $x_i$ appears exactly once.
We are standing in a 2D plane and there is a hidden point representing a car. We are given one crucial parameter, a radius r, and we can interactively move a point anywhere in the plane and receive a binary answer: whether our current position is within distance r of the…
We start with an array of length $n$. The array is repeatedly modified by choosing a random interval $[l, r]$ uniformly among all $frac{n(n+1)}{2}$ possible subsegments, and assigning all elements in that interval a new value that has never been used before.
We are given two ordered sequences of integers, both of the same length. Each sequence comes from a sensor reading over time, so the index order is fixed and meaningful.
We are given an array and a random process that repeatedly samples indices uniformly from a chosen segment of this array. After taking k independent samples, we look at the smallest and largest sampled indices and return the sum of the array over that interval.
We are asked to look at all ordered arrays of length $m$ consisting of non-negative integers whose total sum is fixed to $n$. Every such array contributes a value equal to the bitwise XOR of all its elements, and we need the sum of these XOR values over all valid arrays.
We are given an n by n matrix and a sequence of operations. Each operation selects a square submatrix using its top-left and bottom-right coordinates, then applies one geometric transformation to that submatrix.
We are given an undirected graph where each edge carries a weight that behaves like a threshold. You start at node S holding a value k, and want to reach node T.
A read-once Boolean function $f(x_1,\ldots,x_n)$ is represented by a formula tree in which each variable occurs exactly once.
Let $X = (x_{ij})$ be a $6 \times 6$ matrix with entries in ${0,1}$.
We are given a sequence of numbers and we build a deque by processing them in order. For each element, we decide independently whether it is inserted at the front or at the back.
We are repeatedly building a sequence of length n by processing the array from left to right. At each step, the current element is inserted either at the front or at the back of an initially empty deque.
The dungeon is a straight line, and the knight walks from position 0 to position D without ever turning back. Along this path there are two kinds of encounters: monsters and shops, each placed at fixed positions.
We start at the origin in a grid and want to reach a target coordinate $(x, y)$. From any current position, the rabbit has three possible moves: it can move one step right for cost $A$, one step up for cost $B$, or it can scale both coordinates by a factor of two for cost $C$.
We are given a grid representing a maze where some cells are blocked and others are free. A robot starts in the top-left cell and must execute a sequence of moves of fixed length.
Each tower in this problem acts like a light source placed on a number line. A tower at position $ai$ emits a brightness that starts at $pi$ at its own location and then decreases linearly as you move away from it.
We are given a consecutive list of integers starting from 0 up to n. Between every pair of adjacent numbers, we are allowed to insert either a plus or a minus sign, effectively deciding whether each number contributes positively or negatively to a running sum.
We are given a binary grid that represents a pond, where each cell is either water or empty ground. On top of this grid, we consider every possible square region of fixed size $k times k$.
We are given a single positive integer x, and we need to move strictly downward to find the closest smaller integer that avoids a specific digit constraint: none of its decimal digits may be 7.
We are given a binary string that evolves over time. Two kinds of operations happen: flipping a single character, and answering a query on a substring.
We are given a sequence of exam grades for a student, each grade being an integer between 0 and 100. The task is to produce a cleaned version of this sequence where every grade below 60 is removed, while keeping the relative order of the remaining grades exactly the same as in…
We are given a set of people labeled from 1 to $n$, but $n$ can be extremely large, so we cannot afford to explicitly build any structure over all individuals.