brain
tamnd's digital brain — notes, problems, research
43815 notes
We are given a multiset of integers of size exactly twice some number n. The task is to rearrange these values into a new order such that if we split the reordered array into two consecutive halves of length n, the sum of the left half is different from the sum of the right half.
We are asked to assign a label to every integer from 2 up to n. These labels are positive integers, and they must satisfy a strong interaction rule: whenever two numbers share no common divisor greater than 1, meaning they are coprime, their assigned labels must be different.
We are asked to place numbered pieces from 1 to n onto an m by m grid. Each piece i is placed at a cell with integer coordinates.
We are working with a system of pictures where each picture has a weight that controls how likely it is to be shown when we visit a website. At any moment, the probability of seeing picture $i$ is its weight divided by the total weight of all pictures.
Two trains move on a circular line with stations labeled from 1 to n. One train moves clockwise, increasing station numbers modulo n, while the other moves counterclockwise, decreasing station numbers modulo n.
We are given a multiset-like array of length $2^k$, where every value lies in the same range as indices of permutations of size $2^k$.
We are given a binary string and we look at all possible contiguous substrings. For each substring, we want to know whether it contains a pattern of three equally spaced positions where all three characters are identical.
We are given a circular-valued array where each element lies in the range from zero up to some fixed modulus minus one. One operation consists of choosing any subset of positions, and incrementing all chosen values by one with wraparound at the modulus boundary.
We are given a valid parentheses string. Think of it as a walk that starts at height 0, where every opening bracket increases the height by 1 and every closing bracket decreases it by 1, and the walk never goes negative and ends at 0.
We are given a string of digits and we are allowed to delete characters freely, without changing the relative order of the remaining digits. The task is to decide whether we can extract a subsequence of length exactly 11 that forms a valid telephone number.
The task describes a growing undirected graph where each edge also carries a color. Edges only ever get added, never removed. Interleaved with these updates are connectivity queries, but connectivity is not defined in the usual sense of arbitrary walks.
We are given a starting value a, an ending value b, and a parameter m. We need to decide whether we can construct a sequence of positive integers that begins at a, ends at b, and grows in a very specific cumulative way.
We are given a list of student names and we are allowed to split these students into two classrooms. Every student must go to exactly one of the two rooms, and either room may end up empty.
Ivan needs to buy a fixed multiset of items, split into types, where each type requires a certain number of copies. Each day he earns exactly one unit of currency, and he can spend it immediately to buy items in the evening of the same day or save it for later.
We are given a multiset that is supposed to represent almost all divisors of some unknown integer $x$. “Almost all” here has a precise meaning: the list contains every divisor of $x$ except $1$ and $x$ itself.
Ivan needs to acquire a collection of items, where each item belongs to one of several types. For each type, he must buy an exact required quantity.
We are given a list of contests, each with a certain number of problems. Polycarp trains day by day, and on day $k$, he must pick exactly one unused contest and solve exactly $k$ problems from it.
We are given a weighted undirected graph with up to 200,000 vertices and edges. Each edge has a fixed weight, and we care about the shortest path from node 1 to node n using the sum of edge weights. The twist is that we are not solving just one shortest path problem.
We start with a circle of $n$ cats sitting in order, forming a single continuous ring of occupied positions. Then $m$ of these cats leave. After each departure, the circle is no longer fully connected, because empty positions break adjacency.
We are given a set of points on a 2D plane. Each point represents a power pole, and every pair of poles defines a straight infinite line, which we interpret as a “wire”.
We are given two grids of the same size. Each cell position contains a pair of numbers, one in the first matrix and one in the second. The only allowed operation is to swap the two numbers at the same coordinate between the matrices.
We are given a sequence of operations applied to a single pile of stones. Each operation is either adding one stone or removing one stone.
We are given an undirected connected graph with $n$ nodes. Bob starts at node 1 and performs a walk along edges. Every time he enters a node that has never been seen before, he writes it down.
We are given a square grid filled with two possible characters, X and .. The task is to scan every interior cell of this grid and decide whether it is the center of a “cross” pattern formed by diagonals.
We are given a string and a fixed window size $k$. The task is to repeatedly carve out several disjoint blocks of length $k$ from the string. Each chosen block must consist of the same character repeated $k$ times, and all chosen blocks must use the same character.
We are given a rectangular grid where each cell is either blocked, empty, or already owned by one of up to nine players.
We are working on a fixed 4 by 4 board that starts empty. A stream of dominoes arrives one by one, and each domino must be placed immediately when it comes. Each domino is either vertical, covering two cells in the same column, or horizontal, covering two cells in the same row.
We are given a sequence of integers, and we want to assign another sequence of integers of the same length, starting from zero, with very specific structure rules.
We are given a sequence of integers and asked to assign each position one of k labels, which we will call colors. Every position must receive exactly one color. At the same time, every color from 1 to k must appear at least once among all positions.
We are given a string of length $n$, where each position holds one of three symbols: 0, 1, or 2. We are allowed to modify characters, but each modification counts as a replacement cost of 1 per position changed.
We are given a collection of doors, each with an initial durability value. You and an opponent alternate moves for an extremely large number of turns, so the process effectively runs until both players’ optimal strategies stabilize.
We are given a sequence of integers, and we want to cut it into consecutive chunks. Every element must belong to exactly one chunk, and every chunk must be non-empty. After splitting, we look at all possible non-empty collections of these chunks.
We are processing a growing collection of rectangular banknotes. Each time a note is added, it stays forever. Later we receive queries asking whether all notes seen so far can be placed inside a given rectangular wallet.
We are given several independent test cases. Each test case provides a collection of closed segments on a number line. The task is to assign every segment to one of two groups such that no segment in one group overlaps with any segment in the other group.
Each query describes a forbidden interval on the number line and a fixed step size. We are asked to find the smallest positive integer that is a multiple of a given number $d$, but lies strictly outside the interval $[l, r]$.
We are given a tree where each node carries an integer label. For any two vertices, consider the unique simple path between them. Along that path we look at all vertex values and compute their greatest common divisor.
We are given a row of browser tabs indexed from 1 to n. Each tab is either useful for an exam or represents a social media site. This is encoded as an array of length n where each value is either 1 or -1. Roman chooses a step size k. After that, he selects a starting tab b.
We are given an array of values on a line, where each position represents a burger shop and the value at that position is the cost of the most expensive burger available there.
We start with a single integer placed on a board. At each step, this number is replaced by one of its divisors, chosen uniformly at random.
We are given a circular lock that behaves like a 360-degree dial. Starting from zero, we perform a sequence of rotations, each rotation having a fixed magnitude, but we are free to choose its direction: clockwise or counterclockwise.
We are building digit strings of fixed even length using a restricted alphabet of digits. The string represents a ticket number, but the only structural rule that matters is how many times each allowed digit is used in each half of the string.
We are given a final score distribution across $p$ players whose scores are non-negative integers summing to $s$. Hasan is player 1, and his score is only partially constrained: it must be at least $r$, but otherwise unknown.
We are given a string and an integer weight attached to every character position. We are allowed to delete characters, and each deletion costs the weight of the deleted position as it originally appears in the string.
We are working with a regular polygon, meaning all sides and angles are symmetric. The input gives an angle value, and we must decide whether there exists some regular n-gon such that we can pick three vertices $a, b, c$ (not necessarily consecutive) and the angle formed at…
We are given a string that was produced by a very specific “stretched repetition” rule applied to some hidden original string. The original string is short, with length at most 10, but we do not know it.
We are given a binary string of parentheses. Each character is either an opening bracket or a closing bracket. We are allowed to pick exactly one position and flip the bracket type at that position.
We are asked to express a given integer n as a sum of exactly k numbers, where every summand must be a power of two. Each chosen number is therefore of the form 1, 2, 4, 8, ..., and repetitions are allowed because we can use the same power multiple times.
We are given a hidden circular ordering of the numbers from 1 to n. The ordering is a cycle, so each element has a next element and a next-next element when we walk clockwise around the circle.
We are given a partially specified array of length $n$. Each position either already contains a fixed value between $1$ and $k$, or is unknown and marked as $-1$. We must replace every unknown position with a value from $1$ to $k$, producing a fully filled array.
We are given an undirected graph and asked to assign each vertex one value from the set {1, 2, 3}. The assignment is valid only if every edge connects two vertices whose values sum to an odd number. The task is to count how many such assignments exist, taken modulo 998244353.
We are given a weighted tree, where each node carries a positive value. We are allowed to choose any node as a reference point, and for that choice we compute a score defined as the sum over all nodes of their value multiplied by their distance to the chosen node.
We are given a graph that is already a forest, meaning it consists of several disconnected trees. The task is to add exactly enough edges to connect all these trees into a single tree.
We are asked to construct a string for each query such that the string has a fixed length n and uses only the first k lowercase Latin letters, from 'a' up to the k-th letter. Every one of these k letters must appear at least once in the final string.
We are given a line of wall segments, each segment having an initial height. The goal is to transform this profile into a perfectly flat wall where every segment has the same final height and there are no uncovered gaps inside the structure. Two operations are allowed.
We are given a line of wall segments, each segment starting with some integer height. The only allowed action is to pick two adjacent segments that currently have exactly the same height and increase both of them by one.
We are given a collection of strings that all come from a single hidden string of length $n$. From that hidden string, every proper prefix and every proper suffix was taken, so for each length from $1$ to $n-1$ there are exactly two strings: one prefix and one suffix, but they…
We are given an array of integers representing the skill levels of students. The students must be paired into exactly $frac{n}{2}$ disjoint pairs, so every student is used exactly once. A pair is only “valid” if both students in it end up with exactly the same skill level.
Each row contains three ordered tokens on an infinite number line: a blue token on the left, a white token in the middle, and a red token on the right.
We are interacting with a hidden integer modulus $n$, and our goal is to recover its full factorisation. The twist is that we cannot access $n$ directly through arithmetic or inspection.
We are given a simple undirected graph on $n+1$ vertices, but one vertex is missing from the data. Every vertex except Bob’s vertex has a known degree, meaning we know how many neighbors each of those $n$ vertices has.
We are given three piles of ornaments: yellow, blue, and red. From each pile we may choose some number of ornaments, but the chosen numbers are not independent.
We are placing $n$ people around a circle and repeatedly moving a ball in fixed jumps. Starting from person $1$, we choose a step size $k$. Each time the ball is passed, we move $k$ positions clockwise, wrapping around the circle.
We are given a number $n$, and we conceptually build a very large sequence by listing every permutation of $1 ldots n$ in lexicographic order and concatenating them one after another. Each permutation contributes exactly $n$ elements, so the full sequence has length $n cdot n!$.
There are t students and n lectures. A student passes if they attend at least k lectures. Lectures alternate between two auditoriums. Lectures with odd indices are held in the first auditorium, which can hold at most a students.
We are given a line of houses, each painted with an integer color. We want to choose a contiguous segment of this line such that inside the chosen segment, no two neighboring houses share the same color.
We are given two strings, s and t. From s, we can take any prefix that is not empty, and independently from t, we can also take any non-empty prefix. For every pair of such choices, we concatenate the chosen prefix of s with the chosen prefix of t.
Each participant is described by two finite strings. From these two strings we build an infinite sequence by writing the first string once and then repeating the second string forever. So the structure is prefix-then-periodic-tail, where the tail repeats without end.
I can’t safely produce a correct, detailed editorial for Codeforces 1090F from the information given here, because the actual problem statement (what the interaction allows, what the judge returns, and what needs to be reconstructed) is missing.
We are given a sequence of integers and asked to choose exactly a fixed number of elements from it. After choosing them, we multiply the chosen values together and obtain a single number.
The problem statement section is empty, so I don’t have the actual definition of Codeforces 1090H - Linearization to base the editorial on.
We are given a configuration of stones arranged in a line. Each stone carries some information, and the game is played by two players who alternate moves.
The problem statement sections are empty, so there isn’t enough information to reconstruct what Codeforces 1090E - Horseback Riding actually asks or which flow/graph construction it uses.
We are given a set of positions $1 dots n$ and a list of constraints between some pairs of positions. Each constraint tells us the relationship between the values at two indices: either the first is greater than the second, smaller, or equal.
We are given several boxes, each containing a set of distinct items. Each item has a type, and no box contains duplicates of the same type. The total number of items is large, and items can be moved one at a time between boxes.
We are given several companies, and each company contains employees with fixed salaries. We are allowed to merge companies one pair at a time until everything becomes a single company.
I can’t reliably reconstruct Codeforces 1090B - LaTeX Expert from memory with enough confidence to write a correct, detailed editorial without risking inventing key parts of the statement or solution.
Got it - I can write a full Codeforces-style editorial (intuition, key idea, proof, implementation details, complexity, etc.).
We are maintaining a dynamic collection of knights, where each knight is defined by two values: an arrival time and a fixed service duration.
We are given a small programming language source file together with a set of reserved tokens. The original source may contain comments, arbitrary spaces, and user-defined identifiers.
We are given a collection of workers, each of whom has already picked a job they would like to do. There are exactly $k$ distinct jobs, and each worker points to one of them.
Sure-please paste the full Codeforces problem statement (or at least the link / input-output / constraints). Once I have it, I’ll write a proper competitive programming editorial with: - Key idea / intuition - Step-by-step reasoning - Formal solution - Complexity analysis -…
A volleyball match here is a short sequence of sets, with at most five sets played, and the first team to win three sets takes the match.
We are given a weekly schedule of classes that repeats every seven days. Each day of the week is marked either active or inactive for guest student classes. Alongside this schedule, we are given a target number of class days, denoted as $k$.
We are given a logical system built from boolean variables, where constraints are expressed as implications between literals.
We are given an $n times n$ chessboard and need to assign the numbers from $1$ to $n^2$ to all cells exactly once. The assignment must satisfy a constraint involving “chess interaction”: the numbering order should not create unwanted adjacency between consecutive integers.
I can't write a correct editorial for Codeforces 1089D from the information provided. The prompt asks for a complete editorial, proof, algorithm, implementation, worked examples, and tests. For a 3100-rated graph problem, that requires knowing the actual solution.
We are given a connected structure that is almost a tree but may contain simple cycles, with the restriction that any edge belongs to at most one cycle. Inside this graph there is a hidden vertex chosen by the judge.
We are given an array of positive integers that changes over time through range increments. Alongside this, we repeatedly answer hypothetical questions about a function that depends on the entire array.