brain

tamnd's digital brain — notes, problems, research

41787 notes

Kvant Math Problem 1065

We are asked to study vectors $(x;y)$ with non-negative integer coordinates and to decide when they can be written as sums of _generating vectors_, i.

kvantmathematicsolympiad
Kvant Math Problem 1064

Let the closed broken line have vertices $V_1,\dots,V_n$ and segments $e_i=V_iV_{i+1}$, where indices are taken modulo $n$.

kvantmathematicsolympiad
Kvant Math Problem 1063

Let the digits of the $n$-digit number $a$ be

kvantmathematicsolympiad
Kvant Math Problem 1062

The first part of the problem deals with a triangle $ABC$ with points $D$ on $AC$ and $E$ on $AB$, forming the intersecting lines $BD$ and $CE$ at $M$.

kvantmathematicsolympiad
Kvant Math Problem 1061

Interpret the cities and roads as a graph.

kvantmathematicsolympiad
Kvant Math Problem 1060

Consider two closed polygonal chains in the plane, each with an odd number of sides.

kvantmathematicsolympiad
Kvant Math Problem 1059

Let

kvantmathematicsolympiad
Kvant Math Problem 1058

Consider a finite subset of $\mathbb{Z}^2$ as a candidate for the marked points and examine what happens when we translate each by all vectors from the given finite set.

kvantmathematicsolympiad
Kvant Math Problem 1057

A move consists of writing a number that is not a divisor of any previously written number.

kvantmathematicsolympiad
Kvant Math Problem 1056

Consider small cases first.

kvantmathematicsolympiad
Kvant Math Problem 1055

Consider a circle with a small number of points to understand the behavior of arcs subtending at most $120^\circ$.

kvantmathematicsolympiad
CF 222E - Decoding Genome

We have an alphabet of size m, consisting of the first m symbols from the sequence a..zA..Z. Some ordered pairs of symbols are forbidden. If pair (x, y) is forbidden, then symbol y cannot appear immediately after symbol x in the DNA string.

codeforcescompetitive-programmingdpmatrices
CF 222D - Olympiad

We are given two multisets of scores. Array a contains the scores obtained in the first tour, and array b contains the scores obtained in the second tour.

codeforcescompetitive-programmingbinary-searchgreedysortingstwo-pointers
CF 222C - Reducing Fractions

The fraction is not given as a single numerator and denominator. Instead, we receive two arrays. The product of all numbers in the first array is the numerator, and the product of all numbers in the second array is the denominator.

codeforcescompetitive-programmingimplementationmathnumber-theorysortings
Kvant Math Problem 1054

Consider four spheres in three-dimensional space.

kvantmathematicsolympiad
CF 220B - Little Elephant and Array

We are given an array of positive integers and many range queries. For each query [l, r], we look only at the subarray between those positions and count how many values x satisfy a very specific condition: Inside that subarray, the value x appears exactly x times.

codeforcescompetitive-programmingconstructive-algorithmsdata-structures
CF 220A - Little Elephant and Problem

We are given an array that was originally sorted in non-decreasing order. At some point, either nothing happened or exactly one pair of elements may have been swapped.

codeforcescompetitive-programmingimplementationsortings
CF 220E - Little Elephant and Inversions

We are given an array of positive integers a of length n. We need to count the number of pairs (l, r) with 1 ≤ l < r ≤ n such that if we take the element at position l and move it just before position r (shifting the elements in between right by one), the resulting array has…

codeforcescompetitive-programmingdata-structurestwo-pointers
CF 220D - Little Elephant and Triangle

We have all lattice points inside the rectangle $$0 le x le w,qquad 0 le y le h.$$ A valid answer is an ordered triple of points that forms a nondegenerate triangle whose area is a positive integer. The order matters, so every geometric triangle contributes up to $3!

codeforcescompetitive-programminggeometrymath
CF 220C - Little Elephant and Shifts

We are given two permutations a and b of length n. Each permutation contains all integers from 1 to n exactly once. We are asked to compute, for every cyclic shift of b, a quantity called the distance.

codeforcescompetitive-programmingdata-structures
CF 219C - Color Stripe

We are given a stripe represented as a row of n cells, where each cell is painted one of k colors labeled with letters A through the k-th letter. The goal is to repaint as few cells as possible so that no two adjacent cells share the same color.

codeforcescompetitive-programmingbrute-forcedpgreedy
CF 219D - Choosing Capital for Treeland

