brain

tamnd's digital brain — notes, problems, research

41777 notes

Kvant Math Problem 736

The statement involves a median and an angle bisector meeting at a point.

kvantmathematicsolympiad
Kvant Math Problem 697

Let the square have side length $1$.

kvantmathematicsolympiad
Kvant Math Problem 596

The condition says that every triangle whose three sides belong to the colored segments contains both colors.

kvantmathematicsolympiad
Kvant Math Problem 567

Take a small example, say $p=2$, $q=3$.

kvantmathematicsolympiad
Kvant Math Problem 490

Let the given integers be $a_1,\dots,a_{p-1}$, none divisible by $p$.

kvantmathematicsolympiad
Kvant Math Problem 437

Let the odd number be

kvantmathematicsolympiad
Kvant Math Problem 194

Take a small example, say $a=3$, $b=7$.

kvantmathematicsolympiad
Kvant Math Problem 1566

Each committee has $80$ members, and there are $16000$ committees.

kvantmathematicsolympiad
Kvant Math Problem 1529

The equalities

kvantmathematicsolympiad
Kvant Math Problem 1515

Let

kvantmathematicsolympiad
Kvant Math Problem 1470

We need a set $A$ of positive integers such that every infinite set $S$ of primes contains, among the squarefree numbers formed from distinct primes of $S$, two numbers with the same number $k\ge2$ of…

kvantmathematicsolympiad
Kvant Math Problem 916

Let the acute triangle be $ABC$.

kvantmathematicsolympiad
Kvant Math Problem 817

Let

kvantmathematicsolympiad
Kvant Math Problem 790

The hypothesis is that a map $F:\mathbb{R}^2\to\mathbb{R}^2$ preserves unit distance, meaning every pair of points at distance $1$ is mapped to a pair of points at distance $1$.

kvantmathematicsolympiad
Kvant Math Problem 754

The expression

kvantmathematicsolympiad
Kvant Math Problem 723

We seek an infinite set $S \subset \mathbb{N}$ such that no element of $S$ and no finite sum of distinct elements of $S$ is a perfect power $a^k$ with $k \ge 2$.

kvantmathematicsolympiad
Kvant Math Problem 684

Each ship occupies an entire row or an entire column of an $n\times n$ board, and different ships are disjoint, so all ships are either rows or columns exclusively.

kvantmathematicsolympiad
Kvant Math Problem 651

Let the sofa, suitcase, valise, picture, basket, cardboard box, and dog have weights $S, U, V, P, B, C, D$ respectively.

kvantmathematicsolympiad
Kvant Math Problem 581

The first question asks for a three-digit integer $x$ such that $x^3$ ends in $777$, equivalently

kvantmathematicsolympiad
Kvant Math Problem 566

Let the fixed isosceles right triangle be placed as a unit right isosceles triangle with vertices $A(0,0)$, $B(1,0)$, $C(0,1)$.

kvantmathematicsolympiad
Kvant Math Problem 508

The three semicircles with diameters $AB$, $BC$, $AC$ lie on the same line $AB$, with centers at the midpoints of $AB$, $BC$, and $AC$.

kvantmathematicsolympiad
Kvant Math Problem 489

The transformation replaces each term by the average of the other two.

kvantmathematicsolympiad
Kvant Math Problem 462

Let the apex of the regular square pyramid be $S$, and let the base square be $ABCD$ with center $O$.

kvantmathematicsolympiad
Kvant Math Problem 435

Let $A=(a_{ij})$ be an $m\times n$ matrix.

kvantmathematicsolympiad
Kvant Math Problem 395

Label the vertices of a regular $n$-gon by $0,1,\dots,n-1$ in cyclic order.

kvantmathematicsolympiad
Kvant Math Problem 364

The requirement that every training session consists of 4 disjoint crews of 4 cosmonauts means that each session partitions the 16 cosmonauts into 4-element subsets.

kvantmathematicsolympiad
Kvant Math Problem 162

Let $A={a_1<a_2<a_3<\cdots}$.

kvantmathematicsolympiad
Kvant Math Problem 452

Let $ABC$ be the triangle $T_1$ inscribed in a circle with center $O$.

kvantmathematicsolympiad
Kvant Math Problem 415

