brain

tamnd's digital brain — notes, problems, research

41794 notes

Kvant Math Problem 861

Consider small values of $n$ to understand the behavior of the sums modulo $1$.

kvantmathematicsolympiad
Kvant Math Problem 860

Consider the triangle $ABC$ with circumcircle $(O)$ and incircle $(Z)$.

kvantmathematicsolympiad
Kvant Math Problem 859

Let

kvantmathematicsolympiad
Kvant Math Problem 858

Let

kvantmathematicsolympiad
Kvant Math Problem 856

```

kvantmathematicsolympiad
Kvant Math Problem 855

```

kvantmathematicsolympiad
Kvant Math Problem 854

Before I begin, could you provide the full text of Kvant problem M854? I need the problem statement in order to construct the rigorous solution according to your specifications.

kvantmathematicsolympiad
Kvant Math Problem 852

```

kvantmathematicsolympiad
Kvant Math Problem 849

```

kvantmathematicsolympiad
Kvant Math Problem 848

The function $f_0(x) = ||x-1|-2||x|-3||$ involves nested absolute values.

kvantmathematicsolympiad
Kvant Math Problem 846

Let the regular polygon have $n$ sides and circumradius $R$.

kvantmathematicsolympiad
Kvant Math Problem 845

We consider the problem of forming a centrally symmetric polygon using two types of tiles: a “corner” formed by four $1\times1$ squares arranged in an L-shape, and $4\times1$ rectangles.

kvantmathematicsolympiad
Kvant Math Problem 844

For the first representation, the coefficients are constrained by $0\le a_k\le k$.

kvantmathematicsolympiad
Kvant Math Problem 842

Consider the first identity $\sin\alpha + \sin\beta + \sin\gamma$ under the constraint $\alpha + \beta + \gamma = 0$.

kvantmathematicsolympiad
Kvant Math Problem 841

Consider a right triangle $ABC$ with right angle at $C$.

kvantmathematicsolympiad
Kvant Math Problem 839

For a set of integers with no three-term arithmetic progression, the classical example is obtained by writing numbers in base $3$ and allowing only digits $0$ and $1$.

kvantmathematicsolympiad
Kvant Math Problem 837

Consider the simpler case where two of the numbers are coprime.

kvantmathematicsolympiad
Kvant Math Problem 835

Represent the previous encounters by a bipartite graph.

kvantmathematicsolympiad
Kvant Math Problem 833

Compute the first few terms to detect patterns.

kvantmathematicsolympiad
Kvant Math Problem 832

Consider first the case of dividing a square into smaller squares.

kvantmathematicsolympiad
Kvant Math Problem 829

Consider small values of $m$ to detect a pattern.

kvantmathematicsolympiad
Kvant Math Problem 827

The figure consists of a triangle subdivided into smaller regions, four of which are blue triangles of equal area.

kvantmathematicsolympiad
Kvant Math Problem 826

The operation described on the board replaces one number with the sum of the other two numbers minus one.

kvantmathematicsolympiad
Kvant Math Problem 824

I need the diagram from Figure 3 to solve the problem rigorously.

kvantmathematicsolympiad
Kvant Math Problem 823

Before I begin the full solution, I need clarification: does the photograph provide any perspective cues such as vanishing points, the relative positions of the corners, or angles of the visible wall?

kvantmathematicsolympiad
Kvant Math Problem 820

A parallelogram has two pairs of parallel sides.

kvantmathematicsolympiad
Kvant Math Problem 818

Consider small $n$-gons to understand what a uniform set of blue vertices looks like.

kvantmathematicsolympiad
Kvant Math Problem 816

Let $s(n)$ denote the sum of the decimal digits of $n$.

kvantmathematicsolympiad
Kvant Math Problem 814

A natural number is representable as a sum of two squares if and only if every prime congruent to $3 \pmod 4$ appears with even exponent in its prime factorization.

kvantmathematicsolympiad
Kvant Math Problem 813

Consider three segments $OA$, $OB$, and $OC$ of equal length $R$, with $B$ inside the angle $AOC$.

kvantmathematicsolympiad
Kvant Math Problem 811

The quantities involving medians and altitudes suggest rewriting everything in terms of the sides.

kvantmathematicsolympiad
Kvant Math Problem 809

Compute the first few terms of the series to detect a pattern.

kvantmathematicsolympiad
Kvant Math Problem 808

Begin by examining small values of $k$.

kvantmathematicsolympiad
Kvant Math Problem 805

Consider the planar case first.

kvantmathematicsolympiad
CF 193B - Xor

We are given a small system of length-n arrays that evolves through a fixed number of global transformations. We start with an array a, and we repeatedly apply exactly u operations.

codeforcescompetitive-programmingbrute-force
CF 193C - Hamming Distance