We are asked to choose a capital city in a tree-shaped country with one-way roads. Each city is a node, and each road is a directed edge. The goal is to orient all roads so that from the chosen capital, we can reach every other city by following the roads in their direction.

codeforcescompetitive-programmingdfs-and-similardpgraphstrees
CF 219E - Parking Lot

We have a linear parking lot with n spaces numbered from 1 to n. Cars arrive and depart over time. When a car arrives, we must assign it a spot that maximizes the distance to the nearest occupied space.

codeforcescompetitive-programmingdata-structures
CF 217E - Alien DNA

We start with a DNA string. Each mutation chooses a contiguous segment, keeps that segment in place, and inserts a transformed copy immediately after it.

codeforcescompetitive-programmingdata-structuresdsutrees
Kvant Math Problem 1053

The first few Fibonacci numbers with at least four digits are

kvantmathematicsolympiad
Kvant Math Problem 1052

Consider a convex $n$-gon with vertices labeled cyclically as $A_1, A_2, \dots, A_n$.

kvantmathematicsolympiad
Kvant Math Problem 1051

Consider a $3\times3$ cluster of pieces on an $8\times8$ chessboard.

kvantmathematicsolympiad
Kvant Math Problem 1050

Let the chosen points be

kvantmathematicsolympiad
Kvant Math Problem 1049

Consider a cylinder $\text{Ц}_1$ with radius $R_1$ and height $H_1$, and define its diameter-to-height ratio $k = \frac{2R_1}{H_1}$.

kvantmathematicsolympiad
Kvant Math Problem 1048

Consider the simplest nontrivial cases of the knight’s tour game.

kvantmathematicsolympiad
Kvant Math Problem 1047

Consider a small round-robin tournament with $n$ players.

kvantmathematicsolympiad
Kvant Math Problem 1046

Consider an acute-angled triangle $ABC$ with $\angle A = 60^\circ$.

kvantmathematicsolympiad
Kvant Math Problem 1045

Consider the geometry of the kingdom, which is a square of side $2$ km.

kvantmathematicsolympiad
Kvant Math Problem 1044

Let

kvantmathematicsolympiad
Kvant Math Problem 1042

Let the class contain $n$ students.

kvantmathematicsolympiad
Kvant Math Problem 1041

A regular pentagon is determined up to congruence by any three consecutive vertices.

kvantmathematicsolympiad
Kvant Math Problem 1040

For $n=1$ the three groups are ${1},{2},{3}$, and $3=1+2$.

kvantmathematicsolympiad
Kvant Math Problem 1039

Label the tetrahedron vertices as $A$, $B$, $C$, $D$.

kvantmathematicsolympiad
Kvant Math Problem 1038

The rectangle contains $mn$ cells.

kvantmathematicsolympiad
Kvant Math Problem 1037

Consider the equation $x^y - y^x = x + y$ with $x, y \in \mathbb{N}$.

kvantmathematicsolympiad
Kvant Math Problem 1036

Consider a pentagon and imagine cutting it into two smaller pentagons of equal area and shape.

kvantmathematicsolympiad
Kvant Math Problem 1035

Consider marking points on $[0,1]$ sequentially.

kvantmathematicsolympiad
Kvant Math Problem 1034

Consider small chocolate bars first.

kvantmathematicsolympiad
Kvant Math Problem 1033

Let the square have vertices $A,B,C,D$ in cyclic order.

kvantmathematicsolympiad
Kvant Math Problem 1032

Begin with small values of $n$ to detect a pattern.

kvantmathematicsolympiad
Kvant Math Problem 1031

Reflecting on the problem, the point $M$ is chosen on the line $\ell$ to minimize the sum $MA + MB$.

kvantmathematicsolympiad
Kvant Math Problem 1030

Consider simple convex polyhedra such as nested cubes, tetrahedra, or pyramids.

kvantmathematicsolympiad
Kvant Math Problem 1028

Begin by considering the configuration of two intersecting lines and points $D$ and $E$ on them.

kvantmathematicsolympiad
Kvant Math Problem 1027

The number $1987$ is prime, since it is not divisible by any prime not exceeding $\sqrt{1987}<45$.

kvantmathematicsolympiad
Kvant Math Problem 1026

Let the common measure of each arc be $x$.

kvantmathematicsolympiad
Kvant Math Problem 1025