The problem asks for the maximum number of mutually non-attacking kings on an $n\times n$ toroidal board.

kvantmathematicsolympiad
Kvant Math Problem 399

For a set of points on a segment, the condition “there exist two points at distance $m$” is equivalent to requiring that the difference set of all chosen coordinates contains every integer $1,2,\dots,…

kvantmathematicsolympiad
Kvant Math Problem 333

Let the flies be at positions $P(t),Q(t),R(t)$ on the sides of triangle $ABC$.

kvantmathematicsolympiad
Kvant Math Problem 12

A straight line intersects a convex quadrilateral in two points.

kvantmathematicsolympiad
Kvant Math Problem 951

Let the hexagon be $ABCDEF$ in convex order with $AB=BC=CD=DE=EF=FA=1$.

kvantmathematicsolympiad
Kvant Math Problem 930

We are asked to prove that in any partition of the integers from $1$ to $1985$ into six classes, one class must contain either a triple $a,b,c$ with $a+b=c$ or a pair $a,2a$.

kvantmathematicsolympiad
Kvant Math Problem 895

Place the cube of side $2$ in coordinates with center at the origin, so its vertices are $(\pm1,\pm1,\pm1)$ and its inscribed sphere is $x^2+y^2+z^2=1$.

kvantmathematicsolympiad
Kvant Math Problem 871

We encode each entry $x_{i,j}\in{\pm1}$ by $a_{i,j}\in\mathbb{F}_2$ via $x_{i,j}=(-1)^{a_{i,j}}$.

kvantmathematicsolympiad
Kvant Math Problem 847

The game is played on the edge set of the $n\times n$ square grid graph.

kvantmathematicsolympiad
Kvant Math Problem 828

Consider a function $a_{i,j}$ on the integer lattice.

kvantmathematicsolympiad
Kvant Math Problem 797

We interpret the problem as asking whether, for every fixed block of $n$ decimal digits $A=a_1a_2\ldots a_n$, there exists an integer $x$ such that the last $n+1$ digits of $x^2$ have the form $A b$,…

kvantmathematicsolympiad
Kvant Math Problem 782

Let $a+b=30030$ with $a,b\in \mathbb{N}$.

kvantmathematicsolympiad
Kvant Math Problem 744

The configuration consists of two similar triangles $ABC$ and $A_1B_1C_1$, with $A_1 \in BC$, $B_1 \in CA$, $C_1 \in AB$.

kvantmathematicsolympiad
Kvant Math Problem 712

We seek to represent an arbitrary positive real number as a sum of nine numbers whose decimal expansions use only digits $0$ and $7$.

kvantmathematicsolympiad
Kvant Math Problem 691

Let $P(n,k)=n(n+1)\cdots(n+k-1)$ for $n\ge 2$.

kvantmathematicsolympiad
Kvant Math Problem 662

The statement concerns a piggy bank containing coins whose total value is $4$ rubles.

kvantmathematicsolympiad
Kvant Math Problem 586

Let $B=60^\circ$ and let $O$ be the incenter of triangle $ABC$.

kvantmathematicsolympiad
Kvant Math Problem 572

The kangaroo moves in the integer lattice of the first quadrant with vectors $v_1=(1,-1)$ and $v_2=(-5,7)$, always staying in $x\ge 0$, $y\ge 0$.

kvantmathematicsolympiad
Kvant Math Problem 565

For each $k$, the quantity $b_k$ is the average of all products of $k$ distinct elements from $a_1,\ldots,a_n$.

kvantmathematicsolympiad
Kvant Math Problem 511

ABMD is a parallelogram, so the vertices satisfy the affine relation $a+m=b+d$, hence $m=a+d-b$.

kvantmathematicsolympiad
Kvant Math Problem 487

Let $O_1$ and $O_2$ be the centers of circles $\gamma_1$ and $\gamma_2$, with radii $R_1$ and $R_2$.

kvantmathematicsolympiad
Kvant Math Problem 469

Let $P(x)=x^4+ax^3+bx+c$ have four distinct real roots $r_1<r_2<r_3<r_4$.

kvantmathematicsolympiad
Kvant Math Problem 438

The configuration is a fixed circular segment determined by a chord $AB$ of a circle with center $O$.