We are asked to reconstruct four binary strings consisting only of letters a and b, given the Hamming distances between every pair of strings. The Hamming distance between two strings counts the positions where the strings differ.

codeforcescompetitive-programmingconstructive-algorithmsgreedymathmatrices
CF 193E - Fibonacci Number

We are given a single number $f$, and we consider the infinite sequence generated by Fibonacci rules, but taken modulo 1013. The sequence starts with 0 and 1, and every next value is the sum of the previous two, reduced modulo 1013.

codeforcescompetitive-programmingbrute-forcemathmatrices
Kvant Math Problem 804

Place a right circular cylinder vertically with axis along the $z$-axis and center at the origin, so that $O=(0,0,0)$ is the midpoint of the axis.

kvantmathematicsolympiad
CF 193D - Two Segments

We are given a permutation of integers from 1 to n. A permutation means each integer appears exactly once. The task is to count pairs of contiguous subarrays (segments) such that when we combine the two segments, the union of their elements forms a consecutive sequence of…

codeforcescompetitive-programmingdata-structures
CF 193A - Cutting Figure

We are given a rectangular grid of size n × m representing a sheet of squared paper. Some squares are painted, forming a set A.

codeforcescompetitive-programmingconstructive-algorithmsgraphstrees
CF 190A - Vasya and the Bus

We are asked to compute the minimum and maximum bus fare collected given a number of grown-ups n and children m on a bus. Each grown-up pays one ruble for themselves, and each grown-up can take at most one child for free. Any additional children cost one ruble each.

codeforcescompetitive-programminggreedymath
CF 190B - Surrounded

We are given two circular “threat zones” on a plane. Each one is defined by a center point and a radius. The center is a city, and the radius describes how far the enemy ring extends from that city. We are allowed to place a single radar anywhere in the plane.

codeforcescompetitive-programminggeometry
Kvant Math Problem 802

The data involve two right triangles erected externally on sides $AB$ and $BC$.

kvantmathematicsolympiad
CF 190E - Counter Attack

We are given a set of cities, but the twist is that the input does not describe the real road system directly. Instead, it describes the complement of it.

codeforcescompetitive-programmingdata-structuresdsugraphshashingsortings
CF 190D - Non-Secret Cypher

We are given a sequence of integers and a threshold value $k$. The task is to count how many contiguous subarrays contain some value that appears at least $k$ times inside that subarray.

codeforcescompetitive-programmingtwo-pointers
Kvant Math Problem 801

Compute several small cases to see the pattern.

kvantmathematicsolympiad
CF 190C - STL

We are given a sequence of tokens that were spoken in order, each token being either int or pair. These tokens are supposed to form a valid nested type expression of a very specific grammar.

codeforcescompetitive-programmingdfs-and-similar
Kvant Math Problem 798

Consider first small values of $k$.

kvantmathematicsolympiad
CF 188F - Binary Notation

The task is to take a single positive integer and express it in base 2, meaning we rewrite it using only powers of two with coefficients 0 or 1. Instead of the usual decimal representation, we want the binary string that tells us which powers of two sum up to the number.

codeforcescompetitive-programming*specialimplementation
Kvant Math Problem 796

Consider a square $ABCD$ with a point $P$ inside it.

kvantmathematicsolympiad
CF 188E - HQ9+

We are asked to analyze a string representing a program written in HQ9+, a toy language with four instructions: H, Q, 9, and +. Only the first three produce output when executed: H prints "Hello, World!

codeforcescompetitive-programming*specialimplementation
CF 188D - Asterisks

The problem asks us to generate a simple text pattern. We are given a single integer n, which represents the number of lines we need to print. The first line should contain a single asterisk, the second line two asterisks, and so on, until the n-th line contains n asterisks.

codeforcescompetitive-programming*specialimplementation
CF 188B - A + Reverse B

The task is to compute the sum of a number a and the reversed digits of another number b. Reversing a number means writing its digits in opposite order while ignoring any leading zeros that appear after reversal. For example, reversing 230 produces 32, and reversing 0 remains 0.

codeforcescompetitive-programming*specialimplementation
CF 185C - Clever Fat Rat

We are given a triangular structure of “weighing plates” arranged in rows. The top row has $n$ plates, the next has $n-1$, and so on until the last row which has a single plate. Each plate has a threshold weight.

codeforcescompetitive-programmingdp
CF 185A - Plant

We are asked to model the growth of a triangular plant over a number of years. Each plant triangle has an orientation: "upwards" or "downwards". The growth rules are deterministic: every year, each triangle produces four new triangles.

codeforcescompetitive-programmingmath
CF 185E - Soap Time! - 2

We are given a set of dwarves located at integer coordinates on a Cartesian plane, and optionally a set of subway stations also at integer coordinates.