Consider a convex quadrilateral $ABCD$ with extensions of opposite sides $AB$ and $CD$, and $AD$ and $BC$, intersecting at points $P$ and $Q$ respectively.

kvantmathematicsolympiad
Kvant Math Problem 1024

Consider two triangles with angles $\alpha, \beta, \gamma$ and $\alpha_1, \beta_1, \gamma_1$.

kvantmathematicsolympiad
Kvant Math Problem 1023

For small numbers of triangles the statement is false.

kvantmathematicsolympiad
Kvant Math Problem 1022

For numbers $1,2,\dots,2n$, suppose they are arranged in two rows and $n$ columns.

kvantmathematicsolympiad
Kvant Math Problem 1021

Consider how the mountaineer’s progress depends on the day’s starting point.

kvantmathematicsolympiad
Kvant Math Problem 1020

Consider a sphere of radius $1$ with a curve drawn on it, either open of length less than $\pi$ or closed of length less than $2\pi$.

kvantmathematicsolympiad
Kvant Math Problem 1019

Consider first a small example on a $3 \times 3$ portion of the grid.

kvantmathematicsolympiad
Kvant Math Problem 1018

Consider a regular $n$-gon $A_1 A_2 \dots A_n$ with center $O$.

kvantmathematicsolympiad
Kvant Math Problem 1017

Consider assigning integers to the vertices of a regular pentagon and performing the prescribed operation whenever a vertex carries a negative number.

kvantmathematicsolympiad
Kvant Math Problem 1016

For a polygon circumscribed about a circle of radius $r$, let the sides be $s_1,\dots,s_n$, with corresponding side lengths $\ell_1,\dots,\ell_n$.

kvantmathematicsolympiad
Kvant Math Problem 1015

The polynomial is

kvantmathematicsolympiad
Kvant Math Problem 1014

Consider small examples of pairwise coprime numbers, such as $a_1=2$, $a_2=3$, $a_3=5$.

kvantmathematicsolympiad
Kvant Math Problem 1013

Consider triangle $ABC$ with points $M$ on $AB$ and $N$ on $BC$.

kvantmathematicsolympiad
Kvant Math Problem 1012

Consider arrangements of circles in the plane where each circle touches several others.

kvantmathematicsolympiad
Kvant Math Problem 1011

For the first inequality,

kvantmathematicsolympiad
Kvant Math Problem 1010

Consider the sequence defined by $r_1=2$ and $r_{n+1}=r_1 r_2 \cdots r_n + 1$.

kvantmathematicsolympiad
Kvant Math Problem 1009

Let the parallelogram be represented by vectors.

kvantmathematicsolympiad
Kvant Math Problem 1008

Number the steps from $1$ at the bottom to $2n+1$ at the top.

kvantmathematicsolympiad
CF 208B - Solitaire

We are given a shuffled deck of up to 52 cards arranged in a line, each represented by a value and a suit. Initially, every card forms its own pile.

codeforcescompetitive-programmingdfs-and-similardp
CF 208C - Police Station

We are given an undirected, connected graph representing cities and roads, where every road has the same travel time. Among all cities, city 1 and city n are special: we care about travel between these two endpoints.

codeforcescompetitive-programmingdpgraphsshortest-paths
Kvant Math Problem 1007

The equality

kvantmathematicsolympiad
CF 208E - Blood Cousins

We are given a rooted forest where each person has at most one parent. If we follow parent pointers upward, we eventually reach a root or fall off the structure. This defines a collection of trees. A “k-th ancestor” means applying the parent relation k times.

codeforcescompetitive-programmingbinary-searchdata-structuresdfs-and-similartrees
CF 208D - Prizes, Prizes, more Prizes

We have a sequence of chocolate bar purchases, each yielding a certain number of points. Vasya starts with zero points and after each bar may go to the prize center. The prizes have fixed point costs: a mug, a towel, a bag, a bicycle, and a car, in strictly increasing order.

codeforcescompetitive-programmingimplementation
Kvant Math Problem 1006

Let the triangle be $ABC$.

kvantmathematicsolympiad
CF 208A - Dubstep

The input is a single string that has been formed by taking a sequence of original words and then inserting the marker string "WUB" around and between them in a very specific way.

codeforcescompetitive-programmingstrings
Kvant Math Problem 1005

Consider a $3 \times 3$ table first.

kvantmathematicsolympiad
CF 207D1 - The Beaver's Problem - 3

