brain

tamnd's digital brain — notes, problems, research

41641 notes

CF 105981I - The Dream-Quest

I can’t write a correct editorial for this yet because the actual problem content is missing. Right now, the statement only shows the title “The Dream-Quest” with no description of what the input represents, what needs to be computed, or any constraints.

codeforcescompetitive-programming
CF 105981H - Simai

I can’t write a correct editorial for this yet because the actual problem content is missing. Right now I only see the label “H” with empty input/output sections, so there’s no way to reconstruct what Simai is asking, what the operations are, or what needs to be computed.

codeforcescompetitive-programming
CF 105981G - Portal 2

I can’t reliably write a correct Codeforces-style editorial from this because the actual problem statement for 105981G - Portal 2 isn’t included (it only shows “G”).

codeforcescompetitive-programming
CF 105981E - Neuro's New Game

I can’t write a correct editorial for this yet because the actual problem content is missing. Right now the statement only shows the title (“Neuro’s New Game”) but no description of the rules, input format, or what needs to be computed.

codeforcescompetitive-programming
CF 105981F - Portal

I can’t write a correct editorial for this problem yet because the actual statement content is missing. Right now, all that is provided is the label “F” and the title “Portal”, but no description of the input format, output format, constraints, or rules of the system.

codeforcescompetitive-programming
CF 105981A - A Slide B Slide

