brain
tamnd's digital brain — notes, problems, research
43815 notes
We are asked to construct an array a of length n, where each position i contains a positive integer not exceeding $10^9$.
We are controlling a single creature whose “state” is an integer value from 0 up to n. We start at state 0 and want to eventually reach state n. There is a shop that sells helper creatures. Buying a helper of value i costs ai, and there is unlimited supply for every i.
We are given a fully specified deterministic tournament between 16 teams. Every pair of teams has a fixed outcome encoded in the input: for any initial seed positions i and j, exactly one of them wins if they ever meet, and this result never changes.
We are given a tree with n nodes. Each node independently contains an enemy with probability pi, given as a fraction ai / bi modulo a large prime. For any choice of a target node x, the protagonist starts from some leaf node and walks along the unique simple path to x.
We are given a rectangular grid with dimensions $n times m$. On this grid, there are $k$ mineral fields. Each mineral field is defined by a center cell $(xi, yi)$ and a Chebyshev radius $disi$, meaning it occupies every grid cell whose row and column are both within $disi$ of…
We are building a small team with a limited number of slots, and we want to maximize total attack power. There are two types of units. One type is a basic unit, which always contributes a fixed attack value $a$.
Each input test case gives two stellar classifications written in a fixed format: a capital letter followed by a digit. The letter represents a coarse temperature class ordered from hottest to coldest as O, B, A, F, G, K, M.
We are given two configurations of a 3 by 3 grid, each cell containing a distinct digit from 1 to 9. So each grid is really a permutation of the numbers 1 through 9 arranged in row-major order.
We are simulating a production pipeline with k workers arranged in a line. Each worker has a private inbox. Over time, n items arrive at specified workers at specified minutes. Once an item is in a worker’s inbox, it participates in a synchronized daily routine.
We are given a list of positive integers, and we are allowed to perform exactly $k$ operations. Each operation picks a single position and increases that element by 1.
We are given a decimal integer $A$ with no leading zeros. Think of its digits as positions in a sequence. We want to construct another integer $B le A$ such that the digit sequence of $B$ can be interpreted as a valid weighted parenthesis system.
We are simulating a point moving inside a vertical strip between two horizontal boundaries, at heights 0 and H. Inside this strip, there are point obstacles called boards. These boards are not intervals or segments, they are exact coordinates.
We are asked to construct an array of length $n$ consisting of distinct positive integers. The array is not arbitrary: every pair of adjacent elements must be coprime, meaning their gcd is exactly 1.
We are given a sequence of integers and we repeatedly look at its prefixes. For each prefix of length i, we must decide whether we can construct a permutation of positions and a permutation of values so that the prefix values appear as “window maxima” of a carefully chosen…
We are given a cyclic structure with $n$ rotating rings, each ring associated with a step size $ai$ and an initial position $bi$ on a regular $m$-gon.
We are maintaining a dynamic array that starts with an initial sequence and then grows over time by appending elements. Over this evolving array, we are asked to process two kinds of operations that are intentionally obfuscated so that each query depends on the previous answer.
We are given a set of weapon choices and a separate set of support sets. Each weapon has a base attack value and a bonus that contributes either to critical rate or critical damage depending on its type.
We are given an array of integers placed on positions from 1 to N. A “path” is formed by picking any starting position and then repeatedly either stopping or jumping to a strictly larger index.
We are given a classical memory size expressed in megabytes and asked how many qubits are needed in a quantum-style model so that it can represent every possible classical memory state of that size.
We are given a tree where each vertex must be assigned a value from 1 to 5. The number of vertices assigned each value is fixed in advance, so exactly cnt1 vertices must get value 1, exactly cnt2 vertices must get value 2, and so on up to 5.
We are given a single integer $X$. We need to find the largest integer $Y$ such that $Y le X$ and the binary representation of $Y$ is a palindrome.
We are given a rooted tree where each node represents a state of a system, and each edge from a parent to a child is labeled with a lowercase letter.
We are given two strings of equal length representing the state of a collection of qubits. The first string describes an “isolated” configuration, where some positions are stable bits 0 or 1, and some positions are uncertain and marked as , meaning the qubit is in…
We are simulating a bathhouse that consists of a grid with 2m rows and n columns. Each cell can hold at most one person. Rows are naturally paired: row 1 faces row 2, row 3 faces row 4, and so on.
We are given a graph with 2n cities split into two rows. The first row contains cities labeled from 1 to n, and the second row contains cities labeled from n+1 to 2n.
We are given an undirected graph with n vertices and m edges. The graph can already contain self-loops and multiple edges between the same pair of vertices.
We are looking at a partially dealt hand from a two-deck card game. The full deck has 108 cards, meaning each rank-suit combination appears twice.
We are given a one-dimensional world that behaves like a lane from position 0 to a large endpoint. Enemies spawn at the left end at specific times, each with an initial health value. Once spawned, every enemy moves right by one unit every second.
We are given a square assignment problem where there are as many employees as jobs. Each employee-job pair has a profit that comes from two parts: a structural part derived from the employee’s skill value and the job’s requirement value, and an optional bonus that applies…
We are given a mutable integer array. Two types of operations are applied over time. One operation increases every element in a contiguous segment by the same value.
We are given two players who each hold a multiset of Rock, Paper, and Scissors cards. Both players will play all their cards over n rounds, one card per round per player, and each round is evaluated by the usual Rock-Paper-Scissors rules.
We are given two integers $x$ and $y$ such that there is at least one integer strictly between them. The task is to pick an integer $z$ that lies strictly inside the interval $(x, y)$, and at the same time is “compatible” with both endpoints in the sense that it shares no…
We are given an array $a$ of length $n$, and a sequence of $k$ operators, each being either a sum operation or a product operation.
We are given a tree where each vertex starts with a color. Then we process a sequence of repaint operations, each of which overwrites colors on a specific set of vertices. The goal is to determine the final color of every vertex after all operations are applied in order.
We are given several hidden positions on a number line from 1 to 100000. These positions represent locations of firefly groups. We do not know the positions, and multiple groups may exist at different points.
We are asked to evaluate a range expression over integers from $l$ to $r$. For each number $x$ in this interval, we take the bitwise XOR of $x$ with a fixed integer $y$, interpret the result as a value, and then aggregate those results over the entire range.
We are given a single array f of size n. This array is claimed to be the final state of a Disjoint Set Union structure that started from f[i] = i for every element and then had at most n calls to a merge(u, v) operation. The DSU implementation is slightly asymmetric.
We are given an array, and instead of computing a classical longest increasing subsequence, we apply a very specific greedy procedure to every contiguous subarray and sum the results.
We are asked to construct an integer array of length n, assigning a value to each position in a line of Nabis. The assignment must satisfy two sliding window constraints simultaneously. For every contiguous segment of length p, the sum of its elements must be strictly positive.
Codeforces 105911H: Bingo Game
We start with $n$ identical coins, all initially showing heads. Another player secretly flips exactly $k$ of them to tails, and we do not know which subset was chosen.
We are given a tree with nodes labeled from 1 to n. The structure of the tree is fixed. Each query provides three values l, r, and x, and asks for a single node: if we consider only the nodes in the contiguous label range from l to r, and treat x as the root of the tree, we…
We are given a row of statues, each initially pointing in one of four directions arranged in a cycle: front, right, back, left, and then back to front again after a full rotation.
We are given a binary string representing a schedule over n time slots. Each position is either 1, meaning TreeQwQ is currently on a date, or 0, meaning free time.
We are given a directed graph where each cave is a node and each one-way passage is a directed edge with a weight called difficulty. Alice starts at a specified node with an initial integer stamina.
We are given a grid where some cells are marked as occupied and all occupied cells form one connected region if we move in four directions.
We are given several line segments inside a rectangular box aligned with the coordinate axes. Each segment has both endpoints on the surface of the box, so every segment “lives” entirely within or on the boundary of the cuboid.
We are given a sequence of tree heights. We must perform exactly $s$ operations, and each operation reduces the height of exactly one tree by one unit.
We are given a binary grid with n rows and 4 columns. Each cell tells us whether a note exists at that time step (row) and lane (column). A 1 means a note must be played, and a 0 means empty space.
We are given a two-player deterministic game played with a pile of skewers. At the start there are x skewers and a parameter k. Players alternate turns, with OC always moving first.
We are given a line of positions from 1 to n. A player starts at one of the two endpoints and moves forward in time through m events.
We are given an array that changes over time, and we must answer two kinds of queries on it. One query modifies a single position, and the other asks whether a chosen contiguous segment of the array has a very specific property. The property itself is defined indirectly.
We are given several integer arrays, and for each one we want to build a subsequence with a very specific structural property. Take any chosen subsequence and sort it.
We are given several independent test cases. In each test case there are multiple casinos and several existing players. For every casino, each of the existing players has already committed a nonnegative number of dice.
We are given a grid where each cell contains an integer value, and we consider all monotone paths from the top-left corner to the bottom-right corner, where each move is either right or down.
We are given several independent test cases. In each test case, there are multiple groups of identical items. Group i contains aᵢ items, and every item in that group has weight exactly 2^{bᵢ}. All items from all groups must be packed into m identical knapsacks.
We are given a list of numeric attributes, where each attribute starts with an initial value. Alongside this, there are several constraints.
We are given a very long integer sequence, but it is not provided explicitly. Instead, it is given in compressed form as runs of equal values. Each run says that a value v is repeated l times, and adjacent runs always have different values.
We are given three small integers $A$, $B$, and $C$, and then a list of up to 1000 query values $X1, X2, dots, XQ$. For each query value, we must evaluate a fixed cubic expression, take its absolute value, and finally combine all results using bitwise XOR.
We are given a directed weighted graph where nodes represent gas stations and edges represent one-way roads with travel distances. We start at node 1 and must reach node N. Every valid route from 1 to N has two competing criteria.
Two moving objects are given on a 2D plane, each one represented as a rigid triangle. Each triangle is described by three fixed vertices at time zero, and then the entire triangle translates with a constant velocity vector.
Each person chooses exactly one other person as their “true love”. From this we build a directed graph on $N$ vertices where every vertex has exactly one outgoing edge, possibly to itself.
We are given an infinite collection of cards where each card is labeled by a power of a fixed integer $n$. The first card has value $n^0$, the second $n^1$, the third $n^2$, and so on.
We are comparing two containers filled with ice cream: a cylindrical bottle and a cone with an extra dome on top. The bottle is a simple cylinder with radius rL and height hL, completely filled. Its capacity is just the usual cylinder volume.
Codeforces 105895B: Royale Bataille
We are given a noisy black-and-white image represented as an $n times m$ grid of characters. Each cell is either 0 or 1, where 1 corresponds to a white pixel and 0 corresponds to a black pixel.
We are given a small grid, up to 8 by 8, where each cell is either allowed or forbidden. Allowed cells contain a cat and are marked with a character like Y, while forbidden cells are marked with N.
We process a sequence of events where each event reveals a value and a profit structure. Alongside this sequence, we maintain a cache with limited capacity.
We are given a square grid of size $n times n$, where each cell contains an integer between $0$ and $n$. We are allowed to modify at most half of the cells in the grid, rounding down. Each modification replaces the current value with any integer in the same range.
We are given a fully connected graph on $n$ vertices, but the edge weights are not arbitrary. Each vertex $i$ has a value $ai$, and the weight of the edge between $i$ and $j$ is defined as $min(ai, aj)$.
We are asked to construct a tree on nodes labeled from 1 to n. The tree must be rooted at node 1, and the only thing that matters in all constraints is the distance from node 1 to every other node in that tree.
We are given a sequence of integers, and the goal is to make all elements equal using a specific operation. Each operation is performed by choosing an index $i$, and then choosing one of three effects. The first effect changes only $ai$ by increasing or decreasing it by 1.
We are given a sequence of integers representing rhyme labels of poems generated line by line. We are allowed to delete any number of lines, but we are not allowed to reorder the remaining ones.
We are given an array of positive integers. Each query focuses on a contiguous segment of this array, and for that segment we are allowed to pick any subsequence (not necessarily contiguous, but preserving order) to form a “game array”.
We are given an array of positive integers, and many queries. Each query selects a contiguous segment of this array. For that segment, the two players effectively play a game on a chosen subsequence of its elements.
There are two types of cows and two ways they can choose to receive grass. Each cow can choose option A or option B. If k cows choose A, then every A-cow receives x/k units of grass. If a cow chooses B, it simply receives y units.
We are given a row of students, each with a fixed score. A teacher repeatedly selects a student and checks whether that student can be removed from the row.
We are given a rooted tree with $n$ nodes, each node carrying a positive weight $vi$. Two players, Dawn and Tsuki, alternately “claim” nodes until one of them cannot make a legal move, at which moment the game immediately ends and both are considered to meet.
We start with an initial value $v$, and we are given $n$ operations. Each operation is either an addition by some real number $xi$, or a multiplication by some factor $xi$. We are allowed to reorder these operations arbitrarily.
We are given a strip divided into n consecutive segments. Each segment already has an initial color, but that starting configuration does not really matter for the final goal except as a source of structure.
We start with an $n times n$ grid where every cell initially contains the value 1. Two arrays $a1 dots an$ and $b1 dots bn$ control a random process that repeatedly deletes either a row or a column until all rows and columns are gone.
We are given a tree where every node initially carries one of three colors: red, green, or blue. We are allowed to recolor any subset of nodes into white, and white nodes are treated as “removed” in the sense that they no longer participate as red, green, or blue.
We are given two rows of balls placed along the boundary of a rectangle. The bottom row contains a fixed permutation of numbers from 1 to n.
Each test describes a simple comparison game between three values: Alice’s strength a, Bob’s strength b, and Candy’s strength c. The output is a string chosen by applying a priority rule over these comparisons. The decision process is sequential.
We are given an $n times n$ grid of unit cells. The task is to assign each cell one label from $1$ to $n$, forming exactly $n$ regions, where a region is simply the set of cells with the same label. Regions do not need to be connected.
We are given a circular array of length $n$, where each position holds an integer value representing some bitmask. The array evolves in discrete rounds.
There are $n$ animals placed on distinct positions on an infinite number line. Each animal also has exactly one associated “fan” (we will call them collectors) placed on another set of distinct positions.
We are given several independent rectangles that represent possible shapes of a board. For each board, we need to count how many ways we can place an axis-aligned rectangular “window” inside it such that the window has a fixed area s, and it does not touch any border of…
We are asked to count how many positive integers strictly smaller than a given number n could have appeared on a special pencil during sharpening. The key constraint is that all valid numbers must be prime and must not contain the digit zero.
We are given a rectangular garden with $n$ rows and $m$ columns. Each cell contains an integer describing the type of flower growing there. We observe the garden twice: once before a transformation process and once after it.
We are given a binary string of length $N$, where each character describes how the $i$-th item must be paired with values drawn from a fixed set of numbered elements.
We are given an undirected graph with a distinguished starting vertex, which we can think of as vertex 1. Alongside the graph, we are also given a sequence of vertices starting from this root, written as x0 = 1, followed by x1, x2, up to xk.
We are given a fixed dictionary of words and then a sequence of query strings. For each query, we want to know how many words in the dictionary start with that query as a prefix.
The wall is given as an n by m grid of cells. Each cell is either empty or blocked by a nail. A poster can only be hung on a rectangular region of the wall, and every cell inside that rectangle must be free of nails.
Two players alternate climbing a coconut tree. On the first climb Samuell takes a fixed amount $x$, and on the second climb Lleumas takes $y$.
We are given an undirected weighted graph that models a region. Two special vertices are distinguished: one is the main entrance of a university, and the other is the destination called IC. For every query vertex $x$, we compare two ways of reaching IC.
Each test describes a simple structured battle: there are n waves of enemies, and the i-th wave contains exactly i balloons. Every balloon in a wave has the same power level k, and the cost of destroying a single balloon is i raised to the power k.
The task “Song” is essentially about reconstructing or evaluating a sequence derived from a structured description of a song.
We are given a collection of vectors, each consisting of bits, and we are allowed to choose some of them to form a subset.
Each test case describes the state of a single 7-segment LED digit display, but the display is imperfect and ambiguous.