codeforcescompetitive-programmingbinary-searchdata-structures
CF 185D - Visit of the Great

We are asked to calculate the number of dwarves who can see the Great Mushroom King for multiple visits. Each visit is specified by three integers $k$, $l$, and $r$, which define a sequence of numbers $k cdot 2^l + 1, k cdot 2^l + 2, dots, k cdot 2^r + 1$.

codeforcescompetitive-programmingmathnumber-theory
Kvant Math Problem 795

Consider small values of $n$ and their divisor sums $\sigma(n)$.

kvantmathematicsolympiad
CF 185B - Mushroom Scientists

We are asked to maximize a function defined on three non-negative real variables x, y, and z subject to a sum constraint. The function has the form f(x, y, z) = x^a · y^b · z^c, where a, b, c are non-negative integers.

codeforcescompetitive-programmingmathternary-search
CF 180B - Divisibility Rules

We are asked to determine the type of divisibility rule that applies to a given number d in a given base b. The types are categorized as 2-type, 3-type, 11-type, 6-type, or 7-type depending on whether the divisibility can be checked using only the last few digits (2-type), the…

codeforcescompetitive-programmingmathnumber-theory
Kvant Math Problem 793

Let

kvantmathematicsolympiad
CF 180A - Defragmentation

The disk is a linear array of fixed-size cells, and each cell either stores a fragment of some file or is empty. Every file is already present on the disk, but its fragments may be scattered across arbitrary positions, while still appearing in the correct internal order for…

codeforcescompetitive-programmingimplementation
CF 180F - Mathematical Analysis Rocks!

Each student initially owns a single notebook. There is a fixed hidden permutation p over students, meaning every student has exactly one “best friend” and every student is the best friend of exactly one other student.

codeforcescompetitive-programmingconstructive-algorithmsimplementationmath
CF 180E - Cubes

We have a row of cubes, each painted in one of m colors, and we are allowed to remove up to k cubes to maximize the length of a consecutive segment of cubes all having the same color.

codeforcescompetitive-programmingbinary-searchdptwo-pointers
CF 180D - Name

We are given two strings, s and t. The string s represents a set of letters we are allowed to rearrange freely, and the string t represents a benchmark name.

codeforcescompetitive-programminggreedystrings
CF 180C - Letter

We are given a string consisting of uppercase and lowercase letters. Patrick wants to transform it into a "fancy" string, defined as having all uppercase letters on the left and all lowercase letters on the right. We can change the case of any letter at the cost of one action.

codeforcescompetitive-programmingdp
Kvant Math Problem 791

Petya's calculator allows addition, subtraction, increment by one, and reciprocal operations.

kvantmathematicsolympiad
CF 178F3 - Representative Sampling

We are given a multiset of strings, each string representing a protein. From this collection, we must choose exactly $k$ strings and assign a score to the chosen subset. The score is defined over all unordered pairs of chosen strings.

codeforcescompetitive-programming
CF 178F2 - Representative Sampling

We are given a collection of n protein strings, and we are asked to select exactly k of them such that the sum of the longest common prefixes (LCPs) between every pair in the selected subset is maximized. Each protein is a non-empty string of lowercase letters.

codeforcescompetitive-programmingdpsortingsstrings
CF 178F1 - Representative Sampling

We are given a multiset of strings, each string representing a protein sequence. From these strings, we must choose exactly k of them.

codeforcescompetitive-programming
CF 178E3 - The Beaver's Problem - 2

We are given a square, monochrome image represented as an $n times n$ matrix, where each element is either 0 (white background) or 1 (black foreground). Within this image are several distinct geometric shapes, each either a square or a circle.

codeforcescompetitive-programming
Kvant Math Problem 789

Consider first a small number of points on a circle, for example, four points dividing the circle into four equal arcs.

kvantmathematicsolympiad
CF 178E2 - The Beaver's Problem - 2

We are given a large binary grid representing a noisy black-and-white image. The white background contains several black connected regions, and each such region is guaranteed to be either a square or a circle, possibly rotated in any orientation.

codeforcescompetitive-programming
CF 178E1 - The Beaver's Problem - 2

We are given a large binary image represented as an $n times n$ grid, where each cell is either white or black. The black cells form several disconnected shapes, and each shape is guaranteed to be either a circle or a square, possibly rotated arbitrarily.

codeforcescompetitive-programming
CF 178D3 - Magic Squares

The task is to take a set of $n^2$ integers and arrange them into an $n times n$ matrix such that the sum of every row, every column, and both diagonals is equal. This sum is called the magic constant $s$.

codeforcescompetitive-programming
CF 178D2 - Magic Squares

We are asked to construct an $n times n$ magic square using a given multiset of $n^2$ integers. A magic square has the property that the sums of all rows, all columns, and both diagonals are equal.