I can’t reliably reconstruct Codeforces Gym 105981A from the available statement text, because the problem statement is truncated and OCR-garbled in multiple critical parts (especially the definition of the operations/constraints involving the sequences and what exactly is…

codeforcescompetitive-programming
CF 105981D - Keine's Prefix Sum

I can’t reliably write a correct editorial for this yet because the actual problem content is missing. Right now the prompt only shows the title “Keine’s Prefix Sum” but no statement, constraints, or input-output behavior.

codeforcescompetitive-programming
CF 105981B - Bricked Blast Furnaces

I can’t write a correct editorial for this problem yet because the actual problem statement content is missing (it only shows “B” with empty input/output).

codeforcescompetitive-programming
CF 105977M - 致谢

The problem gives a fixed historical table describing 11 editions of a programming contest series in Fujian. Each edition has an organizing university, and each university is associated with a short English abbreviation.

codeforcescompetitive-programming
CF 105977I - 割点

We are asked to construct an undirected simple connected graph on vertices labeled from 1 to n, with very specific structural constraints tied to articulation points and vertex degrees. For every vertex except 1 and n, we are given a binary indicator.

codeforcescompetitive-programming
CF 105977J - 构造大师周三金

We start with a positive integer and are allowed to repeatedly modify it. One move consists of choosing a number that divides the current value, adding it to the current value, and never using the same chosen addend twice across the whole process.

codeforcescompetitive-programming
CF 105977L - 众数

We are given a sequence of integers, and we process it incrementally by prefixes. For each prefix, we conceptually look at every non-empty subset of its indices.

codeforcescompetitive-programming
CF 105977E - 卡牌游戏

We are given a sequence of $2n$ card values arranged in a fixed top-to-bottom order. After this, the cards are dealt strictly by position: cards in odd positions go to one player and cards in even positions go to the other player.

codeforcescompetitive-programming
CF 105977H - 难以控制的滑板火箭

We are given a grid of size $n times m$ where each cell is either free or blocked. The start is always the top-left cell $(1,1)$ and the goal is the bottom-right cell $(n,m)$. Movement is not the standard four-direction grid walk.

codeforcescompetitive-programming
CF 105977G - 炒股高手

The problem gives a sequence of stock prices over $n$ days, but the prices are encoded in logarithmic form. On day $i$, the actual price is $e^{ai}$, where $ai$ is a positive integer.

codeforcescompetitive-programming
CF 105977B - XCPC

We start with a pile of identical base tokens, each initially considered as a “bronze level” unit worth 1 point. There are four possible grades of items: iron, copper, silver, and gold, with values 1, 2, 3, and 4 respectively.

codeforcescompetitive-programming
CF 105977D - 二叉树

We are given an undirected tree. This tree is not arbitrary in origin: it is formed by taking two perfect binary trees and connecting them with exactly one extra edge. After this connection, the structure is still a tree, but it is no longer a perfect binary tree.

codeforcescompetitive-programming
CF 105977A - We are watching you!

We are given several independent test cases. In each test case, there is a string S consisting of lowercase letters, and a second sequence of integers c[i] that describe values assigned to states of a deterministic automaton built from suffixes of S.

codeforcescompetitive-programming
CF 105973K - Math Madness

We are given several test cases. In each test case, we receive an array of integers, and we must count how many index pairs $(i, j)$ with $1 le i le j le n$ satisfy a certain arithmetic condition involving greatest common divisor and least common multiple of the two chosen…

codeforcescompetitive-programming
CF 105973J - Sublime Replacement

We are given an array where some positions are already fixed and some positions are marked as unknown with value −1. We are allowed to replace each unknown position with any positive integer up to $10^9$.

codeforcescompetitive-programming
CF 105973I - Statue on a Permutation

We are given a permutation that we are allowed to construct, and a starting position for a token placed on that permutation. From that starting point, two players alternately move the token.

codeforcescompetitive-programming
CF 105973G - MEX-imum Beauty

We are given an array, and we look at every contiguous subarray. For each subarray, we do a two-stage transformation. First, we replace it by its sequence of prefix maximums.

codeforcescompetitive-programming
CF 105973E - The Perfect Spider Web

We are given a convex polygon in the plane, described by its vertices in counter-clockwise order. Each edge of the polygon connects consecutive vertices, and the last vertex connects back to the first. We must choose a point strictly inside this polygon.

codeforcescompetitive-programming
CF 105973F - Divisible Perfection

We are given a string of digits, and we treat every contiguous substring as a number in base 10. The requirement is extremely strong: for every possible substring, the integer value formed by that substring must be divisible by the length of that substring.

codeforcescompetitive-programming
CF 105973B - Red Dead Redemption 2

We are given several test cases. In each test case, there is a list of items, each item has an integer value. The task is to split the items into two non-empty groups such that within each group, every pair of items is “compatible”, meaning their values share no common…

codeforcescompetitive-programming
CF 105973D - Symmetric Swap

We are given two arrays, and we are allowed to transform each array using two kinds of operations: cyclic shifts and a special swap operation that exchanges a prefix with a suffix of equal length.

codeforcescompetitive-programming
CF 105973A - Edgy Graph

We are given an undirected graph where each edge carries a positive integer weight. The task is to assign a value to every vertex so that for every edge, the larger of the two endpoint values is exactly equal to the edge’s weight.

codeforcescompetitive-programming
CF 105968L - Legendary Duty Scheduler

We are simulating a rotating duty assignment over a sequence of days. There is a fixed group of students, initially all present in an active pool. Over time, some students may be added to the pool and others may be removed, with these changes scheduled to happen on specific days.

codeforcescompetitive-programming
CF 105968J - Johannes Loves Games

We are working with a dynamic array of integers where two kinds of operations are supported. One operation changes the value at a single position, and the other asks for information about a contiguous segment of the array.

codeforcescompetitive-programming
CF 105968I - IME1000 project

The problem models a graph where traveling between cities is not only expensive in terms of edge weights, but also changes a secondary state called reputation. Each state of the system is described by a pair consisting of a node and a reputation value.

codeforcescompetitive-programming
CF 105968H - Heaviside Step Function

The task presents a single number written in text form rather than as a native integer type. The number may be extremely large, beyond what standard integer types in most programming languages can store, so it must be processed as a raw string.

codeforcescompetitive-programming
CF 105968G - Gruesome Polynomials

The task is about locating all real roots of a real-valued polynomial within a fixed interval, specifically from −30 to 30, with high precision.

codeforcescompetitive-programming
CF 105968E - Escaping Cokeman

We are working on a grid-based shortest path problem where movement happens through a rectangular map. Each cell is either free or blocked by walls, and there are special cells: a starting point, a destination exit, and a badge location.

codeforcescompetitive-programming
CF 105968D - Do The g, Man

We are working with an undirected graph. The task is to determine whether a very specific structure exists: a cycle of length four, and in addition to that cycle, a short “branch” of length two that starts from one vertex of the cycle but does not reuse the other vertices of…

codeforcescompetitive-programming
CF 105968A - Adding IQs

We are given a collection of integer values representing IQs of individuals. The task is to count or characterize subsets of these values based on their total sum, where the direct interpretation is that every subset contributes a combined IQ equal to the sum of its elements.

codeforcescompetitive-programming
CF 105968B - Braga's Problem

We are working with multiple queries over a range of integers, and for each query we need to compute the sum of all prime numbers that lie inside a given interval.

codeforcescompetitive-programming
CF 105962K - Rofofo's Test

We are given a machine model where memory is arranged as several cachelines, and each cacheline contains many 8-bit variables. Every variable holds a value from 0 to 255, and all arithmetic is performed modulo 256, so values wrap around after 255. Two operations are available.

codeforcescompetitive-programming
CF 105962J - Tigrinho

We are given a 3 by 3 board. Each cell is either a digit from 1 to 9 or a wildcard symbol. The board participates in a scoring system based on five special lines: the three rows and the two diagonals.

codeforcescompetitive-programming
CF 105962I - Aura Farming

We are given a set of problems, each described by two numbers. The first number is a threshold requirement: Beraldo can only solve that problem if his current aura is at least that value. The second number is a reward: if he solves the problem, his aura increases by that amount.

codeforcescompetitive-programming
CF 105962H - La Vaca Saturno Saturnino

We are given a sequence of snapshots of a queue. Each snapshot is a full ordered list of all students currently in the queue at some moment in time, and these snapshots are shown in chronological order.

codeforcescompetitive-programming
CF 105962G - GPT in Fury

The task is about detecting which words in a long transcript have been corrupted by a transformation process. You are given a single line containing thousands of space-separated words.

codeforcescompetitive-programming
CF 105962E - Esteche vs Yvens

We are given a single pile of stones and two players who alternate turns, starting with Yvens. On each turn, the current player must remove either one stone or two stones from the pile.

codeforcescompetitive-programming
CF 105962B - We're Competing

We are given a long string S with no spaces, which is a noisy transcription of some original text. The transcription process may have corrupted up to K individual characters, meaning at most K positions in the original text were replaced by different characters.

codeforcescompetitive-programming
CF 105962C - Hacking the Matrix

We are given an $N times N$ binary matrix. We are allowed to freely reorder rows and columns any number of times, independently. After these permutations, we want to find the largest possible “C-shaped” pattern consisting only of ones.

codeforcescompetitive-programming
CF 105962D - MA141

We are given four points in the plane in a fixed order, A, B, C, D. The task is to determine whether connecting them in that order, including the edge from D back to A, forms a geometric square. This is not a “set of four points” problem where we can reorder arbitrarily.

codeforcescompetitive-programming
CF 105950G - Godfather

We are given a rooted structure that evolves over a sequence of operations driven by a binary string. Initially, there are two “states” of the story, each represented by a numeric value: one main value and one auxiliary value.

codeforcescompetitive-programming
CF 105949L - abc

We are given a string composed only of the characters a, b, and c. The task is to look at every contiguous substring and assign it a score based on how uneven the character distribution is inside that substring.

codeforcescompetitive-programming
CF 105949J - Sichuan Provincial Contest

We are given a tree, and every node carries a single uppercase letter. A query asks us to count how many simple paths in this tree contain exactly five nodes, and if we read the letters along the path in order, they must form the fixed pattern “S C C P C”.

codeforcescompetitive-programming
CF 105949K - Point Divide and Conquer

We are given a tree with labeled nodes and a fixed permutation that determines an order of processing. The construction builds a rooted tree by repeatedly selecting, from the currently remaining nodes, the one that appears earliest in the permutation among those still present.

codeforcescompetitive-programming
CF 105949I - Essentially Different Suffixes

We are given several strings, and we conceptually take every suffix from every string. A suffix is any substring that starts at some position and continues to the end. For example, in a string like “abc”, its suffixes are “abc”, “bc”, and “c”.

codeforcescompetitive-programming
CF 105949E - Competition Graph

We are given a complete directed graph on $n$ labeled vertices where every pair of vertices has exactly one directed edge between them, forming a tournament. Among all such tournaments, we need to count how many contain at least one directed simple cycle of length exactly $k$.

codeforcescompetitive-programming
CF 105949G - Diophantine Equation

We are given a sequence of numbers that we can think of as defining a polynomial-like transformation over a modular field.

codeforcescompetitive-programming
CF 105949F - Inversion Pairs

We are given a binary sequence where every position is supposed to end up as either 0 or 1, but some positions are currently unknown. The unknown positions can be filled freely with 0 or 1.

codeforcescompetitive-programming
CF 105949A - Minimum Product

We are given a directed graph where every edge carries two small positive weights. A path from node 1 to node N accumulates these weights separately: one sum is formed by adding all first components along the path, and another sum is formed by adding all second components.

codeforcescompetitive-programming
CF 105949D - Tripartite Graph

We are given a permutation $q$ of length $n$. We need to count how many permutations $p$ of the same length satisfy two conditions. First, $p$ must be lexicographically larger than $q$.

codeforcescompetitive-programming
CF 105949B - Ternary

We are given a hidden “encryption system” that works digit by digit on base-3 numbers of length $n$. At each position $i$, there is a fixed permutation $fi$ of the digits ${0,1,2}$.

codeforcescompetitive-programming
CF 105948J - Ever Forever (II)

We are given a mutable string over lowercase letters. The core quantity we track is defined over a fixed ordered pair of characters, specifically pairs where the first character is 'e' and the second is 'f'.

codeforcescompetitive-programming
CF 105948I - 简单的数字运算 (II)

We are given a function defined on positive integers through their prime factorization. For a number $x$, we decompose it into prime powers $x = prod pi^{alphai}$.

codeforcescompetitive-programming
CF 105948H - 子序列、达标率与期望

We are given an array of positive integers of length up to 50. For every subset size $k$ from 2 up to $n$, we look at all subsequences of that size, chosen uniformly at random.

codeforcescompetitive-programming
CF 105948G - 迷宫 (II)

We are given a square grid whose side length is $2n$. Inside this grid, there is a fixed procedure described in a previous part of the problem (迷宫 I) that allows us to add edges between cells according to certain local rules.

codeforcescompetitive-programming
CF 105948E - Colonization Assessment for Terraforming

We are given a graph where each vertex represents a planet and each vertex has a numeric value called its habitability. The graph is undirected, and edges represent bidirectional travel routes between planets.

codeforcescompetitive-programming
CF 105948D - 简单树上问题

We are given a rooted tree with root fixed at node 1. Each node carries a non-negative integer value. The only operation allowed is to choose a node u and an integer x ≥ 0, then XOR every node in u’s subtree with a value equal to a fixed bit pattern depending on x…

codeforcescompetitive-programming
CF 105948C - 马拉车

We are given two collections: horses with stamina values and carts with weights. Each horse must be assigned exactly one cart, and each cart can be used at most once. If a horse with stamina $Ei$ pulls a cart with weight $Wj$, its movement contribution is $max(Ei - Wj, 0)$.

codeforcescompetitive-programming
CF 105948A - Executable Log

We are given a list of files, where each file has a name and a permission string. The permission string encodes whether the file can be read, written, or executed using the familiar three-character format.

codeforcescompetitive-programming
CF 105946M - Trapped

We are simulating a constrained survival process where time and oxygen are the same currency in different forms. Each second spent anywhere, digging or operating machinery, reduces the oxygen tank by one.

codeforcescompetitive-programming
CF 105946L - Summoner's Rift

We are given a square arena with side length $r$, and a set of $n$ points representing heroes placed inside it. A random infinite line is generated in two stages: first a random point inside the square is chosen, then a random direction is chosen uniformly over all angles in…

codeforcescompetitive-programming
CF 105946K - Polynomial Construction

We are asked to construct several different integer polynomials. Each polynomial must satisfy three structural constraints at the same time. First, it must be monic, so its highest-degree coefficient is exactly 1.

codeforcescompetitive-programming
CF 105946H - Illusion of Progress

We are given a connected, simple undirected graph with $n$ districts and $m$ existing roads. District 1 is the starting point for every citizen.

codeforcescompetitive-programming
CF 105946J - Knights and Knaves

We are given multiple independent scenarios involving three fixed participants: Alice, Bob, and Cindy. Each person is either a truth-teller or a liar.

codeforcescompetitive-programming
CF 105946G - Heavy Metal Pipe Jumpscare

We are given the first $N = 2 cdot 10^5$ terms of a sequence that is mostly generated by a fixed linear recurrence of order $k le 69$, but with occasional corruption. For the first $k$ positions, the values are arbitrary.

codeforcescompetitive-programming
CF 105946F - The Grand Heist

We are given a single block of gold with total mass $G$, and a group of $n$ people who contributed different amounts of effort.

codeforcescompetitive-programming
CF 105946E - Fanceptionception

Each cell of an n by n grid contains a fan that may or may not be active, and every active fan pushes wind only downward. A fan at position (i, j) with strength f influences a triangular region starting from itself and expanding as we go to lower rows.

codeforcescompetitive-programming
CF 105946C - Butler's Tea

Each test case describes a household where a group of servants must complete a set of chores. Every chore has a required amount of work, and every hour each servant contributes work depending on how they are assigned.

codeforcescompetitive-programming
CF 105946B - Absorption Game

We are given an array and many operations on subarrays. Each query asks for a value derived from a randomized “absorption” process, and updates replace a whole segment with a fixed pattern.

codeforcescompetitive-programming
CF 105946D - Daily Life of Data Visualization Engineers

The program described here takes an integer array and performs a simple filtering step before turning it into a vertical bar chart. All non-positive values are discarded, and the remaining values keep their original order.

codeforcescompetitive-programming
CF 105945I - Team Naming

We are given $n$ people, and each person has a “name” made of three integers, which we can think of as a length-3 vector. We want to choose three distinct people $i, j, k$.

codeforcescompetitive-programming
CF 105945J - Puzzle Competition

We are given a directed graph where each node represents a puzzle. Every node starts with zero “energy”, and each node has a threshold value. A node becomes unlocked as soon as the total energy it has accumulated reaches or exceeds its threshold.

codeforcescompetitive-programming
CF 105945K - Typewriter

We are given a string that we want to reproduce using a peculiar typewriter mechanism. Instead of directly writing characters into the output, the machine reads from a template tape and copies into an output tape.

codeforcescompetitive-programming
CF 105945H - Loose Subsequences

We are given a string and asked to count how many different non-empty subsequences we can form under a spacing restriction on positions.

codeforcescompetitive-programming
CF 105945F - Ranking Prediction

A contest has already ended, and the scoreboard is frozen. You know your own team’s final result completely: how many problems you solved and your total penalty time.

codeforcescompetitive-programming
CF 105945E - Grid Coloring

We are given a grid with exactly two rows and $n$ columns. Some cells already contain a color label, while the rest are empty. We must assign colors to the empty cells so that every cell is colored, and the precolored cells remain unchanged.

codeforcescompetitive-programming
CF 105945B - Integer Generator

We are given a multiset of integers, but duplicates do not exist initially. Each number is a 30-bit mask. We are allowed to repeatedly pick any two currently available numbers and apply exactly one of three bitwise operations between them, XOR, AND, or OR, and then insert the…

codeforcescompetitive-programming
CF 105945A - Matrix Game

We are given a binary matrix with up to a million rows but only up to ten columns. Each cell initially contains either zero or one. We are allowed to repeatedly flip entire rows or entire columns, where flipping means toggling every bit in that row or column.

codeforcescompetitive-programming
CF 105945D - Spell Generation

We are given a very simple device that can generate a string of a required length, but it has two ways of operating, each consuming time. The first operation is a single tap. Each tap takes one second and produces exactly one unit of output length.

codeforcescompetitive-programming
CF 105941L - Astral Decay

We are given a set of points on a 2D plane. We must pick three points, allowing reuse of the same point, and designate them as A, B, and C. From A, we form two vectors pointing to B and to C, and we want to minimize the dot product of those two vectors.

codeforcescompetitive-programming
CF 105941K - Ring Trick II

We are given a sequence of length $n$, where each element is an integer in the range $[0, m-1]$. The key operation allowed is a global cyclic shift: we choose a single integer $k$, and every element $ai$ is replaced by $(ai + k) bmod m$.

codeforcescompetitive-programming
CF 105941J - Ring Trick

We are given a string consisting only of uppercase English letters. We are allowed to apply a single global Caesar shift: pick an integer shift $k$, then every character is rotated forward by $k$ positions in the alphabet modulo 26.

codeforcescompetitive-programming
CF 105941I - 有的兄弟,有的

We are given a system of players, each initially belonging to some faction. During the hidden part of the process, players repeatedly fight.

codeforcescompetitive-programming
CF 105941H - 树论函数

We are given a rule that builds an infinite undirected graph over positive integers. Each integer is a node. For a node $n$, we define a value $f(n) = n(n+1)$.

codeforcescompetitive-programming
CF 105941G - 直径与最大独立集

We are asked to construct a tree on $n$ vertices so that two quantities become equal: the size of a maximum independent set and the diameter length of the tree. A maximum independent set is a largest possible set of vertices where no two chosen vertices share an edge.

codeforcescompetitive-programming
CF 105941E - 双生魔咒

We are given 2n strings made of lowercase letters. We must split them into two groups of equal size, think of one group as “prefix side” strings and the other as “suffix side” strings. After that, we pair the two groups arbitrarily in a one-to-one matching.

codeforcescompetitive-programming
CF 105941A - Toxel 与独一无二的序列

We are given several test cases. Each test case provides an array of length $n$, where every element is an integer between $1$ and $n$.

codeforcescompetitive-programming
CF 105941B - 随机栈 II

We are given a sequence of operations on a multiset that starts empty. Each operation is either inserting a value or removing one element chosen uniformly at random from the current multiset.

codeforcescompetitive-programming
CF 105941D - 2025

We are given a single integer representing a year, and we need to decide whether it satisfies a very specific numeric property. The year is valid if two conditions hold simultaneously.

codeforcescompetitive-programming
CF 105937N - Kessoku Band

We are given a permutation of numbers from 1 to n, meaning every integer in this range appears exactly once and is arranged in some order along a line. Each operation gives us a segment [l, r] of this line.

codeforcescompetitive-programming
CF 105937L - Gros-Phi

Each game describes a set of timed targets on a line. Every target is a pair consisting of a time moment and a position on the line. Starting at time zero, Awa can choose any initial position and then move along the line with a fixed maximum speed.

codeforcescompetitive-programming
CF 105937O - Discrete Logarithm

We are given three integers $a$, $c$, and a prime modulus $p$. The task is to construct a large integer $b$ such that a specific congruence holds between two expressions built from these values.

codeforcescompetitive-programming
CF 105937K - Seele Vollerei

We are working with a rooted tree whose structure is fixed, but whose root can change over time. Each node stores a weight, initially zero. On top of this tree, we are given a sequence of pre-defined path updates.

codeforcescompetitive-programming
CF 105937J - Bastion

We are given a simple polygon described by its vertices in counterclockwise order. The polygon is non-degenerate, so edges only meet at endpoints, no three consecutive vertices are collinear, and it forms a proper closed shape.

codeforcescompetitive-programming
CF 105937I - Ori

We are given a tree, meaning a connected acyclic graph. Each vertex represents a “core”, and edges represent allowed moves between cores. We are allowed to construct a walk on this tree, where revisiting vertices is permitted.

codeforcescompetitive-programming