kvantmathematicsolympiad
Kvant Math Problem 428

The problem is naturally translated into graph theory.

kvantmathematicsolympiad
Kvant Math Problem 404

Start with small $n$.

kvantmathematicsolympiad
Kvant Math Problem 390

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

kvantmathematicsolympiad
Kvant Math Problem 305

The concurrency of $AA'$, $BB'$, $CC'$ at $P$ together with products $|AP|\cdot|A'P|=t$ suggests a fixed-power relation, which is characteristic of inversion centered at $P$.

kvantmathematicsolympiad
Kvant Math Problem 201

Let triangle $ABC$ have sides $a=BC$, $b=CA$, $c=AB$.

kvantmathematicsolympiad
CF 442A - Borya and Hanabi

We have a collection of cards, each defined by a color and a number between 1 and 5. Borya holds n cards, and while he knows which cards he has, he cannot distinguish between identical cards in terms of position.

codeforcescompetitive-programmingbitmasksbrute-forceimplementation
CF 441B - Valera and Fruits

Valera has a garden with a number of fruit trees, each producing a specific number of fruits on a particular day. Each fruit becomes collectible on its ripening day and remains fresh only for the next day.

codeforcescompetitive-programminggreedyimplementation
CF 441E - Valera and Number

Valera starts with a number $x$ and performs $k$ random operations on it. On each step, he flips a biased coin: with probability $p/100$, he doubles the current number, otherwise he increments it by one.

codeforcescompetitive-programmingbitmasksdpmathprobabilities
CF 441C - Valera and Tubes

We are given an $n times m$ grid where every cell must be partitioned into exactly $k$ simple paths. Each path, called a tube, must contain at least two cells and must move only through edge-adjacent cells, never revisiting a cell.

codeforcescompetitive-programmingconstructive-algorithmsdfs-and-similarimplementation
CF 440D - Berland Federalization

We are given a country with n towns connected by n - 1 roads. Because the number of roads is exactly one less than the number of towns and any town can reach the capital, the road network forms a tree.

codeforcescompetitive-programmingdptrees
CF 440C - One-Based Arithmetic

We are asked to represent a given positive integer $n$ as a sum of numbers, where each number consists entirely of the digit 1 repeated one or more times.

codeforcescompetitive-programmingbrute-forcedfs-and-similardivide-and-conquer
CF 440A - Forgotten Episode

We are asked to determine which episode Polycarpus has not watched in a season of a TV show. He has watched n - 1 episodes out of a total of n, each numbered consecutively from 1 to n.

codeforcescompetitive-programmingimplementation
CF 439B - Devu, the Dumb Guy

We are asked to teach Devu a set of subjects, each consisting of a certain number of chapters. Devu starts with a fixed amount of time required per chapter, and after completing each subject, the time per chapter decreases by exactly one hour for the next subject, down to a…

codeforcescompetitive-programmingimplementationsortings
CF 439C - Devu and Partitioning of the Array

We are given an array of distinct integers, and we need to split it into exactly k non-empty groups. Among these groups, exactly p must have an even sum, and the remaining k - p must have an odd sum.

codeforcescompetitive-programmingbrute-forceconstructive-algorithmsimplementationnumber-theory
CF 439E - Devu and Birthday Celebration

We are distributing a total of n identical sweets into f distinct friends, with the rule that every friend must receive at least one sweet. So the outcome of a distribution can be viewed as an ordered array a1, a2, ..., af of positive integers whose sum is n.

codeforcescompetitive-programmingcombinatoricsdpmath
CF 437A - The Child and Homework

The task is to simulate how a child chooses an answer on a multiple-choice question with four options, labeled A through D. Each option has a textual description.

codeforcescompetitive-programmingimplementation
CF 437D - The Child and Zoo

We are given a connected undirected graph where each node represents a zoo area and carries a value describing how many animals live there. For any ordered pair of distinct areas $p$ and $q$, we look at all simple paths connecting them.

codeforcescompetitive-programmingdsusortings
CF 437B - The Child and Set

We are asked to reconstruct a set of distinct integers from 1 to a given upper bound, such that the sum of a special function applied to each element equals a target value. The special function, lowbit(x), extracts the lowest set bit of x in its binary representation.