In this problem, we are given a document whose subject is one of three categories, numbered 1, 2, or 3. Each document contains a unique identifier, a title, and a body of text.

codeforcescompetitive-programming
Kvant Math Problem 1004

Let a line through $A$ be fixed.

kvantmathematicsolympiad
Kvant Math Problem 1003

The quantities involve segments cut off by the feet of the altitudes.

kvantmathematicsolympiad
Kvant Math Problem 1002

The door opens as soon as some block of three consecutive pressed digits coincides with the code.

kvantmathematicsolympiad
CF 207D4 - The Beaver's Problem - 3

We are given a single document consisting of an identifier, a title line, and then a body of text. Every document belongs to exactly one of three possible topics, labeled 1, 2, or 3, but the correct label is not provided in the input.

codeforcescompetitive-programming
Kvant Math Problem 1001

Let $S(n)$ denote the total sum of all recorded products when a pile of $n$ stones is repeatedly split until all piles contain one stone.

kvantmathematicsolympiad
Kvant Math Problem 1000

Let $O$ be the center of the circle containing the arc $AB$, and let $\angle AOB=2\alpha$.

kvantmathematicsolympiad
CF 207D9 - The Beaver's Problem - 3

We are given a single document consisting of three parts: an identifier number that is irrelevant for classification, a title line, and then the full text content of the document. Every document belongs to exactly one of three fixed topics labeled 1, 2, and 3.

codeforcescompetitive-programming
Kvant Math Problem 999

Let

kvantmathematicsolympiad
CF 207D8 - The Beaver's Problem - 3

Error in message stream

codeforcescompetitive-programming
CF 207D7 - The Beaver's Problem - 3

We are asked to classify a text document into one of three subjects, numbered 1, 2, or 3, given a training set of labeled documents. Each document in the input consists of an identifier, a title, and a body of text.

codeforcescompetitive-programming
CF 207D6 - The Beaver's Problem - 3

We are given a single document consisting of three parts: a numeric identifier, a short title line, and then the full text content. The identifier is irrelevant for classification.

codeforcescompetitive-programming
CF 207D5 - The Beaver's Problem - 3

Each document is a short piece of text that belongs to exactly one of three possible topics. The input gives us a single document consisting of an identifier, a title line, and a body of text. The identifier is irrelevant for classification, it only exists for bookkeeping.

codeforcescompetitive-programming
Kvant Math Problem 998

Consider a tetrahedron $AXBY$ circumscribed about a sphere with fixed points $A$ and $B$.

kvantmathematicsolympiad
CF 207D3 - The Beaver's Problem - 3

The problem asks us to classify documents into one of three subjects, labeled 1, 2, or 3. Each document has a unique identifier, a title, and a body of text.

codeforcescompetitive-programming
Kvant Math Problem 997

Let

kvantmathematicsolympiad
CF 207D2 - The Beaver's Problem - 3

The problem requires building a classifier that predicts the subject of a document based on its contents. Each document belongs to exactly one of three subjects, labeled 1, 2, or 3.

codeforcescompetitive-programming
CF 207D10 - The Beaver's Problem - 3

We are given a stream of documents, where each document is a short text consisting of a name and a body. Each document belongs to exactly one of three hidden classes.

codeforcescompetitive-programming
CF 207C3 - Game with Two Trees

We are maintaining two rooted trees that grow over time. Each operation attaches a new node to one of the trees by adding a single directed edge from an existing node to a fresh node, and that edge is labeled with a lowercase letter.

codeforcescompetitive-programmingdata-structures
CF 207C2 - Game with Two Trees

We are given two dynamically growing rooted trees. Each operation adds a child to a specified vertex, labeling the connecting edge with a lowercase letter.

codeforcescompetitive-programming
CF 207C1 - Game with Two Trees

We are asked to maintain two dynamically growing rooted trees with labeled edges, and after each operation, compute the number of "good combinations.

codeforcescompetitive-programming
CF 207B3 - Military Trainings

We are given a column of n tanks numbered 1 to n. Each tank i has a message receiving radius a[i]. During the exercise, exactly n messages must be sent from the front of the column to the back. After each message, the last tank in the message path moves to the front.

codeforcescompetitive-programming
Kvant Math Problem 996

The octagon is the intersection of two congruent squares.

kvantmathematicsolympiad
Kvant Math Problem 995

Let

kvantmathematicsolympiad