brain
tamnd's digital brain — notes, problems, research
41650 notes
We are given a fixed array of integers and many queries. Each query asks us to imagine picking exactly $k$ elements from the array while preserving their original order. Among all such subsequences of length $k$, we first want the one with the maximum possible sum.
We are given a sequence of parentheses and are allowed to apply an operation that reverses any contiguous segment.
We are given a non-decreasing array q, which is claimed to be produced from some hidden permutation p by taking prefix maxima. At every position i, q[i] equals the largest value among the first i elements of p.
We are given a sequence of numbers and, for each query, we must imagine selecting exactly k elements from this sequence while preserving their original order. Among all such subsequences, we first care about maximizing the sum of chosen values.
We are given a rooted tree where vertex labels already obey a strict ordering constraint: every node except the root has a parent with a smaller label.
We are given a sequence of positive integers and asked to count how many pairs of indices produce a product that is a perfect k-th power. In other words, for two distinct elements $ai$ and $aj$, we want to know whether their product can be written as $x^k$ for some integer $x$.
We are given a positive target number $n$. We also fix an integer $p$, which shifts a family of numbers of the form $2^x + p$, where $x ge 0$. Each such value is a single “building block”, and we are allowed to reuse the same block any number of times.
We are given an array and a peculiar cancellation process that behaves like a stack with annihilation. We scan the array from left to right, maintaining a stack. When we see a value, if the stack top is different, we push it.
We are given a collection of logs, each with an integer length. From these logs we are allowed to cut pieces, but we are not allowed to glue pieces together. The goal is to assemble a rectangular raft structure that requires two kinds of side lengths, call them x and y.
We are given a tree where every edge has a weight. The task is to assign colors to vertices under a very specific rule: each vertex receives exactly $k$ colors, and any particular color can appear at most twice across the entire tree.
Each query gives two strings of the same length. You are allowed to repeatedly apply an operation on either string: pick two neighboring characters and overwrite one with the other.
We are given a number of matches and we want to arrange them into a valid arithmetic equation of the form “a + b = c”, where each number is strictly positive.
Something went wrong. If this issue persists please contact us through our help center at help.openai.com.
We are filling an $n times n$ chessboard where every cell must contain either a white knight or a black knight. The goal is not about placing pieces to avoid attacks, but rather to maximize how many pairs of opposing-colored knights can attack each other under standard knight…
We are given a sequence of fence boards, each with an initial height and a cost per unit increase in height. One operation lets us pick a board and increase its height by exactly one, paying its per-unit cost each time. We can repeat this any number of times for any board.
We are given a binary string made of two types of characters: empty cells denoted by . and blocked cells denoted by X. Two players alternate turns, starting with Alice.
We are given a fixed set of points in the plane, which we can think of as antennas. For each query, there is an unknown integer point in a bounded grid, and we are told the squared distances from that point to all antennas.
We are given a permutation of length $n$. From this permutation, a binary tree is constructed in a deterministic way: the smallest value in a segment becomes the root of that segment, and the remaining elements are split into the left and right subsegments around it.
We are given a finite set of positive integers, but the structure we build from it is infinite. Every integer is a vertex, and each number in the set is interpreted as a “distance type”.
We are given a connected undirected graph where each vertex represents a city and each city has a fixed value. Alex starts from a specific city and walks through the graph by traversing edges, with one restriction: he is not allowed to immediately traverse back along the same…
We are given a multiset of letters that originally came from writing several binary words, where each word is either the string "zero" representing digit 0 or "one" representing digit 1.
We are given three ingredients that define a transformation problem on a binary grid. First is an initial $N times N$ board of lights, each cell either on or off. Second is a target $N times N$ configuration we want to reach.
We are given a network of spaceports connected by undirected shuttle routes. Each spaceport belongs to exactly one of three planets labeled X, Y, or Z. Every shuttle connects two different spaceports, and only connections between different planets exist.
We are given an undirected graph where each edge represents a wormhole between two planets and has a repair cost.
We are given an array of values, and each query asks us to evaluate a very specific symmetric polynomial built from a transformed version of that array. For a fixed number $q$, we first convert every element $ai$ into $bi = q - ai$.
We are given an undirected graph with $N$ vertices and exactly $N$ edges, and no pair of vertices is connected by more than one edge.
We are given a set of non-overlapping convex polygonal regions in the plane. Each polygon represents a warehouse. Bob stands at the origin, and for every point inside any warehouse we want to know whether Bob can “see” it using a special optical device.
We are moving through a grid from the top-left cell to the bottom-right cell, and each second we can only move either one step to the right or one step down. Any valid path is therefore a monotone path with exactly $N + M - 2$ moves.
The graph starts empty, but it is continuously modified by two types of operations. The first operation toggles an edge between two vertices, and the second operation asks whether two vertices are connected in the current graph.
We are given a character with two base attributes: strength and intelligence. We are also given a pool of extra experience points that must all be distributed. Each point can increase either strength or intelligence by exactly one unit.
We are given an array of integers that changes over time, and we are repeatedly asked to inspect a chosen segment of this array.
We are given a directed graph where each edge is fixed in advance, and we must assign a color (an integer label) to every edge. The constraint is not about vertices but about directed cycles: if you look at all edges of a single color, they must not contain any directed cycle.
We are given a collection of sword types, each type having some remaining count after a theft. For each type $i$, the value $ai$ tells us how many swords of that type are still present in the basement. Originally, every type had the same unknown quantity $x$.
We are given a binary string made only of the characters a and b, and its length is guaranteed to be even. The task is to transform this string using the minimum number of single-character flips so that every prefix whose length is even contains exactly the same number of a…
We are given a tree with $n$ vertices, where each vertex represents a square in a pedestrian network. Each vertex must be assigned one of $k$ colors.
We are given an $n times m$ grid that represents a map. Each cell is either blocked or free. We start at the top-left cell $(1,1)$ and want to reach the bottom-right cell $(n,m)$.
We are asked to build a graph on $2n$ labeled vertices using exactly $2n-1$ edges. Since a connected graph with $2n$ vertices and $2n-1$ edges is necessarily a tree, the construction is really about designing a tree on these labeled nodes.
We are given two permutations of the indices of a string, and both permutations describe an ordering in which the hidden string must appear sorted.
We are asked to build a string of length $3n$ over the alphabet ${a,b,c}$, where each character appears exactly $n$ times. In addition to this balancing constraint, two forbidden patterns are given, each being a length-2 string.
We are given several chips placed on integer positions on a line. Our goal is to move all chips so that they end up on a single shared coordinate, using the cheapest possible sequence of moves. Each chip can move in two different ways.
We are given a tree where each node initially holds a color. There is also a target color for every node. The King performs a single walk on the tree. During this walk, whenever he traverses an edge, the endpoints of that edge swap their current flags.
We are given a complete bipartite structure with $n$ vertices on the left and $n$ vertices on the right. For every possible pair $(i, j)$, the edge between left vertex $i$ and right vertex $j$ exists independently with probability $p{ij}/100$.
We are given a collection of students, each described by two values. The first value encodes which of up to 60 possible algorithms a student knows, and can be thought of as a bitmask. The second value is a skill score.
We are given a grid with a small number of rows and a potentially large number of columns. The only operation allowed is to take any single column and rotate it cyclically any number of times.
We are given an undirected connected graph with up to 100,000 cities and roads, where each road has a unique identifier from 1 to m. Koala starts at city 1 and travels through the graph.
We are given an array that evolves over time through point updates. After each modification, we must compute a value called the difficulty of the array, which measures how far the array is from being representable as a sequence of contiguous uniform blocks.
We are given a sequence of digits and we must assign each position one of two labels, 1 or 2. After labeling, we form a new sequence by taking all digits labeled 1 in their original order, followed by all digits labeled 2 in their original order.
We are given a collection of snack types and a group of guests. Each snack type appears exactly once, so there are $n$ distinct items labeled $1$ to $n$. Each guest has two preferred snack types.
We are asked to build several regular polygons that all lie on the same circle, and we want to reuse the circle’s boundary points as much as possible. Each polygon is determined only by how many vertices it has.
We are given a sequence of integers and asked to choose three indices $i < j < k$. For each such triple, we take the value of the first element OR the bitwise AND of the other two elements. The goal is to maximize this expression over all valid triples.
We are asked to fill an $n times n$ table with all integers from $0$ to $n^2 - 1$ exactly once, so every number is used in a permutation of the grid cells.
We are given a hidden permutation of numbers from 1 to n. Instead of seeing the permutation directly, we are given a derived value for each position. For position i, the value s[i] is the sum of all elements that appear before i and are smaller than the element placed at i.
We are given a sequence of numbers and we are allowed to remove one continuous block from it, or remove nothing at all. After this single deletion, the remaining elements must all be different from each other.
We are given a growing collection of strings, where each new string is either a single character or an old string extended by exactly one character at the end.
We are playing an interactive guessing game where a hidden number $x$ is fixed in advance, and it lies in the range from $0$ to $2^{14}-1$. We are allowed to ask up to two questions.
We are given a collection of $n$ labeled tiles, where each tile carries a pair of integers $(ai, bi)$. Our task is to count how many ways we can reorder these tiles such that the resulting sequence avoids two very specific failure patterns.
We are building a linear structure along a road that is represented as a binary string. Each position corresponds to a unit segment of road. A 0 means normal road, while a 1 means a crossroad where the pipeline must be lifted. The pipeline normally runs at height 1.
We are placed on an even-by-even grid, and two knights start on different squares. One is white, one is black. Each player controls exactly one knight and alternates moves, starting with the white side if we choose it. A move is standard knight movement.
We are given a list of numbers, and we repeatedly perform an operation that picks two different positions and reduces both values by one. The goal is to decide whether we can eventually bring every value down exactly to zero using some sequence of such operations.
We are given a sequence of integers, and we want to count how many contiguous segments behave like a perfect permutation of consecutive integers starting from 1.
We are given a number $n$ and a parameter $k$. Starting from $n$, we want to reach zero using two allowed operations: subtract one, or if the current value is divisible by $k$, replace it with the quotient after dividing by $k$.
We are given a static array of integers and a parameter $p$. There is a peculiar addition routine used inside a hidden implementation: it adds numbers left to right, but after each addition it performs a conditional correction.
The input describes a tree where each node carries a color label. What we are asked to compute is not about a single path, but about all simple paths between ordered pairs of distinct nodes.
We are given an $n times n$ grid where movement is deterministic. From any cell, a traveller moves in a fixed direction until something changes that flow.
We are given a system split into two parts: a hand of cards and a pile of cards. Together they contain every integer card from 1 to n exactly once, while zeros represent empty placeholders that behave like dummy cards with no value.
We are given a collection of pictures, each with a positive weight. These weights determine how likely each picture is shown when Nauuo visits the website: a picture is selected with probability proportional to its current weight, so picture $i$ is chosen with probability $wi…
We are given a rooted binary tree where each edge carries either a fixed lowercase letter or a wildcard character. Every leaf defines a string obtained by walking from the root to that leaf and concatenating edge labels.
We are given a sequence of integers arranged on a line, and we want to answer connectivity queries between pairs of positions, but connectivity is not based on adjacency.
We are given a set of integers that represent allowed XOR “moves”. We are asked to build a permutation of all integers from 0 up to some power of two minus one, such that every adjacent pair in the permutation differs by a value that belongs to the given set.
We start with a register of qubits initialized in the all-zero computational basis state. Alongside this, we are given four classical bitstrings of length $N$, each describing one computational basis state on these qubits.
We are given a timeline from 1 to n and a collection of intervals, each representing a “red envelope” that becomes usable only during a certain time window.
We are given a list of stick lengths, and we are allowed to replace each length with any other positive integer. Changing a stick from its original length to a new length costs exactly the absolute difference between the two values.
We are given a connected undirected simple graph where every vertex has degree at least three. Along with the graph, we are also given an integer $k$. The task is not to compute a single structure, but to decide between two fundamentally different constructions.
We are given a directed graph representing a city map, where each road has a direction and a cost associated with reversing it.
We are given a stream of problems, each tagged with a difficulty from 1 to n. Arkady keeps a pool of created problems, and at any moment he is allowed to form a contest if he can pick exactly one unused problem of every difficulty from 1 to n.
We are simulating an interaction on a 999 by 999 grid with a single white king and many black rooks. The king moves first and can step to any of the eight neighboring cells.
We are given a string that mixes plain lowercase letters with two special symbols that always appear immediately after a letter. One symbol behaves like a weak modifier that allows the preceding letter to be either kept or deleted.
The process describes a snowball sliding downward from a starting height until it reaches the ground. At every integer height level, the snowball repeatedly changes its weight in three ordered phases: it first gains additional weight equal to its current height, then possibly…
We are given a rooted tree where each vertex contains a pile of cookies. Every vertex also has a cost for eating one cookie at that vertex, and every edge from a node to its parent has a cost for moving upward along it. A chip starts at the root.
We are given a fixed string and many substring queries. For each query, we take the substring and compute a specific aggregate over all its suffixes. For a string, the Z-function at position i measures how long the prefix of the string matches the substring starting at i.
We maintain a dynamic multiset of positive integers, where each number represents the weight of an eel. After every update, we are asked to compute a value called “danger”, which depends on an optimal process of repeatedly merging all eels into a single one.
We are given an array and asked to repeatedly build new structures on top of derived information from its subarrays. The first transformation takes every contiguous segment and replaces it with the greatest integer that divides all elements inside that segment.
We are given a rooted tree where vertex 1 is the root. Every vertex originally had a non-negative integer value written on it, but those values are now lost. What remains is partial information about prefix sums along root paths.
We are asked to build a rooted tree on vertices labeled from 1 to n, where vertex 1 is fixed as the root. Each node except the root has exactly one parent, so the structure is fully determined by the parent array.
We are given a grid of size $n times m$, where each cell contains one of four characters: A, G, C, or T. We need to construct a new grid of the same dimensions that satisfies a strict local rule: every 2 by 2 subgrid must contain all four different characters exactly once.
We are working with an infinite sequence that is not written explicitly, but generated recursively. The construction starts from a single value zero.
We are working with a tree where every subset of vertices defines a natural “cost” based on how large a minimal connected subgraph is when we are forced to include all vertices in that subset.
We are given a collection of bracket strings, each string being some mixture of opening and closing parentheses. From these strings, we are allowed to form disjoint pairs.
We are given a permutation and we must break it into several subsequences taken in order from the original array. Each element must belong to exactly one subsequence. Every subsequence must be strictly monotone, either strictly increasing or strictly decreasing.
We are given multiple independent queries, each describing a numeric interval from $l$ to $r$. For each interval, we must pick two different integers inside it such that one of them is a divisor of the other.
We are given a sequence of length $n$ that is supposed to be a permutation, except some positions are unknown and marked with $-1$.
We are given a string made of lowercase letters, and we are allowed to remove one contiguous segment from it. After removing that segment, the remaining characters must all be identical, meaning either nothing remains or every remaining character is the same letter.
We are working with two permutations of the same set of values from 1 to n. One permutation, call it a, gives a position-based arrangement, and the other permutation b also gives a different ordering of the same values.
We are working with a collection of points in a very low-dimensional space, where each point has up to five coordinates. The distance between two points is defined as the sum of absolute differences across each coordinate, which is the Manhattan metric.
We are given a hidden non-decreasing array a of even length n. We never see a directly. Instead, we are told half of its structure: for every symmetric pair of positions, the sum of elements at the ends is known.
We are given several independent strings made only of lowercase English letters. For each string, we are allowed to rearrange its characters in any order we want.
We are given a standard six-faced dice, but instead of the usual values 1 to 6, its faces contain the integers 2, 3, 4, 5, 6, and 7, all distinct. Each roll produces one of these numbers, and the score for a sequence of rolls is the sum of the visible faces.
We are given a line of players, each permanently assigned one of three Rock-Paper-Scissors moves. A tournament proceeds by repeatedly picking two adjacent players, playing a match, and removing the loser.
We are given a string that is the final result of repeatedly building another hidden string by alternately appending characters to the right and inserting characters to the left.
We are given a tree and a fixed total amount of “weight budget” $s$. Every edge must be assigned a non-negative real weight, and the sum over all edges must equal exactly $s$.