brain
tamnd's digital brain — notes, problems, research
41641 notes
We maintain a growing database of clients and answer queries about suppliers. Each supplier is fixed and described by a start day $Si$ and a cost per day $Pi$. A client arrives over time and is described by an end day $Ej$ and a revenue per day $Rj$.
We are given a single integer $N$ in decimal, and we treat it as a value that can be represented in different bases. For every base $b$ in the range $[2, N]$, we write $N$ in base $b$ and check whether that representation is a palindrome when read as a digit sequence.
We are given a connected network of cities forming a tree. Each city has a fixed integer label which represents its popularity value.
We are given a line of candies, each labeled with a brand id. We may choose a single contiguous segment of this line and buy every candy in that segment. There are exactly K family members, and each member must receive candies from exactly one brand.
We are given a multiset of $3N$ integers. Two players interact with these numbers in a structured selection process that gradually assigns each number to one of three roles: red, blue, or discarded.
We are working with an $n times m$ grid, and each cell can be assigned a value from $1$ to $k$. After a full assignment, we look at each cell and decide whether it is “locally maximal” in a very specific sense: a cell is considered special if its value is strictly greater…
Each test gives a target value and a list of weighted positions indexed from 0 to m. At position i, we have a coefficient ci, and a fixed weight determined by powers of two parameters a and b. We are allowed to pick a subset of indices s0 < s1 < ...
We are given a rooted tree of size $N$, rooted at node 1. Each node represents a platform, and each platform initially contains exactly one glass ball.
We are working with a repeating weekly calendar where each day is identified by a week index and a weekday index from 1 to 7. Time moves forward one day at a time, and after day 7 of a week, the next week begins.
We are simulating a deterministic Pokémon-style duel between two single Pokémon, except that the outcome of each attack depends on probabilistic damage ranges and type interactions. Each Pokémon has six base stats and up to two elemental types.
We are given several independent evaluation machines. Each machine has a limited number of threads, and using more threads changes the runtime behavior in a non-trivial way. For the i-th machine, there are $ki$ available threads.
Each evaluation server can process submissions in parallel using multiple threads, but the efficiency of each thread depends on how many threads are active on that server.
We are given a set of N distinct points in the plane, each representing a village. We want to choose a straight line that passes through exactly two of these villages. This line is used as a border between two regions.
We are given multiple independent queries. Each query contains three numbers written in the same unknown positional numeral system with base $X$, where $X$ is some integer between 2 and 16 inclusive.
We are given two arrays, both of length n. We are allowed to permute the indices of one of them, say b, and then pair elements position by position with a. For a chosen permutation p, we form n values of the form ai + bp[i], and we take the bitwise AND over all of them.
We are given a rooted tree with nodes numbered from 1 to n, rooted at node 1. Each node carries a distinct weight, and these weights form a permutation of the integers from 1 to n. For every query, we focus on a specific node u and an interval of integers from a to b.
We are given several defensive towers, each tower having a structural durability and a combat effectiveness. We also have a limited pool of soldiers that can be distributed across these towers before the attack begins.
We are given a fixed collection of intervals on the integer segment from 1 to m. These intervals come from the first run of a random generator and are already fully known.
Each test case gives a set of playable characters and a set of monsters. A character is defined by two strengths: attack and defense. A monster is also defined by two thresholds, attack and defense, and a reward value in coins. You are allowed to pick exactly one character.
We are given several independent scenarios. In each scenario, there is a target value $x$ representing a deficit that must be reduced to exactly zero. We also have $n$ students, each starting with an initial power $ai$. Time evolves in discrete days.
We are working on a grid where a robber tries to travel from the top-left cell to the bottom-right cell. The grid is static in size but dynamically dangerous because of cameras placed on some cells.
We are given several independent scenarios. In each scenario, there are multiple types of ants, where type $i$ has $ai$ ants available. The goal is to throw at least $p$ ants in total using a sequence of moves. Each move has two independent constraints.
We are asked to construct an array of non-negative integers. Instead of being given the array directly, we are given three types of constraints that must simultaneously be satisfied. First, there is a global sum constraint.
We process a stream of events about submissions, where each submission is just a set of subtasks that were solved correctly in that attempt. Subtasks are identified by integers, and a single submission may cover multiple subtasks.
We are working with digit strings of a fixed length, where each character is from 0 to 9. A normal palindrome reads the same forwards and backwards.
We are given a sequence of bank checks, each with a fixed monetary value. From this sequence, we are allowed to pick at most k checks in a single day, and our goal is to maximize the total value of the selected checks.
We are given two positive integers, and we are allowed to apply one of the four basic arithmetic operations between them: addition, subtraction, multiplication, or division. Each operation produces a value, and we must determine which operation yields the largest result.
The task is to build a tiny classifier that reads a single name and returns a fixed sentence depending on which fictional universe that name belongs to. The input is always exactly one of three possible character names.
We are given a single positive integer $X$, and we are asked to construct a number that satisfies two conditions at the same time. First, it must be divisible by $X$. Second, it must be a perfect square, meaning its prime factorization has all exponents even.
We are given a small group of people, each carrying a backpack with a fixed weight limit, and a collection of provisions, each with its own weight.
We are given a graph-like layout where movement is allowed along connections between positions, but some positions are marked as blocked. A move through a normal position is always allowed, while stepping onto a blocked position consumes one unit of a limited budget $K$.
We are given a turn-based game played over several independent scenarios. Each scenario consists of a collection of balloon bundles, where each bundle contains some number of balloons.
We are working with an extremely large conceptual array indexed from 1 to 10^9, initially filled with zeros. Instead of ever materializing this array, we receive a sequence of operations, each operation increasing every position in a closed interval by a fixed value.
The shop has a single fixed bill denomination, and every item has a price in dollars. A tourist wants to pay for an item, but Juan can only use bills of that one denomination.
We are given an $N times N$ grid where each cell contains either a large positive value or $-1$, which marks a blocked or unusable cell. The task is to select a downward-pointing triangular region inside this grid.
We are trying to build a binary string, but we do not get to freely choose its structure without limits. We are given a supply of zeros and ones, and we are also told that runs of identical characters are capped in length.
We are working on an infinite hexagonal grid where each cell has six neighbors and distance is measured as the minimum number of edge-to-edge moves between hexagons. The grasshopper starts at the origin and performs an infinite sequence of jumps.
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 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.