codeforcescompetitive-programmingbitmasksgreedyimplementationsortings
CF 436A - Feed with Candy

We have up to 2000 candies. Each candy has a type, either 0 or 1, a required jump height, and a mass. Om Nom starts with jump power x. He may eat any uneaten candy whose height is at most his current jump power. After eating a candy with mass m, his jump power increases by m.

codeforcescompetitive-programminggreedy
CF 436F - Banners

We are asked to optimize revenue from a mobile app that has both a free version with ads and a paid version without ads.

codeforcescompetitive-programmingbrute-forcedata-structuresdp
CF 436E - Cardboard Box

Each level can end up in one of three states. State 0 means we ignore it and gain no stars. State 1 means we complete it for one star and spend a[i] time. State 2 means we complete it for two stars and spend b[i] time.

codeforcescompetitive-programmingdata-structuresgreedy
CF 436C - Dungeons and Candies

We are given k game levels. Each level is an n × m grid of characters. A level can be transmitted in two different ways. The first option is to send the entire grid from scratch. Since every cell must be transmitted, the cost is n m.

codeforcescompetitive-programmingdsugraphsgreedytrees
CF 436D - Pudding Monsters

We have monsters placed on an infinite integer line. Consecutive monsters immediately stick together and form a block. A move chooses one entire block and slides it left or right until it collides with another block. After the collision, the two blocks merge.

codeforcescompetitive-programmingdp
CF 436B - Om Nom and Spiders

We are asked to compute how many spiders Om Nom sees if he starts walking from each cell in the top row of a rectangular park. The park is represented as an n × m grid where some cells contain spiders with an initial direction: left, right, up, or down.

codeforcescompetitive-programmingimplementationmath
CF 435D - Special Grid

We are given a rectangular grid with n rows and m columns. Each intersection of horizontal and vertical lines - each "node" - is colored either black or white. Additionally, every unit square in the grid has diagonals drawn.

codeforcescompetitive-programmingbrute-forcedpgreedy
CF 435E - Special Graph

We have an $n times m$ grid of vertices. Two vertices are connected if they share a side, and also if they are opposite corners of the same unit square. In other words, every cell contributes all four edges of the square plus both diagonals.

codeforcescompetitive-programming
CF 435B - Pasha Maximizes

We are given a positive integer, which we can treat as a string of decimal digits, and a maximum number of allowed adjacent swaps, k. The goal is to transform this number into the largest possible number by rearranging digits, but each move can only swap two neighboring digits.

codeforcescompetitive-programminggreedy
CF 435C - Cardiogram

The input describes a polyline that alternates between rising and falling diagonal segments. The length of the $i$-th segment is $ai$.

codeforcescompetitive-programmingimplementation
CF 433B - Kuriyama Mirai's Stones

We have a sequence of stones, each with a numeric cost. Kuriyama Mirai wants to ask two types of questions repeatedly: in the first type, she asks for the sum of the costs of stones in a contiguous segment of the original sequence; in the second type, she asks for the sum of…

codeforcescompetitive-programmingdpimplementationsortings
CF 433E - Tachibana Kanade's Tofu

We are asked to count numbers in a given range [l, r] (expressed in base m) that satisfy a certain “value” constraint. Each number starts with value zero. We are given n patterns, each a sequence of digits in base m, with an associated integer value.

codeforcescompetitive-programmingdp
CF 433C - Ryouko's Memory Note

The notebook pages are numbered from 1 to n. The sequence a describes the order in which Ryouko will read information. If two consecutive pieces of information are on pages a[i] and a[i+1], she must turn The total effort is the sum of these distances over all consecutive pairs.

codeforcescompetitive-programmingimplementationmathsortings
CF 433D - Nanami's Digital Board

We have a dynamic binary grid. A cell containing 1 is lit, a cell containing 0 is dark. Two kinds of operations appear. A modification flips one cell. A query asks for the largest all-1 rectangle whose border contains a given cell (x, y). The cell does not need to be a corner.

codeforcescompetitive-programmingdsuimplementation
CF 433A - Kitahara Haruki's Gift

We are given a collection of apples where every apple weighs either 100 grams or 200 grams. All apples must be distributed between two people, and each apple must go entirely to one person because apples cannot be cut.

