brain
tamnd's digital brain — notes, problems, research
41230 notes
We are dealing with a hidden binary array of length $N$. Exactly two positions contain a value of 1, and all other positions contain 0. We cannot see the array directly. Instead, we are allowed to ask queries of the form: give me the sum of values in a subsegment $[L, R]$.
We are given a row of flowers, each flower having a type represented by an integer. A florist considers a bouquet “valid” only if it corresponds to a contiguous segment of this row and the segment contains exactly K distinct flower types.
We start with a single initial phone number consisting of digits. From this string, a sequence of new phone numbers is generated.
The flaw in the previous solution is that it tried to define ZDD nodes as states indexed by a subset $X \subseteq U$.
We are given a fully scrambled state of a 2×2×2 Rubik’s cube, encoded not as physical faces but as a flat list of 24 colored stickers. Each color represents one of the six faces in the solved configuration.
We are given the state of a very small Rubik-like object that is already a 1×1×1 cube, meaning there are exactly six colored faces with no internal structure.
You've hit your limit. Please try again later.
Rudolf spends up to one million days on a foreign planet, and the entire timeline is treated as a single continuous calendar starting from day one. The key complication is that two independent schedules overlap. The first schedule is monthly rent.
Let $S={1,dots,m}$ denote the selector variables and $T={m+1,dots,m+2^m}$ the data variables of the multiplexer $Mm$. For each $iin S$, the value of $xi$ selects one index in $T$, and the function outputs the chosen data bit.
We are dealing with a fully specified logical reconstruction problem involving six people, six mailbox owners, and six postcard themes.
We are given an array of length $2n$, initially all zeros. We also receive $n$ interval assignment operations. Each operation $i$ comes with a segment $[li, ri)$ and, when applied, it overwrites every position in that half-open interval with the value $i$.
We are given a collection of triangular faces, each triangle described only by three integer vertex IDs. These IDs do not represent geometry in any meaningful way beyond identity.
We are working with binary strings arranged on a circle. Think of a length-n binary sequence written on a ring, where position n connects back to position 1.
We are given a collection of processes. Each process becomes available at a specific time and has a fixed processing length. At any query time $t$, we consider only processes that have already arrived, meaning their arrival time is at most $t$.
We are dealing with a game on an undirected connected graph where nodes represent holes and edges represent tunnels. A mouse starts at some unknown node. In each round, Kanade “attacks” exactly one chosen node from a fixed sequence.
We are given a tree with n vertices and n − 1 undirected edges. The task is not to output the edges themselves or reconstruct an adjacency list, but to assign to every vertex i (from 1 to n − 1) a partner vertex pi such that the pair (i, pi) is one of the given tree edges.
Let $f$ be the Boolean function that represents solutions of an exact cover instance on a universe $U$ with a family of subsets encoded by variables $x_1,\dots,x_n$.
Let $S={1,dots,m}$ denote the selector variables and $T={m+1,dots,m+2^m}$ the data variables of the multiplexer $Mm$. For each $iin S$, the value of $xi$ selects one index in $T$, and the function outputs the chosen data bit.
We are given a set of points in the plane, with no duplicates, and we need to count how many rectangles can be formed by choosing four of these points as vertices.
We are given a game system with 15 types of actions, where each action consumes a fixed amount of stamina depending on its index. Actions 1 through 4 cost 8 stamina each, actions 5 through 10 cost 9 stamina each, and actions 11 through 15 cost 10 stamina each.
We are simulating a Josephus-style elimination on a circular arrangement of people labeled from 1 to n. The difference from the classic version is that the step size is not fixed. Instead, there are q rounds, and each round provides its own step value k.
We are given a kingdom structured as a tree, meaning there are n cities connected by n − 1 roads and there is exactly one simple path between any two cities. Some of these cities are marked as important, and some cities contain troops.
We are given several independent test cases. In each test case, we are working on a grid in the first quadrant. Every segment we receive lies on a single 45-degree diagonal line, because each segment’s endpoints satisfy the same value of $x + y$.
Let the ZDD for $f$ be given as a reduced ordered ZDD with variable ordering $x_1 < x_2 < \cdots < x_n$.
We are given a sequence of typing requests. Each request says that a certain key, identified by an integer label, is supposed to be pressed repeatedly a given number of times.
We are given a grid with $n$ rows and $m$ columns. Each cell contains one character, either $A$ or $B$. Starting from the top-left cell, we move only right or down until reaching the bottom-right cell.
We are given a set of circles in a plane with a strong structural promise: no two circles intersect or touch each other. This restriction forces a very rigid geometry. Any two circles are either completely separate, or one lies fully inside the other. There is no partial overlap.
We are given a linear tower of floors, each floor i has an enemy with a required strength ai and a reward bi that increases the player’s strength after defeating that enemy. The player can walk along adjacent floors, moving only between i and i + 1 or i - 1.
Yes.
We are asked to construct, for each test case, a list of n distinct integers whose total sum equals a target value k, while keeping every chosen number within the range [-10^9, 10^9].
We are given a set of enemy positions on a plane, all measured relative to the origin where our character stands.
We start with an array of $n$ numbers. Initially, each element stands alone as a separate segment. The process repeatedly chooses two neighboring segments, merges them into one, and assigns that new segment a value equal to the sum of all elements inside it.
We are asked to count special groups of four prime numbers taken from the range from 1 to n. Each group consists of indices a, b, c, d such that all four numbers are prime and they form an arithmetic progression with exactly three equal gaps.
Let the Boolean function be given by a ZDD with variable order $x_1,x_2,\ldots,x_n$.
We start with a rooted tree where vertex 1 is the root and every other vertex has a fixed parent given in the input. Depth is defined in the standard way: the root has depth 1, and every edge increases depth by 1.
We are given an $n times m$ grid where each cell either contains a cake or is empty. The task is to eat all cakes while maximizing total satisfaction. There are two possible actions. One action eats a single cake and gives a fixed reward $p$.
We are given a collection of domino cards. Each card carries two values, a front value and a back value. From the full set of cards, we first select exactly K cards. The score for this first selection is the sum of the front values of those K chosen cards.
We are given up to 8 groups of people, where each group contains a small set of uniquely named individuals. Some individuals appear in multiple groups. We must choose exactly k of these groups and decide the order in which to send a message to them.
We are given a rooted tree where vertex 1 is the root. Each vertex carries a value, and for every query we are asked to work inside a specific subtree.
We are given a list of distinct integers, and we want to choose as many of them as possible to form a subset with a single restriction: we are not allowed to pick two numbers where one is exactly 9 larger than the other.
Let the ZDD represent a family $\mathcal{F}$ of subsets of ${x_1,\dots,x_n}$, ordered by the variable indices, and let each node $k$ be labeled by $V(k)\in{1,\dots,n}$.
We are given a fixed dictionary of word replacements. Each rule states that a specific word should always be replaced by another fixed word. After reading all rules, we are then given a sequence of words that form a sentence spoken by BSQ.
There are 6 independent tracks, and each track contains several disjoint time segments during which blocks appear. Each segment [l, r] means that on every integer second from l to r inclusive, that track contributes exactly one point if we choose to press it at that second.
The task is extremely direct. There is no input at all, and the program is required to produce a single fixed string as output. The string is exactly Jesus Bocchi, including capitalization and spacing, and nothing else should be printed.
We have a number line from position 0 to position N, with stones placed at distinct integer coordinates strictly inside this interval.
We are walking on integer grid points starting from the origin. The destination is a fixed point $(Rx, Ry)$. At each step, the movement rules allow several local transitions that can shift the position in different directions, but we are constrained to stay in the first…
We are given a collection of balls, each ball initially has a color and each color has an associated value. In addition to this, there are transformation rules that allow us to change a ball’s color from one specific color to another.
We are given two integers, $A$ and $B$, along with two target remainders $m1$ and $m2$. The task is to find the smallest positive integer $X$ such that when $A$ is divided by $X$, the remainder is exactly $m1$, and when $B$ is divided by $X$, the remainder is exactly $m2$.
I can’t write a correct editorial for this yet because the problem statement is corrupted/incomplete. Right now only fragments are visible (mentions of gcd(p, q), factorials, and a modulo definition), but the actual game rules, input format, and what needs to be computed are…
We are given a sequence of piles arranged in a fixed order. Each pile contains some number of stones, and players alternate turns.
We are given a single positive integer $N$. For every integer $k$ from $1$ to $N$, we define a value called “beauty” based on the relationship between $k$ and $N$.
We are given three integers in each test case, describing a base number and two exponent parameters. The expression to evaluate is the greatest common divisor of two numbers that are both powers of the same base, where the exponents are factorials. Concretely, we compare $n^{a!
We are given a tree where every node stores a value. The tree structure does not change, but node values do. We must answer two kinds of operations: we can update the value stored at a single node, and we can query a subtree to find the maximum value currently present among…
We are given a line of people, each person assigned a country label. For every query, a segment of the line is declared to be VIPs, while everyone outside that segment is non-VIP.
Let $A={i_1,i_2,\ldots,i_\ell}$ and let $F = e_{i_1}\cup\cdots\cup e_{i_\ell}$.
We are given multiple independent queries. Each query defines a closed numeric interval from l to r, together with two parameters: a target digit sum x and a rank k. Inside that interval we conceptually look at all positive integers whose digits add up to exactly x.
The problem presents multiple independent test cases. Each test case consists of four integers that define some configuration or instance of a system. The task is to compute a valid result for each instance or report that no valid construction exists.
We are given two large integers for each test case, but both of them have been slightly corrupted. The first number is supposed to represent an integer $n$, and the second is supposed to represent $k$, the number of positive divisors of $n$.
We are given a list of integers, and we are allowed to repeatedly increase any chosen element by exactly one. The goal is to transform the array so that all values become distinct, while performing as few increments as possible.
We are given a set of points in the plane with integer coordinates, with the guarantees that no two points coincide and no three are collinear.
The grid is a rectangular board where some cells contain jewels and all other cells are empty. A key restriction is that no two jewels are adjacent by an edge, which already forces the jewels into a kind of sparse, checkerboard-compatible pattern.
We are given an undirected graph where each vertex carries a numeric weight. From this graph, we want to select a set of vertices such that two conditions hold simultaneously. First, the chosen vertices must form a connected induced subgraph.
We are given two long strings over an arbitrary ASCII alphabet. One string is a pattern we want to search for, and the other is a text where we want to locate approximate matches of that pattern.
The input describes a triangular lattice made of $n$ layers. Each layer contains a row of small triangular regions, and every small triangle contributes three boundary segments. Some of these segments are already in a “charged” state, while others are still uncharged.
We are maintaining a multiset of intervals on a fixed segment from 0 to some integer limit $l$. Each interval contributes coverage to points on the line, and overlap is allowed.
We are given a matrix of size $n times m$, where each row represents a participant and each column represents a skill. We must choose exactly $m$ different participants and assign each of the $m$ skill positions to a distinct chosen participant.
We are given a weighted undirected graph with up to 100,000 nodes and 100,000 roads. Each road connects two districts and has a travel time cost.
We are given a permutation of numbers from 1 to n. The goal is to sort this permutation into increasing order, but we are not allowed to output swaps directly in the order they will be executed.
We start with a tree whose vertices are numbered from 1 to n. Initially, each vertex i carries a distinct color i, so the configuration is just the identity permutation placed on the nodes.
Brian walks through a line of stalls. At each stall he faces a choice between converting cash into a limited storage of tokens, or immediately spending tokens to obtain mascots.
We are given a DNA strand written as a string over the alphabet {A, T, C, G}. Biology gives us a precise transformation rule for constructing the complementary strand: first reverse the original sequence because the two strands run in opposite directions, then replace each…
We are given a fixed list of positive integers $a1, a2, dots, an$. For any real number $x$, we form a value by taking each $ai x$, rounding it down to the nearest integer, and summing all these values. This produces a function $F(x)$.
Let $B(f)$ denote the number of nodes in the reduced ordered BDD representing a family $f$, including the sink nodes $\bot$ and $\top$.
Each test gives us a collection of $5 times 5$ bingo boards, one per player. Every cell contains a number in the range $[1, k]$, and numbers can repeat inside a board.
We are maintaining an array that changes over time, and we must answer two kinds of operations efficiently. The first operation asks for a special aggregate over a subarray.
We maintain a long array of integers that changes over time. Each operation adds a value to every element inside a contiguous segment, and these changes persist permanently.
We are given a weighted tree, meaning there are $N$ nodes connected by $N-1$ edges with no cycles, and each edge has a non-negative weight. From this tree we must select two paths such that they do not share any node.
We are given a geometric construction that behaves like an infinite tiling of identical 1 by 2 rectangles. Each horizontal row is the same pattern as the previous row, but shifted one unit to the right, which creates a staggered brick layout.
We are given a directed graph with up to 100 vertices. Each vertex has a value that represents how much gas the explorer inhales if he is at that vertex during a second. The process evolves over time for exactly $k$ seconds. Initially the explorer starts at vertex 1.
We are given a string that contains lowercase letters and wildcard characters. Each wildcard can be replaced independently by any lowercase letter.
We are given several independent test cases. In each test case there is an array of positive integers. Two players alternate turns, starting with Nino.
We are simulating a one-dimensional movement from coordinate 0 to coordinate $n$, where moving costs exactly one second per unit distance and the speed is fixed.
We are given a sequence of elevations along a linear mountain path. Each index represents a position, and each value represents its altitude.
We are working with a complete binary tree of height $d$. The tree is labeled in the standard heap-style way: node $1$ is the root, and every node $u$ has children $2u$ and $2u+1$ as long as they exist.
We are given two arrays of equal length, and we are allowed to modify the first array until it becomes identical to the second one. The cost model has two parts.
Each test gives three integers. Think of the first two numbers as defining a rule for which integers are “valid”: a number is valid only if it is divisible by both of them. The third number acts like a modulus cap that we care about only through remainders.
We are given an $N times N$ multiplication table where each cell $(i, j)$ contains the product $i cdot j$. The table therefore contains every integer that can be expressed as a product of two numbers between $1$ and $N$, inclusive.
We represent a family $f$ as a reduced ordered decision diagram over variables $x_1,x_2,\dots,x_n$, using the conventions of Section 7.
We are given a sequence of altitudes along a path, and we walk through it from left to right. The task is to count how many “mountain climbs” appear in this sequence.
The problem is not really about computation in the usual competitive programming sense. The input gives a single integer, called a testcase number, but that value does not affect the answer.
We are looking at a sequence of $n$ independent rounds of a game. In each round exactly one player wins. One special player is Thomas, and there are $k$ other competitors, so every round has $k+1$ possible winners.
We are given a finite rectangular map of an otherwise infinite grid. Some cells contain markers and all other cells are empty. A person is placed at an unknown starting cell, but we only consider starting positions inside the given rectangle.
The input describes a rooted tree where leaves are initial memes represented as 2D points. Every internal node represents a “vote” that merges its children into a new meme. At a leaf, the meme is fixed as a point $(x, y)$.
We are given a circular spiderweb with n radial strands, numbered in order around the center. Between adjacent strands, there are m “bridges”, each placed at a unique distance from the center. A bridge connects two neighboring strands at that fixed radius.
We are given a directed acyclic network where every node either splits a single incoming sequence into two alternating streams or merges two incoming sequences into one alternating stream.
We are given a small pattern grid, called a motif, and a larger grid, called a mosaic. Each cell contains a color value, except that in the motif some cells are empty and behave like wildcards.
You've hit your limit. Please try again later.
Each island is a simple polygon lying on the ground plane, and each flight path is a 3D line segment with a positive altitude. A plane flies along that segment, and a downward-facing camera observes a strip of ground directly under the aircraft.
We are given a deck split into several marking categories. Each category contains a known number of distinct cards, and the total deck size can be extremely large. A random group of $k$ cards is selected, and one of these $k$ cards is hidden face down.
We are given a simple polygon representing the floor plan of a gallery. Inside this polygon there are two points: one is the guard’s starting position and the other is the center of a small circular sculpture.