brain
tamnd's digital brain — notes, problems, research
41404 notes
We are given a partially filled 4 by 4 grid that must be completed into a valid “quadruple Sudoku” variant. Each cell contains a digit from 1 to 4, except for some cells which are zero and must be filled. The rules are simple but strict.
We are given a directed graph where every vertex carries a positive integer label. Each directed edge from a vertex (u) to a vertex (v) contributes a weight defined as (log{au}(av)).
We are given an $n times m$ grid, where each cell represents a vertical stack of unit cubes forming a tower of height $h{i,j}$. Think of each cell as a column with discrete levels from 1 up to $h{i,j}$.
We are given a collection of straight lines in the plane. Every line is guaranteed to be one of three special orientations: horizontal lines of the form $y = c$, vertical lines of the form $x = c$, and diagonal lines of the form $x + y = c$.
We are given a fixed modulus $n$ and a set $A subseteq {1,2,dots,n}$ of size at most 40. From this set we consider all of its subsets.
We are given a line of stations numbered from 1 to n. From every station i there are exactly two outgoing roads. Each road either sends the train back to station 1 or forward to station i + 1, except that from station n both roads always go to station 1.
We are given an $n times n$ grid of unit squares, but the actual objects we work with are the grid intersection points, i.e. the $(n+1) times (n+1)$ lattice of vertices. Between adjacent vertices there are unit edges, forming the standard square grid graph.
We are given a rectangular grid where each cell contains either 0 or 1. We start from the top-left cell and must output a sequence of moves on the grid.
We are given a short poster text and a pen that can write using three fixed colors. Each color has a limited capacity measured in how many characters it can be used for.
We are given a planar “street graph” embedded on a grid. Each intersection is a vertex with known coordinates, and each road is a straight horizontal or vertical segment between two intersections.
We are given a collection of words, and we want to understand how pairs of these words can behave like valid “Split Decisions” clues. A valid clue comes from choosing two words of the same length and comparing them position by position.
We are asked to embed a fixed sequence of labeled beads into a simple grid walk. Each character in the input string corresponds to one step along a single closed non-self-intersecting path on a rectangular grid.
Each input string represents a candidate ISBN-10 code that may contain digits, hyphens, and possibly the character X as a checksum digit.
We are given a fixed map of tree locations on an integer grid and a second set of observations produced by a robot. The robot does not tell us where it is or which way it is facing, but it reports the relative positions of all trees it can currently see.
We are given a short string made of the characters E and O. This string describes the parity behavior of a Collatz sequence until the moment it first reaches a power of two.
Working
Working
We are given a convex polygon already in its final form, described by its vertices in counterclockwise order. There are no degeneracies: the polygon is strictly convex and every vertex is a genuine corner.
We are simulating a simplified agricultural estimation process for corn yield. The input describes five sampled corn ears, where each ear is characterized by two measurements: how many kernels wrap around the ear and how many kernels run along its length.
We are given a sequence of distinct positive integers, and we want to decide whether this sequence could be the result of a single partition step in quicksort, using some unknown pivot value that already appears in the array.
We are given two sets of customer locations, each set lying on a separate straight road. The roads are parallel, and there is a fixed vertical separation between them.
We are given $N$ labeled points placed on a circle, with every possible string drawn as a straight segment between two distinct points, but only some sets of strings are allowed.
We are given a multiset of up to 100000 robots, each labeled by a height between 1 and 20. From this multiset we must build a single linear ordering of all robots, and we also choose one robot to be the first element of this order, called the captain.
We are given a multiset of integer “types” representing items in a warehouse. Most types are perfectly balanced: every such type appears the same number of times, say $S$. Exactly one exceptional type breaks this pattern and appears fewer times, say $P$, where $P < S$.
We are given a line of participants who need to be split into teams. The organizers always try to form as many complete teams as possible, where each complete team contains exactly $K$ people.
We are given a grid where each cell has a numeric value representing flower beauty. A “photo” corresponds to choosing any contiguous subrectangle of this grid. For each chosen subrectangle, we look at every row inside it and take the maximum value in that row segment.
We are given a network of servers where every server is a node and each connection is an undirected edge. The current network may be disconnected.
We are modelling a process where a character accumulates energy over time and occasionally converts all stored energy into a permanent change in production rate. At the start, energy is generated at a fixed rate of one unit per minute.
We are given a directed network of cities connected by flights. Each flight has a direction and a cost, so traveling from city U to city V reduces our money by C if we take that flight.
We are given a sequence of numbers representing heights along a line. From this array, we want to select a contiguous segment that behaves like a “pool”, meaning the segment is anchored by two boundary positions and the structure between them does not introduce any higher…
We are given a single very large index $K$, and asked to compute the $K$-th value of a sequence defined by a third-order recurrence. The sequence starts with three fixed values, and every later term is built from the previous three terms plus an additional constant contribution.
We are given two groups of travelers initially split across two different universes, with A people on one side and B people on the other. Between the two universes there are N portals, and each portal can be used a limited number of times.
We are given a system with two coin denominations, A and B. Using these coins, one person must pay an exact amount N, but the interaction is slightly more flexible than a standard coin change problem because overpayment is allowed and the difference is returned as change using…
We are given a small undirected flight network where airports are nodes and flights are edges. A traveler starts at airport 1 and is allowed to take exactly K flights. Each flight moves along an undirected edge to a neighboring airport.
We are given a collection of intervals placed along a number line. Each interval represents a lamp that illuminates a segment of a road, from its starting coordinate to its ending coordinate.
We are asked to find all lattice points in the first quadrant whose distance to the origin is exactly $Dsqrt{2}$. Squaring the distance removes the square root, so we are really searching for all non-negative integer pairs $(x, y)$ such that $$x^2 + y^2 = 2D^2.
We are given a sequence of integers that grows in a very specific way. The first value is fixed as $a1$. Every next value is constructed from the product of all previous values, multiplied by a carefully chosen prime: at step $i$, we look at all primes that do not divide the…
We are given a target string that represents a genome sequence over the alphabet {A, T, C, G}. We also have a collection of available DNA segments, each also a string over the same alphabet.
We are given up to 10 time slots, and each slot corresponds to a possible day Yolanda may visit a shop. There are at most 100 items in the shop, and each item is available on some of those 10 days.
The input is a single integer N, which determines the size of a text drawing of a jellyfish. The drawing has two distinct parts. The body occupies the first N rows. Every body row contains exactly 2N - 1 consecutive 'J' characters.
Codeforces 104763E: Seacave Jellyfish
We are given a short sequence of lights in a tunnel, each light being either off (0) or on (1). The goal is to transform this sequence into a perfectly alternating pattern, where adjacent lights always differ.
Working
Working
We are given a fixed arithmetic expression consisting of a sequence of integers interleaved with operators, where the operators are addition, subtraction, and multiplication.
I can absolutely write that editorial, but I can't produce a correct solution from the information you've pasted because the problem statement has been corrupted.
We are given a set of up to 100 items. Each item is available on some subset of 10 days, described by a 0-1 matrix. On each of the 10 days, we decide whether Yolanda visits the shop or not, so a valid strategy is simply a subset of days.
We are given a target genome string over the alphabet {A, T, C, G}. We are also given a set of DNA segments, each of which can be reused arbitrarily many times. The task is to determine the smallest number of segments whose concatenation forms the genome exactly.
I can absolutely write this editorial, but I cannot correctly derive the algorithm from the problem statement alone. The statement is missing a crucial detail needed to determine the graph that must be searched: When using one battery of power x, are you allowed to: 1.
We are given a weighted tree with up to 100 nodes. Each node represents a seacave and contains some amount of jellyfish, represented by a nonnegative value.
We are given a sequence of integers representing how many jellyfish are eaten each minute over a fixed lunch period.
We are given a set of distinct integer positions on a line, each representing a jellyfish. From these positions we must choose exactly $K$ of them and consider only those chosen points.
We are given a sequence of jellyfish, each associated with a positive integer representing its number of tentacles. The first jellyfish starts with a given value $a1$.
We are working in a discrete geometric setting. Imagine a sphere centered at the origin in a $D$-dimensional integer lattice. Every lattice point whose Euclidean distance from the origin is at most $R$ is considered “inside or on the surface” of the sphere.
We are given a one-dimensional binary array representing a row of cells. Each cell is either inactive, shown as a dot, or active, shown as an X. Starting from this initial configuration, we repeatedly evolve the row for a fixed number of steps.
We are given a target surface area $C$, which is guaranteed to be the product of two distinct primes. Alongside this, we are given a list of $M$ available side lengths, where every element in the list is also a prime number.
We are working with a collection of labs connected by undirected “neighbour” relations. Each lab initially contains some number of desks and monitors. Over time, these counts change because we add desks or monitors to individual labs.
We are given a long sequence of machines over days, where each day provides a machine with a fixed “splitting power.
We are given a fixed sequence of students that PCC will talk to over time. Each position in this sequence corresponds to a moment, and each character is a student identifier from a small alphabet.
The input describes a walk in a tree-like structure encoded as a sequence of balanced parentheses. Every opening bracket corresponds to moving into a newly discovered room or revisiting a room from a deeper part of the traversal, while every closing bracket corresponds to…
We are given a row of cards, and each card has two numbers written on it. For each position, one number is initially facing up and the other is facing down. The initial configuration is fixed: the value we see on card i is $ai$, while $bi$ is hidden underneath.
We are given two standard dice, one with faces labeled from 1 to $n$ and another from 1 to $m$. Rolling them produces a sum distribution that is fully determined by convolution: each sum $k$ can be obtained in a number of ways equal to how many pairs $(i, j)$ satisfy $i + j = k$.
We are given several permutations of the same size, each permutation acting as a rearrangement of positions. When we compose two permutations, the result is another permutation where the i-th position of the result is obtained by applying one permutation after another.
We are given two collections of strings, each collection containing the same number of strings, and every string has the same fixed length. The task is to reorder the strings inside each collection independently, then concatenate each reordered collection into one long string.
We are given several test cases. Each test case describes a line of students, where each student is associated with a single integer value between 1 and m. That value represents which algorithm (by difficulty rank) the student knows.
We are given a tree where each vertex carries a small number of “sugar units”, specifically 0, 1, or 2. A single cake requires exactly k units of sugar.
We are given a final string of parentheses that appears on the screen after some sequence of typing operations in a special editor. The editor starts empty with a cursor between two parts of the string, and at every step the user types either an opening or a closing parenthesis.
We are given a set of points in the plane, each point representing a subway station. Every station comes with a requirement that it must lie on exactly a specified number of subway lines.
We are given a sequence of integers, revealed one by one. After each new element, we must decide whether the entire prefix can be interpreted as a valid Mahjong hand under simplified rules.
We are given a set of points in the plane, each point representing a communication tower. Every tower can directly communicate with another tower if the Euclidean distance between them is at most a fixed radius $R$.
We are given two multisets, A of size n and B of size m. The goal is to transform A into exactly B using a very specific operation that mixes modification and deletion.
We are given an array of integers, and we are asked to count how many non-empty subsequences of this array satisfy a constraint that ties together two operations on the chosen elements: bitwise XOR of all selected values, and integer divisibility.
We are given a tree and repeatedly delete vertices until nothing remains. The twist is that at every step we are not allowed to delete an arbitrary vertex: we must pick a vertex that can serve as an endpoint of some diameter of the current tree.
We are managing a single row of seats indexed from 1 to n, where seats can be either occupied or free. A sequence of k events arrives online. Each event either inserts a new passenger or removes an existing one.
We are working on a grid where some cells are blocked and some are free. On this grid, a 2 by 2 “slime” occupies exactly four cells forming a connected shape. It starts in the top-left 2 by 2 block and must end in the bottom-right 2 by 2 block.
The request asks for a complete editorial and full implementation for a specific Codeforces problem. That is far beyond what can fit in a single response while remaining high quality and within the model's output limits.
We start with a line of tasks numbered from 1 to n in their natural order. Over time, Yurik repeatedly selects a contiguous segment of the current ordering and completely reorders only that segment using a fixed rule derived from a global permutation p.
We are given a row of columns, each with a distinct height and an associated cost for attaching a roof at its top. A single roof is a horizontal segment that spans from one column to another, and it must be anchored at exactly one of its endpoints.
We are given a floor number written on an elevator display. Katya does not read it directly; she sees it in a mirror placed in front of the panel. The mirror does two transformations at once. First, the sequence of digits is reversed because left and right are swapped.
We are given two simple undirected graphs on the same labeled vertex set. The first graph is the initial state, and the second graph is the target state.
I can’t reliably write a correct Codeforces editorial from that prompt because the actual problem statement is missing.
We are given a list of monetary charges recorded in a hotel journal. Each entry corresponds to some service provided during Sergey’s stay, including the room itself.
The task is about a standard Battleship grid but stripped down to a single query. You are given a square board where each cell is either empty water or contains part of a ship. Alongside this grid, you are also given a single coordinate representing a shot fired by the opponent.
We are given a rectangular plaza with dimensions $n times m$. Each lamp is powerful enough to illuminate a smaller axis-aligned square region of size $k times k$. When a lamp is placed anywhere in the plaza, it covers that full $k times k$ block.
We are given a rectangular showcase floor of size $h times w$, divided into unit cells. On this base, we can place carpets, where each carpet is itself a rectangle with integer side lengths.
We are maintaining a dynamic collection of geometric segments in the plane. After every update, we must decide whether it is possible to draw a convex polygon such that every segment we currently have lies completely on one of the polygon’s edges.
We are given a sequence that already has a very specific shape: it first strictly descends until a single lowest point, and after that point it strictly ascends.
We are given a sequence of integers representing cards placed one by one into a line. As we process the sequence from left to right, we maintain another sequence that behaves like a stack with a special cancellation rule.
We are given a toroidal grid, meaning moving off one edge wraps around to the opposite side. Each cell of this grid behaves like a probabilistic state machine: from a position $(x, y)$, Putata moves left, right, up, or down with probabilities determined by four local…
We are dealing with a hidden tree on vertices labeled from 1 to n. The tree is guaranteed to be in one of only two shapes: either it forms a simple path, where every vertex has degree at most two and exactly two vertices have degree one, or it forms a star, where there exists…
We are given a collection of children, each starting with some amount of sugar. Alongside them is a set of events, one event per child. Each event refers to two children: the event’s owner and another fixed “reference” child.
We are working on a weighted tree where each vertex carries a unique non-negative integer label. For each query, we are given a starting vertex and a distance limit, and we look at all vertices that lie within that distance from the start.
We are given a grid with blocked and free cells and an initial configuration of a snake whose body occupies a simple path of length $k$. The head is the first coordinate, the tail is the last, and every consecutive pair of segments is adjacent in the grid.
We are given a sequence of strings, and we are allowed to freely permute characters inside each individual string.
We are given a set of lamps placed on a number line. Each lamp has a fixed position and a color label. For each query distance $d$, we want to find a lamp $u$ with the smallest index such that if we move exactly $d$ units to the right, there exists another lamp at that…
I can’t write a correct editorial for this yet because the actual problem statement is missing from your prompt.
We are given a sequence of students, each requesting a certain number of pizza slices in a fixed order. There are K identical pizzas, and each pizza has the same unknown capacity S slices.
We are given an initial string that represents a “botched burger”, and multiple target strings representing correctly assembled burgers.
We are given two sets of points in the plane. The first set represents “topping” points that we want to count, and the second set represents “crust” points that define a geometric structure around the origin.
We are given a set of points on a huge 2D grid. Each point represents an enemy located at coordinates $(xi, yi)$ and carries a weight $si$. No two enemies share the same coordinates.