codeforcescompetitive-programmingbrute-forceimplementation
CF 432D - Prefixes and Suffixes

We are given a single string of uppercase letters. Our goal is to identify all prefixes of the string that are identical to some suffix, and for each such prefix, count how many times it occurs anywhere inside the string as a contiguous substring.

codeforcescompetitive-programmingdpstring-suffix-structuresstringstwo-pointers
CF 432C - Prime Swaps

We are given a permutation of integers from 1 to n, which means each integer in that range appears exactly once in the array. The goal is to sort this array in increasing order, but with a special restriction on the swaps we can make.

codeforcescompetitive-programminggreedysortings
CF 432B - Football Kit

We are asked to simulate a football tournament between n teams, where each team has a home kit and an away kit with distinct colors. Every team plays a home and away game against each other team. By default, the home team wears its home kit and the away team wears its away kit.

codeforcescompetitive-programmingbrute-forcegreedyimplementation
CF 425C - Sereja and Two Sequences

We have two sequences. A profitable move chooses a non-empty prefix from each sequence, with the requirement that the last element of the chosen prefix in the first sequence is equal to the last element of the chosen prefix in the second sequence.

codeforcescompetitive-programmingdata-structuresdp
CF 425A - Sereja and Swaps

We are given an array of integers and a limited budget of swap operations. Each swap allows exchanging any two positions in the array, and we can perform at most k such swaps.

codeforcescompetitive-programmingbrute-forcesortings
CF 425E - Sereja and Sets

We are asked to count sets of intervals within the integer range from 1 to n, such that the largest collection of non-overlapping intervals in the set has exactly size k.

codeforcescompetitive-programmingdp
CF 425B - Sereja and Table

We are given a table of size n × m, where each cell contains either a zero or a one. Sereja wants to modify at most k cells so that the table satisfies a very specific property: each connected group of identical numbers must form a perfect rectangle aligned with the table’s…

codeforcescompetitive-programmingbitmasksgreedy
CF 412C - Pattern

We are asked to merge multiple patterns into a single pattern that intersects with all of them, minimizing the number of question marks. Each pattern consists of lowercase letters and question marks, where a question mark matches any letter.

codeforcescompetitive-programmingimplementationstrings
CF 412E - E-mail Addresses

We are given one long string that contains only lowercase letters, digits, , @, and .. We must count how many substrings of this string are valid e-mail addresses. Substrings are distinguished by their positions, not by their textual contents.

codeforcescompetitive-programmingimplementation
CF 412B - Network Configuration

We are given a set of computers, each with a measured maximum Internet speed. There are fewer participants than computers, and each participant must get a separate computer.

codeforcescompetitive-programminggreedysortings
CF 412A - Poster

We are asked to simulate painting a slogan on a linear banner that is divided into n squares, one character per square. The painter can use a ladder that initially stands in front of the k-th square.

codeforcescompetitive-programminggreedyimplementation
CF 411C - Kicker

We are given four players split into two teams of two. Each player has two independent strengths: one for defending and one for attacking. Before the match, each team assigns one player to attack and the other to defend.

codeforcescompetitive-programming*specialimplementation
CF 411B - Multi-core Processor

We are simulating a processor with several cores and several memory cells. Time is divided into cycles. For every cycle, each core receives either a command to do nothing or a command to write into a specific memory cell. The interesting part is how deadlocks occur.

codeforcescompetitive-programmingimplementation
CF 411A - Password Check

We are asked to check whether a password string is "complex enough" based on four criteria. The password is a sequence of up to 100 characters containing uppercase letters, lowercase letters, digits, and a few special characters.

codeforcescompetitive-programming*specialimplementation
CF 409G - On a plane

We are given a set of $n$ points on a 2D plane with floating-point coordinates. The task is to find the smallest possible angle of rotation around the origin that ensures all points can be covered by a half-plane (a straight line that divides the plane into two parts).

codeforcescompetitive-programming*specialgeometry
CF 409I - Feed the Golorp

The input is a single string that visually looks like a tiny ASCII “program”. Inside it there are special symbols forming a structure, and within this structure there are placeholder positions that behave like variables.

codeforcescompetitive-programming*special