 # Analysis of the entrance exam SHAD-2015 and the memories of the graduate of 2017

Published on April 20, 2017

# Analysis of the entrance exam SHAD-2015 and the memories of the graduate of 2017

## Introduction

In May 2015, I graduated from the undergraduate faculty of general and applied physics at the Moscow Institute of Physics and Technology. I mainly deal with quantum field theory, but at that moment I decided that I would like to delve deeper into the modern world of computer science, that I could try to combine MIPT with Yandex SHAD (two master's programs). At that time, everyone had already heard ShAD, everyone around just kept saying what a tough course of algorithms there was, I liked the site (lol), the subjects of the courses, and I decided to do it.

In this post, I would like to talk about how my admission to the ShAD took place, to tell me my decision of the exam option (there are not very many analyzes of ShAD tasks on Runet) and talk about what I liked / did not like about this wonderful institution.

Online selection was not difficult, in 2015 they gave 12 tasks for a month, of which more than half were combinatorics with the answer in the form of a number, and only a lazy would not write a script for each task to check the answer (I generally solved only one problem So). Today, as far as I know, they give some limited time, within a few hours.

After the online phase, I was invited to the exam. I was preparing for the exam for about a week, and by itself, he gave me great pleasure. In 4 hours it was necessary to solve 7 problems in mathematics and compose one algorithm (a total of 8 tasks). The mathematics required is the most diverse: linear algebra, mat. analysis (almost formalism), combinatorics and theory. Ver., graphs, Fourier transform, etc. It seems to me that it is very correct for applicants to demand knowledge of mathematics, and not some languages ​​or skills there (in general, it later turned out that ShAD is focused on knowledge in essence, and not on technical details).

I would like to devote this post to the analysis of the option that I got on the exam. Throwing in three cups of espresso and tincture of Eleutherococcus, I was able to cleanly solve seven of the eight problems, and I did not even have time to look at the eighth.

## My exam

Square matrix  is such that for any traceless . Prove that the matrix scalar.

#### Decision

This task immediately reminded me of a different, slightly more complicated problem from the Fiztekh exam in linear algebra in the first semester, where it was necessary to prove that only a scalar matrix commutes with all matrices. As there, here you need to take advantage of the fact that the matrix any, and therefore, considering matrices various kinds, we can impose restrictions on the marina .

First, consider the matrix view , that is, a matrix in which all elements of 0 except the unity in th line on th position. Since we remember that is a traceless matrix, . Then the equation from the condition is rewritten in the form (if in the formula the index is repeated twice,summing isimplied by it)



That is, with a flick of the wrist we proved that in the matrix  outside the diagonal are only zeros. If we drop the indices, then we just multiplied the matrix on a matrix of a special form and got some kind of restriction.

Now we know that the matrix is diagonal. How to prove that all its eigenvalues ​​are equal? To do this, we now consider the matrices , i.e., matrices with -th diagonal element should , and on -th - . Similarly, multiplying the matrices and taking the trace, we get (the trace turned out to be equal to only the difference of the pair of eigenvalues). By condition for any this equality must be satisfied, whence it follows that all eigenvalues ​​are equal, the problem is solved.

Arriving for a written exam at the SHAD, students realized that among any four people, at least one was already familiar with the three remaining. Prove that then among any four people, at least one is already familiar with all the other students.

#### Decision

This task almost killed me, at the exam I came up with a terribly complex and miserable solution. Here it is. I recommend to draw various options in the form of graphs during the reading process, then it becomes even not so terrible!

Consider an arbitrary four students , , , . Suppose, on the contrary, none of them are familiar with all the other students. But by condition, one of the students (let it be ) knows all three remaining. On the contrary, we concluded that there is some other student which does not know.

In this place we will make a feint with our ears and consider the four , , , . In this four there should be a student who knows all three. It can't be or , since they are not familiar, so let knows all three (it doesn’t matter, it can be , until the symmetry between them is broken).

Since we are working on the contrary, then every student in the four does not know anyone. If in the case of we were forced to take a stranger from the side, then in the case of two possible cases. If a does not know someone from inside the four , then it can only be since and he already knows. But in this case, consider the four . Given the fact that does not know and don't know , we cannot satisfy the condition that at least one student in the four knows all the other three.

In this way, and should be familiar, while u must be an unfamiliar student by . But here comes the end. Consider the four . It is impossible to arrange for someone to know the other three students as they are unfamiliar and , and , the problem is solved.

Two random points are selected on the circle  , , find the expectation of the area of ​​the smallest of the segments on which the chord breaks the circle.

#### Decision

As said in one joke about the ensign, “what is there to think? it’s necessary to shake! ” Fix a point , and the point parameterize the angle between radius vectors and . Consider the angles . The area of ​​the smaller segment will then be equal to , then



Dan array of  natural numbers. Suggest a way to sort it by the remainder of dividing by 5 for linear time and constant memory.

#### Decision

Hands got cold in this place, I’m not a programmer! But calmly, I told you, this is a math exam.

Sorting needs to be done in-place, since in addition you can only spend the memory constant. Fix some current balance (first , at the end ) and go through the array from start to finish with a pointer . We also get the so-called insert index , which initially indicates the beginning of the array and then only increases.

If an array element has a remainder , we have to swap it with . After this index we increase until and stop at the moment when this equality is violated. Then grow the index again until we find again to throw it to the position .

There is a certain invariant in this algorithm, namely, behind the index all numbers are already arranged correctly (sorted by remainder). In one run over the entire array, behind will be all the elements that when divided by give the remainder . At the next pass, the same fate will befall those who share with the remainder and so on. In total, 4 passes will be required (the fifth will no longer be needed).

Explore the convergence and absolute convergence series



#### Decision

SHAD, are you serious? Well, why? Okay ... we

’ll write



It can be seen that the series converges conditionally. Term converges on an integral basis, and the term converges according to the Dirichlet criterion. If we consider absolute convergence, we must recall the property. Term still converges on the same integral basis, but the term  diverges as the sum of a harmonic series, and therefore the whole series does not converge.

You have an unlimited number of bones in the form of all possible regular polyhedra. Is it possible, having asked for a certain set of such bones once, to simulate a throw (a) of the correct 7-sided bone, (b) of the correct 15-sided bone?

#### Decision

I did not even have time to read this task on the exam itself, so it was like homework. There are five regular polyhedra: pyramid (4), cube (6), octahedron (8), dodecahedron (12), icosahedron (20).

Note that we can simulate a throw- of the granular bone, taking the remainder of the division by five of what fell on the icosahedron. Similarly, we can simulate a throw of a trihedral bone, dividing the remainder of the division byfrom everything that falls on the pyramid. Then if and  - the results of the rolls of such bones, then the result of the throw -face bone we will recount as Note that here all outcomes are equally probable, that is, this is really the correct bone.

However, the cast- The facet bone cannot be simulated. At this point, it became clear that if we have an honest cube, then we can simulate any dividers as well as if we have two honest dice  and we can simulate a work . That is why we can simulate any number that can be decomposed into prime factors.,  and (there are no others among the Platonic solids).

Suppose we want to simulate a number that does not decompose into the product of such prime factors. Kinem for this bones , and the numbers that fell out at all  bones, we write in one vector that describes a point in a hypercube of size . If we want to pretend-shaped bone, we must divide the points in this space into  groups of equal size, which cannot be done, because otherwise the work  will have to be divided into and we haven’t received this yet.

Let be , Are square real matrices. Prove that

#### Decision

Here I was very helped by the formula, which is terribly loved in theory. physics, and I strongly recommend taking it into service for those who go to the exam. For any matrix, in which all eigenvalues ​​are positive, is true 

How to apply our formula here? I will say right away, we will lay out the logarithm in a row. Under the logarithm we will have an expression of the formwhich can be arranged in a row only if . This completely corresponds to the radius of convergence of the logarithm, but only in multidimensional space.

To get started, let's reformulate the assignment and prove that for any real number , and then just take Why is this needed? This is necessary in order to make the matrix norm less . When considered very small, you can safely write such a chain (under the trace of the matrix you can move around in a loop):



Here we brazenly used the property 

Ok, we proved this formula for some segment near zero. How now to spread it to everything, in particular ? Note that the left and right sides of the proved formula contain polynomials in(because the determinant includes only works)! That is, we proved that two polynomials coincide on a segment, but it immediately follows that they coincide everywhere on a number line.

Sitting at the table miners, in front of each of whom lies a heap of golden sand. Every minute, all prospectors take half of the sand from the left heap and half from the right heap and lay it to themselves. Describe the asymptotic behavior of the amount of sand in piles for an arbitrary.

#### Decision

In fact, we are invited to find the asymptotic behavior of the solution of such a difference scheme (for any initial conditions):



Where  - the amount of gold from the prospector sitting in position  during . Coordinate closed in a circle .

Such things can be solved in many ways, but the most natural is the discrete Fourier transform. We are dealing with a function periodic in, and it can and should be expanded into the final Fourier sum in :



This farm must satisfy our difference equation, therefore, we substitute this sum into the equation explicitly and require that the coefficients for all exponents on the left and on the right coincide. In fact, we just made a basis change (switched to plane waves) and require that in the new basis we have the same coefficients before the basis vectors. This leads to the equation



For fixed this is an equation in itself, which is likewise solved by another Fourier transform. We will denote the Fourier transform by the coordinate by the tilde, and by the coordinate + time - by the cap. Writing down



substituting this in the last equation and equalizing the exponents again, we get



We got the so-called dispersion relation. That is, plane waves here may not be arbitrary, but only with those who obey this formula. This dispersion relation is a reformulation of the original equation in a new basis. Let us capture some momentum and try to find the appropriate frequency which may exist in such a system.

If the cosine on the right is less than unity in absolute value, then the complex frequency will have to be substituted into the complex exponent(which will have the imaginary part). It is easy to see that the imaginary part of this exponent will then be positive (), then it will enter the exponent as and reduce its modulus after cosine. But, fortunately, such frequencies will quickly go to rest. Indeed, if we look at the contribution that modes with such frequencies will make, we will see that they will decay exponentially in time. Such modes will not contribute to the asymptotic behavior.

Therefore, we have two cases left. If a - odd, then the cosine is equal  modulo only once when . In this case. This plane wave is just average. It turns out, with odd there is no interesting dynamics at infinity: the wealth of prospectors converges to the average of what was originally:



If  odd, then the cosine can still be equal , if a , and then an additional solution is possible  (only the term in which the material , we wrote it down). In this case



Similarly, only one term remains, we write it. Now we know almost everything about the solution. This is some kind of construction that changes sign both in time steps and in space steps. Notice that if herewas not even, it would violate the circularity of the circle. It remains only to find the value of the coefficient.

Take a look at the inverse Fourier transform:



At  left is , and on the right it’s just , that is, the alternative sum of wealth at the initial time. So we get



## Afterword

For the control gave seven points out of eight. I did not write about the trick within the problem of matrices, but simply laid out - this was not noticed. Then there was an interview. They didn’t ask me anything about the exam, they just talked for my life, why I want to enter the school of law (prepare the answer to this question!). Guys who had fewer tasks were asked to solve something on the spot, so it's better to come in a fighting mood. There will also be an opportunity to filter out undeliverable points for the control.

I liked the training at the SHAD very much. Here they always push some theory, read on the latest articles, and not on 50-year-old books, and, most importantly, the theory is always supported by a very suitable and logical practice.

Pros:

1. Very cool courses, eyes are running wide: there is for every taste, from the very practical to the very theoretical, almost all modern branches of computer science are covered by fresh articles.
2. Teachers in the bulk of the fire, it was not too lazy to go to the other end of Moscow to listen to the evening after a lab.
3. Cool presentation of the material, everything is recorded on video, you can not go. You can rent out remotely, but you still want to go.
4. Great classmates!

As such, I did not even notice the cons. Curators treat everyone kindly, do not rush to deduct. Yandex (Mamontov’s premises) has a very pleasant atmosphere, air conditioning, delicious food, comfortable chairs, a human atmosphere! And, most importantly, quite a lot of freedom in choosing courses and your profile, even within the framework of the chosen specialty.

Go to the SHAD! And, yes, I forgot, be sure to deal with the formula for the complete decomposition of the determinant