codeforcescompetitive-programming
Kvant Math Problem 786

Consider small values of $n$ and $k$ to identify a pattern.

kvantmathematicsolympiad
CF 178D1 - Magic Squares

We are asked to arrange a given set of $n^2$ integers into an $n times n$ matrix so that it forms a magic square. A magic square is defined as a matrix where the sum of every row, every column, and the two main diagonals is the same value $s$.

codeforcescompetitive-programming
CF 178C3 - Smart Beaver and Resolving Collisions

We are maintaining a hash table with a fixed number of slots, where each slot can hold at most one object. Each object has a unique identifier and a preferred starting position given by its hash value. When inserting an object, we first try its hash position.

codeforcescompetitive-programming
CF 178C2 - Smart Beaver and Resolving Collisions

We are simulating a hash table that supports inserting and deleting items, but insertion is not direct. Each item has a preferred starting position given by its hash value, and if that slot is occupied, the table probes forward in fixed jumps of size m modulo h until it finds…

codeforcescompetitive-programming
CF 178C1 - Smart Beaver and Resolving Collisions

We are simulating a hash table where each object is assigned a preferred position given by its hash value, but collisions are resolved using a fixed step size. When an object is inserted, we first try its hash position.

codeforcescompetitive-programming
CF 178B3 - Greedy Merchants

We are given an undirected connected graph where cities are nodes and roads are edges. For each merchant, we are also given a pair of cities: a warehouse city and a shop city. The merchant needs to ship goods from the warehouse to the shop using any path in the graph.

codeforcescompetitive-programming
Kvant Math Problem 784

The length of daylight at latitude $\varphi$ depends on the declination $\delta$ of the star.

kvantmathematicsolympiad
CF 178B2 - Greedy Merchants

We are given a connected undirected graph of cities linked by roads. Each merchant chooses two cities, one as a source (warehouse) and one as a destination (shop).

codeforcescompetitive-programming
CF 178B1 - Greedy Merchants

We are given an undirected connected graph representing cities and roads. Each road can be removed, and this may or may not break connectivity between two specific cities. Alongside the graph, we are given multiple merchants.

codeforcescompetitive-programming
CF 178A2 - Educational Game

We are given a sequence of non-negative integers representing some kind of “counters” along a line, indexed from 1 to n. The task is to reduce the first k elements of the sequence to zero, for every possible prefix length k (from 1 to n-1).

codeforcescompetitive-programminggreedy
Kvant Math Problem 783

Consider the first system of inequalities: $1 < x < 2$, $2 < x^2 < 3$, $3 < x^3 < 4$, and so on up to $n < x^n < n+1$.

kvantmathematicsolympiad
Kvant Math Problem 781

Consider triangle $ABC$ and a line parallel to $AC$ intersecting $AB$ at $D$ and $BC$ at $E$ such that $|AD| = |BE|$.

kvantmathematicsolympiad
Kvant Math Problem 779

We are asked to study sequences of positive numbers $x_0, x_1, x_2, \dots$ with $x_0 = 1$ and $x_0 \ge x_1 \ge x_2 \ge \dots$.

kvantmathematicsolympiad
Kvant Math Problem 778

Let the triangle be isosceles with $A_2A_3=a_1$ as the base and $A_1A_2=A_1A_3$.

kvantmathematicsolympiad
Kvant Math Problem 777

The given equation is cubic in two variables, $x$ and $y$:

kvantmathematicsolympiad
Kvant Math Problem 776

Consider a regular hexagon $ABCDEF$ with vertices labeled consecutively.

kvantmathematicsolympiad
Kvant Math Problem 775

Consider small values of $n$ to detect patterns.

kvantmathematicsolympiad
Kvant Math Problem 774

Condition (2) resembles a midpoint convexity-type inequality, but in the reversed direction: usually convexity gives $f\left(\frac{x+y}{2}\right)\le \frac{f(x)+f(y)}{2}$, whereas here we have $f\left(…

kvantmathematicsolympiad
Kvant Math Problem 773

Let the side lengths be

kvantmathematicsolympiad
Kvant Math Problem 772

We are asked to train 8 workers on 5 machines so that any 3 absences still allow operation of all machines.

kvantmathematicsolympiad
Kvant Math Problem 771

Let $O$ be the common point which is simultaneously the circumcenter of $\triangle ABC$ and the incenter of $\triangle ABK$.

kvantmathematicsolympiad
Kvant Math Problem 769

Let $I=L$ be the incenter.

kvantmathematicsolympiad
Kvant Math Problem 768

Consider small values of $n$ first.

kvantmathematicsolympiad
Kvant Math Problem 767

For the first statement, choose coordinates so that the bisecting line $l$ is the vertical line $x=0$.

kvantmathematicsolympiad