brain
tamnd's digital brain — notes, problems, research
43815 notes
We are asked to analyze a two-player game on an $n times m$ grid. Each cell can contain tokens, and on a turn, a player picks a token and moves it along a sequence of adjacent cells that always steps leftwards in columns, ultimately depositing new tokens along that path and…
We are given a tree with n nodes, where each node contains a set of colors drawn from a palette of size k. Each node's set may be different, and the total number of color assignments across all nodes is s.
We are given a set of n batteries, some of which work and some of which don't. We do not know how many work, but we do know that at least two do. There is a flashlight that requires exactly two working batteries to turn on.
Each wizard sits at a fixed position from 1 to n, and each one chooses a direction for his cape: either left or right. This choice determines from which positions he becomes visible.
We are asked to design a maze on an $n times n$ grid where each cell contains an arrow pointing in one of the four cardinal directions: up, down, left, or right. Abraham, starting from any cell, follows the arrow in that cell to the next cell and continues moving in this fashion.
We are asked to compute the total number of matches in a modified double-elimination football tournament. In this tournament, teams start in a winners' group. Each round, winners' group teams pair up and play matches.
We are given a permutation of integers from 1 to $n$. The allowed operation selects three indices $i < j < k$ such that the value at $i$ is exactly one more than the maximum of $pj$ and $pk$ and exactly two more than the minimum of $pj$ and $pk$.
We start with a permutation of length $n$, meaning every integer from $1$ to $n$ appears exactly once in some order.
We are given a list of numbers and two players who interact with it in a turn-based process. The key twist is that the final outcome is not chosen directly, but emerges from a game where one player removes elements from consideration and the other permanently freezes elements…
We are given a hidden permutation of integers from 1 to $n$, but we only have direct access to the first $n-1$ elements through an interactive query.
We are given a collection of integers on a whiteboard and two operations to modify it. The first operation, Erase, allows us to remove up to $k$ numbers.
We have a circular arrangement of up to 20 machines, each of which either decreases an integer by one (type A) or halves it and floors the result (type B).
We are repeatedly shrinking a pile of pizza slices using a very specific rule until only a tiny remainder is left. The process is deterministic in structure but flexible in how we split the pile, and our only freedom is how we choose that split each day.
In Hyper Smawk Bros, two players take turns attacking a boss with health n. Each attack reduces the health by an integer damage x between 1 and m. The catch is that on your turn, you cannot repeat the exact damage your opponent used on the previous turn.
We are asked to construct permutations of size $n$ that satisfy two independent structural constraints, and then output as many distinct valid permutations as exist, capped at 2000.
We are asked to simulate a sequence of missions that guarantees our skill reaches at least a target value n regardless of our starting skill s, which is unknown and can be any integer from 1 to n. Each mission has a difficulty y and a duration l.
We are dealing with a hidden array of integers, where each integer is in the range [0, 2^30). We are allowed to ask queries about contiguous subarrays.
We are managing a fleet of drones, each with an initial energy level. The rule is that no energy level should appear more than k times.
We are asked to construct an array of length $n$, where each position holds a non-negative integer, such that a collection of interval constraints is satisfied.
We are given an array of integers, and the goal is to make it "balanced." An array is balanced if each number x that appears in it does so exactly x times. So if a number appears too few or too many times, we need to remove some elements to fix it.
We are given a hidden integer position $p$ that will eventually be chosen somewhere inside a fixed interval $[l, r]$. We do not know the exact value, and our goal is to prepare a strategy before seeing $p$.
We have an infinite 2D grid with a black cell initially at the origin (0, 0). We perform a sequence of expansion operations, each either type "4" or type "8".
We are asked to construct a sequence of length $n$, where each element is a positive integer up to $10^{18}$, with a very specific constraint on neighboring pairs. For every adjacent pair $(ai, a{i+1})$, we compute its gcd.
We are asked to construct a sequence of length $n$, where each element is a large positive integer, and the goal is to control the structure of greatest common divisors between consecutive elements. For every adjacent pair $(ai, a{i+1})$, we compute $gcd(ai, a{i+1})$.
We are given a 2D grid of size $n times m$, where each cell contains a positive integer. We can construct "holes" in cells. A cell is considered a sink either if it has a hole, or if it is adjacent (sharing a side) to another sink with a smaller or equal value.
We are given two binary strings of equal length. Think of them as two rows of switches, where each position is either off or on. The task is to transform the first row into the second by repeatedly choosing a segment and flipping all bits in that segment.
We are given an array of length $2n$. We must split its elements into two subsequences $p$ and $q$, each containing exactly $n$ elements. Order inside a subsequence does not matter, only the multiset of chosen values matters.
We are given an array $a$ and another array $b$ of the same length. Two players alternate turns for exactly $k$ moves. On each move, the current player picks an index and either adds or subtracts the corresponding value $bi$ from $ai$.
We are given a football match with a fixed number of players, and a sequence of disciplinary actions in the form of yellow and red cards. Each yellow card contributes toward a potential suspension, and each red card immediately suspends a player.
We are given a permutation grid of size $n times n$, where every number from $1$ to $n^2$ appears exactly once. Instead of directly using this grid, we interact with a hidden process that defines, for each snake length $l$ and time $T$, a value $f(l,T)$.
We are given a quadratic polynomial in one variable, and we repeatedly raise it to a power that changes per query.
We are asked to partition a sequence of positive integers into contiguous subarrays such that each subarray has a cost defined by the ratio of its last element to its minimum element, rounded up. Formally, for a subarray $b$, the cost is $lceil bk / min(b1, dots, bk) rceil$.
We are asked to work with sequences of positive integers. For any contiguous subsequence $b$ of a sequence $a$, there is a notion of cost: it is the ceiling of the last element of $b$ divided by the minimum of all elements in $b$.
We are tasked with reconstructing a hidden sequence of length $2n$ in which each number from $1$ to $n$ appears exactly twice. The only tool we have is the MAD query.
We are given a polynomial $f(x)$ of degree $n$ where some coefficients are known and others are undetermined (represented by $-1$).
We are given a grid filled with zeros and ones. For every cell in this grid, we want to know the smallest possible “valid rectangle” that covers it, where validity is defined in a very specific way: the rectangle must have ones at all four corners, not necessarily inside.
We are given a multiset of integers, and we are allowed to split it into several smaller multisets such that every original element is used exactly the same number of times overall. In other words, we are partitioning occurrences of numbers into groups.
We are given two arrays, one of length $n$ and one of length $m$, and together they contain every number from $1$ to $n+m$ exactly once. You can think of the elements as being split into two buckets. We then simulate a long sequence of $k$ steps.
We are given a binary string where some positions are fixed as 0 or 1, while others are unknown and can be chosen freely. Once we assign values to all unknowns, we obtain a fully concrete binary array of length n.
We are given an array of integers and, for each query value X, we are allowed to increase individual elements of the array by repeatedly adding one. Each query is independent, and we always start from the same initial array.
We are asked to compute a global sum over all subsets of vertices in a tree. The input is an unweighted tree with n vertices. From this tree, we imagine a complete graph where the weight between any two vertices equals the distance between them in the original tree.
We are given an array and we are allowed to delete elements from it. After deletions, we want the remaining sequence to satisfy a very specific restriction: it must not contain two elements where the later element is exactly one larger than the earlier element.
We are asked to maximize bonus points in a store where every purchase can potentially increase our loyalty level. Each item has a price between 1 and some loyalty factor $X$. Initially, our loyalty level is calculated as the integer division of our total spend $S$ by $X$.
We are given an $n times n$ grid with black cells marked and white cells marked .. Our goal is to paint some white cells black so that three conditions are met simultaneously. First, there must be at least one black cell.
We are simulating a sequence of contest rounds where a participant can sometimes adjust their rating before each rated round.
We are given an array whose values are fixed, but we are allowed to permute them arbitrarily before answering queries. Alongside this array, we are also given several index ranges.
We are asked to construct a labeled tree with $n$ vertices such that the sum of the products of the labels of each edge is a perfect square. Formally, if the tree has edges $(u, v)$, we compute $S = sum (u cdot v)$, and $S$ must equal $x^2$ for some integer $x$.
We are given several test cases. In each test case, we must construct a permutation of the numbers from 0 to n−1. Think of this permutation as placing each number exactly once on a line of length n. On top of this array, we are given m intervals.
We are given an array of integers between 1 and n and an integer k. We are allowed to append exactly k numbers to the end of this array.
We are given a hidden permutation of size $n$, meaning it contains each number from $1$ to $n$ exactly once. After this permutation was fixed, someone chose a segment $[l, r]$ and increased every element inside that segment by exactly one.
We are given two integers a and b. We can repeatedly pick an integer x such that 0 ≤ x ≤ a (the current value of a) and replace a with a XOR x.
We are given a binary string s of length n, which means it contains only '0' and '1'. The task is to select a subsequence p from s such that two conditions hold: first, p must be non-decreasing (so all '0's must appear before any '1's in p), and second, if we remove all…
We are given an array of integers, each between 1 and 10, and we are asked to find the maximum average of any contiguous subarray. A subarray is simply a consecutive segment of the array, which can be as short as a single element or as long as the entire array.
We are dealing with a two-phase interactive problem. In the first phase, Player A receives a full $n times n$ binary grid, where each cell is either a 0 or a 1, and each test case also specifies whether the grid is fully connected through 1s or not.
We are given a hidden permutation of the integers from 0 to n−1, and a collection of fixed segments of this permutation. For each segment, we are interested in its mex, the smallest non-negative integer that does not appear inside that segment.
We are given a hidden permutation of integers from 0 to n-1, and our task is to find the maximum MEX over a set of ranges. Each range specifies a contiguous segment of the permutation, and the MEX of a range is the smallest non-negative integer missing from that segment.
We are given a sequence of integers, and two players take turns acting on consecutive pairs of elements. On each turn, the current player may either skip or swap the current element with the next.
We are given a permutation of integers from 1 to $n$, and a binary string $x$ of the same length. Initially, we have another binary string $s$ of zeros.
We are given a 2-row grid with $n$ columns, where each cell contains a distinct integer from $1$ to $2n$. For any interval of integers $[l, r]$, we can generate a binary grid where a cell is marked 1 if its original value falls inside that interval, otherwise 0.
We are given a long base string and many independent queries, each asking about a contiguous segment. For any queried segment, we are interested in all substrings that are palindromes and that appear at least twice inside that segment.
We are dealing with a hidden tree on $n$ labeled vertices, but we cannot see its edges directly. Instead, we can “probe” the tree using permutations. Each query is a full ordering of the vertices.
We are given a rooted tree where every vertex has a fixed parent, and thus a fixed ancestor structure. Alongside this tree, each vertex $u$ comes with a target number $au$.
We are given a rooted tree with $n$ nodes, labeled from $1$ to $n$, with node $1$ as the root. For each node $u$, a number $au$ is specified.
We are given an undirected connected graph with vertices and weighted edges. We start at vertex 1 and must traverse the graph such that every edge is marked at least once, returning to the start.
We start with a string s and want to turn it into another string t, both of the same length. The only allowed move does not directly edit characters; instead, it rebuilds the entire string at once using a very constrained rule.
We are asked to simulate a dungeon scenario where you have a set of swords, each with a damage value, and a set of monsters, each with a life value. You can kill a monster if your sword’s damage is at least equal to the monster’s life.
We are given several test cases. In each one, we receive a strictly increasing list of positive integers. The task is to choose two different elements from this list, call them $x$ and $y$, with the restriction that $x < y$, such that when we divide $y$ by $x$, the remainder…
We are given a sequence of numbers, and we repeatedly compress it until only one value remains. Each operation takes two adjacent elements, removes them, and replaces them with any integer lying between the two original values, inclusive.
We are given a permutation of length $n$, which is an array of distinct integers from 1 to $n$ arranged in some order. The task is to count the number of contiguous subarrays (intervals) that contain a specific pattern, called a 21435-subsequence.
We are given an array of integers, and each element acts like a cap: for each position $i$, we are allowed to choose a value $bi$ anywhere between $0$ and $ai$, inclusive. From this chosen vector $b$, we look at the XOR of all its elements.
We are given a tree and we need to assign colors to its edges. The restriction is that we must use exactly $k$ distinct colors, each appearing at least once. Once the coloring is fixed, consider any two vertices and look at the simple path between them.
We are given a sequence of integers. Our goal is to split this sequence into the smallest number of subsequences where each subsequence is “consecutive in value.” That is, within a subsequence, every adjacent pair differs by exactly one.
We are given a multiset of integers, which we can think of as a bag of marbles where each marble has a color represented by a number.
We are asked to merge elements arranged in a circle. Each element is a non-negative integer, and two elements are considered adjacent if they are next to each other in the array or if one is at the start and the other at the end.
We are given an integer array and a corresponding cost array. For each position in the array, we can replace its value at a certain cost, and positions we do not change keep their original values.
We are given an unrooted tree and a parameter $k$. For every possible choice of a root $r$, we conceptually “re-root” the tree at $r$ and then look at all ways of selecting exactly $k$ distinct nodes.
We are given a one-dimensional segment from 0 to x, and a set of n friends sitting at fixed integer positions on this segment. We are allowed to place k teleport points anywhere on the segment, all at distinct integer positions.
Each test case gives a collection of large integers, and the task is to find the smallest integer $x ge 2$ such that at least one element in the array is coprime with $x$.
We are given several independent test cases. Each test case consists of a sequence of integers representing toys arranged in a line. The only operation allowed is swapping two elements if one is even and the other is odd. Swaps between two evens or two odds are forbidden.
We are given two strings, s and t, each of length n. The first string represents a row of lettered cubes, and the second string is a target name. The task is to determine if it is possible to rearrange the letters of s to exactly match t.
We are given four stick lengths per test case, and we want to know whether these four sticks can be arranged to form the boundary of a square.
Alice has a secret integer x between 1 and 2^15 that she wants to communicate to Bob using a set S drawn from the integers 1 through 20. The twist is that when Bob receives S, one element may have been added, one may have been removed, or S may be unchanged.
Something went wrong. If this issue persists please contact us through our help center at help.openai.com.
We are asked to design a two-phase program that communicates an array of integers through a single string. On the first run, the program receives an array of length n, where each element is at most 26.
We are asked to implement a two-phase encoding and decoding process for an array of integers. In the first phase, the program receives an array a of size n with values up to one billion and must output a string s composed of lowercase letters.
We are asked to count arrays of length $n$ over the integers from 1 to $m$ that are “perfect” with respect to $k$ given sets of numbers. Each set defines the allowable value for a position in a hypothetical “beautiful” array of length $k$.
We are given an infinite sequence of natural numbers starting from 1. Polycarp performs a special removal operation exactly $x$ times. Each operation removes all numbers in positions that are multiples of $y$ in the current sequence.
We are asked to model a two-player game on a set of points in the plane, where each point has a cost. Alice removes some points with the goal of maximizing a total score, and Bob then draws the smallest axis-aligned rectangle containing all remaining points to minimize the score.
We start with an infinite sequence of natural numbers, effectively thinking of it as the array 1, 2, 3, 4, .... The process repeatedly removes elements based on a fixed step size y: every time we apply an operation, we delete the elements sitting at positions y, 2y, 3y, ...
We are given a one-dimensional river represented as a string of cells. Each cell has one of three behaviors: it can push Monocarp left, push him right, or do nothing. Monocarp chooses a starting cell and then moves step by step in discrete time.
Each test case gives a sorted list of marble values and a fixed integer chosen by Alice. Bob must pick his own integer, and then every marble independently awards its point to whoever is closer to that marble’s value, with Alice winning ties.
We are given an array of integers and allowed to perform a single operation at most once: choose a contiguous subarray and replace all its elements with the sum of its 1-based endpoints.
We are asked to process multiple queries on an array of integers, where each query specifies a segment of the array and a target number. For each query, we need to find the smallest subset of elements within that segment whose XOR equals the target.
We are asked to count binary strings of length n that satisfy multiple “beauty” constraints on certain substrings. A block is a maximal contiguous sequence of identical characters.
We are given a string consisting of the characters 'X', 'V', 'I', and '?'. Each letter has a numeric value: 'X' is worth 10, 'V' is worth 5, and 'I' is usually worth 1, but if it is immediately followed by an 'X' or 'V', it counts as -1.
We are given an array of length $n$, initially all zeros. We perform exactly $n$ operations, and each operation adds $1$ to every element of some chosen contiguous segment.
We are asked to consider an $n times n$ grid of integers filled sequentially row by row. The first row contains numbers from $1$ to $n$, the second from $n+1$ to $2n$, and so on until the $n$-th row, which contains numbers from $n^2-n+1$ to $n^2$.
We are given two multisets of integers, one called $q$ and one called $r$, along with an upper bound $k$. The only way to remove elements is by pairing one value from $q$ with one value from $r$ through a hidden construction involving two integers $x$ and $y$, where $1 le y <…
We are given two arrays of the same length, a and b, where each element of a is at most the corresponding element in b. The task is to transform a into b using two allowed operations: incrementing a single element of a by 1, or doubling all elements in a.
The task asks us to construct an array of length n with strictly increasing integers, all bounded by m, such that a particular score is maximized. The score is the sum of v(i, ai) from i=2 to n, where v(b, x) is the largest power k such that b^k divides x.