Блог пользователя Yandex

Автор Yandex, история, 2 года назад, По-русски

Hello Codeforces!


We are delighted to invite you to participate in Yandex Cup 2024!
Yandex Cup is a championship in six different tracks:

This year, as a pilot project, we are inviting schoolchildren (so far only from Russia) to participate in the Algorithm and Analytics tracks.


The championship consists of three stages.

Schedule

The stages and dates are different for Machine Learning and Mobile Development. More details about the terms and conditions can be found on the track's pages.

REGISTER

Qualification is a contest with a virtual start. You can write a context during the week from 14 to 20 October. The duration depends on the selected track. After the qualification stage we will publish the criteria for the semifinal.

Semifinal will be held on 3 November. The start of the contests is at 12:00 (GMT+3) and at 17:00(GMT+3) at the Algorithm track. Duration depends on the selected track. The top 20 semi-finalists in each track and the top 10 students in the tracks Algorithm and Analytics will qualify for the finals

The final of the competition will be held in Tashkent Uzbekistan on 2-6 December. All expenses related to travel and accommodation of the finalists will be covered by us.

This year, we have also increased the prize fund, which amounts to 12.5 million rubles

See you at the Yandex Cup!

  • Проголосовать: нравится
  • +257
  • Проголосовать: не нравится

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

Yandex Contest of tourist was fun to watch without understanding anything.

»
2 года назад, скрыть # |
 
Проголосовать: нравится -118 Проголосовать: не нравится

the prizes are not worth trying

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

on which website will the contest be held? it will be my first time participating. some help would be appreciated :prayge:

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It seems that only the Algorithm track is available in English. To what extent will the non-Algorithm tracks use Russian? Would it be manageable (time-efficient) to use Translate to understand and solve problems in other tracks, say ML?

»
2 года назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

Мне начинает казаться что Яндекс уже везде...

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

It seems to me that there is no "other" option for university. Nevermind, found it.

»
2 года назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

I didn't really understand how many people will qualify to finals

»
2 года назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

The time to start qualification round is not properly mentioned. What time it is??

»
2 года назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

Its 10/14 and contest has not started. Theres even no announcement of when does contest start!

»
2 года назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

May I ask how long the window of qualification round would take? It seems I cannot find some useful information related to this... I need to decide when to start once I could know the duration of the window :(

»
2 года назад, скрыть # |
 
Проголосовать: нравится +25 Проголосовать: не нравится
  1. Press register.
  2. Requires yandex id or whatever.
  3. Press create.
  4. Requires phone number.

I think I'll pass.

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Only Russian allowed to get a price?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

What was the last year qualification border(to semifinals)?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

When will the results / cutoffs for Algorithm and Analytical Rounds come out!! :-)

»
2 года назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Is there any reason why a points cutoff and/or number of participants qualifying to a semi-final is not announced beforehand? Is there at least some statistics from the previous years about how many problems was required to advance from qualification to a semi-final in the Algorithm track?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

when could us to discuss the tasks of the contest?

I want to know how to solve task F :(

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +5 Проголосовать: не нравится

    Very true, i would be grateful if someone can explain F itself. I was not quite sure if I understood the task itself. The only significance of 16 i saw is that log_2 (2024) = is 11 and 11 < 16 due to which i thought of binary search but not quite sure how to proceed at all.

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +31 Проголосовать: не нравится

    Let's discuss the solution to the 15-question problem.

    Note that we ask all our questions before receiving answers! After processing the answers, we should determine if there is an error (in case there is one) and correct it.

    The first part (if we only get correct answers, this is a classic problem):

    • The i-th set contains all numbers whose i-th binary bit is 1.

    • We ask 11 questions and we get a guessed number.

    The second part (the idea is that we will get 15 bits of information and need 11 of them to be correct... [Hamming Code], right? 11 + 4 bits is a well-known basic code):

    • The adjustment of the first part and the Error Correction Code took me about an hour :) One can do it much faster.

    Try it out!

    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Thank you so so so much. This makes a lot of sense :-)))))

      The idea of hamming codes did strike me in contest but i did not realise the "if we get only correct answers" it is 11 part.

      Now it makes so much more sense. TYSM!!!

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did anybody solve Backend D?

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I didn't solve D completely, only got 14 of 200 points.

    My idea was to store the data on cache servers (hash(key) % n) and ((hash(key)+1) % n). When a key arrives I first check the cache servers. If they have this key, I simply return the data. If the key is not there, I request db, store to the cache servers and return the data. In case one of the cache servers is down, I can always request from the second cache. Also in this way the data is evenly distributed across the caches.

    It was pretty hard to debug, because the stderr output was limited in length. I don't know if this solution satisfies all the conditions: at least it can request the db twice in case the program is stopped at the moment between GET from db and PUT to cache (maybe we had to do something with catching signals?). Besides, the example suggests that the program straightly requests the db when it sees a key for the first time, but if we remember all the keys in memory, it will be cleaned when the program is restarted.

    As far as I could see from the stderr, in the failing test all the keys were present in db, but that case could probably happen too.

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

intended solution for problem C and D of algorithmic track , how the M-N>N was utilized in D and for C is it DP or greedy way also possible ?

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +2 Проголосовать: не нравится

    D is quite a nice problem

    The basic idea is that you need to find the value of both M, N. Use the fact that M — N > N --> M > 2N

    So first you output 1, if you get okay then you have found N.

    Otherwise N >= 2 so M > 4 so output 5. (not binary powers i.e, 1 2 4 8 etc works but this is slightly optimised). Then you N >= 6 so M > 12 so try 13 and so on.

    Once you find the "ok" you know the values of m, n, so just binary search to find the answer

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    For C, the question was a bit confusing to me; but after some amount of guessforces and checking if samples worked or not (and WA's :-), this finally worked

    sr[i].second = max(sr[i].second, r); sl[i].first = min(sl[i].first, l); sr[i].first = min(sr[i].first, r); sl[i].second = max(sl[i].second, l);

    repeat this from i = n — 1 to 0 and then print

    max(sr[0].second — sr[0].first, sl[0].second — sl[0].first)

    I hope this was helpful :-)

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +2 Проголосовать: не нравится

    For C you either use only L or only R, so you can try both and take the max. For the proof:

    • First you can realize that if you reach the extreme on the left first then you can use only L at the beginning and then only R after reaching it. Similarly if you reach the extreme on the right first, you only use R at the beginning, and then only L. With this I think you could already use some data structure to solve the problem.

    • If you take an optimal solution. In the first case (first use L then R), if you replace some of the L into an R the maximum distance either doesn't change or increase by 1 or 2, so by doing this you end up with a solution that has only R and is just as good or better.

    • »
      »
      »
      2 года назад, скрыть # ^ |
      ← Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      nice proof really liked it , would like yandex cup in next years to have the all the tracks in both English and Russian it would be so much better tbh . Btw those who did the analytics track how they did they solve A,D,E ?

      • »
        »
        »
        »
        2 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        A. Let $$$F(a, b)$$$ be the probability of placing a thing in the first cave after $$$a$$$ unsuccessful attempts to find it in cave 1 and $$$b$$$ attempts in cave 2.

        $$$F(a, b) = \dfrac{0.65 (1 - 0.44)^a}{0.65 (1 - 0.44)^a + (1-0.65)(1-0.44)^b}.$$$

        So the answer is $$$F(3,7)$$$ and $$$F(2, 0)$$$.

        D. Let $$$\alpha$$$ be the expectation of one move (when all 5 dices are in hand); and $$$p$$$ be the probability to get 0 points at this move. I wrote some python code to calculate it.

        Then it's reasonable to try the next way: find $$$x$$$ such that $$$x \gt (1-p)x + \alpha$$$, the value which is more likely to get zero points by move than to increase it.

        So, $$$x = \alpha / p$$$. And we have to round it up to the nearest integer divisible by 5.

        E. Find some borders of '1': minimal and maximal row and column:

        • check, that it's a square
        • validate the frame of the square
        • validate diagonals

        P.S. I posted video with some explanations and ideas here (in russian)

»
2 года назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

What is the criteria for the Semifinals qualification this year?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Am I the only one, who finds A to be harder than B and C? Maybe, I didn't get the easy idea of the solution, but I needed binary search and use not so easy math), while B and C were pretty trivial.

Also, D is not original, it's almost the same as this task from NCPC

I didn't see anyone asking, but what's the intended solution to E? At the upsolving, I solved it, using dynamic programming, where I kept at each bit hash table, where values were the weights after including some last bits and not including bits that are less or equal to the current, and at the keys I kept the number of ways to achieve that weight in the following way. The only thing, that optimised this approach, was to check, if it's potentially possible to achieve this weight (if multiplication of mask with all 1 bits that are less or equal than the current and the biggest integer from the array a is bigger or equal to the current weight, then we potentially can achieve this weight, otherwise it's impossible). You can actually see my code here. I'm wondering, if my solution is what was intended? I still don't have proof of why this should work fine, so, maybe, someone could provide it?

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    I don't know if this is intended, but a trick is this: You try to satisfy the equality $$$\sum w_i 2^i = n$$$ gradually, by first making sure it is true $$$\mod 2$$$, then $$$\mod 4$$$ and so on. When working $$$\mod 2^k$$$ all weights multiplied by a bigger power of two do not matter. This gives rise to the following DP state:

    $$$\text{dp}[k][\text{carry}] = \text{number of ways to satisfy equality} \mod 2^k$$$ $$$\text{and such that the weights } \lt k \text{ carry over to the bigger bits with this carry.}$$$

    In this DP state you have not decided yet what the weights will be for the bigger powers. Notice that the carry is at most twice the input weights, which is 100, and it does not make sense to add bigger weights than $$$\log_2(n)$$$, and for each DP state, we enumerate what the next weight will be. So this solution can work for much bigger constraints.

    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится +3 Проголосовать: не нравится

      My solution is the same. Here's the code if someone needs it:

      Code
    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      For problem E, I just submitted a brute force and it passed within 10ms...

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I think yours is indeed intended. Actually, it would be more intuitive if you start from the $$$0_{th}$$$ bit, and then erase all states where $$$0_{th}$$$ to $$$i_{th}$$$ bits are not equal to $$$0_{th}$$$ to $$$i_{th}$$$ bits of $$$n$$$. There would only be at most $$$100$$$ states in each iteration, since you can at most add $$$100 * 2^i$$$ and $$$0_{th}$$$ to $$$i_{th}$$$ bits are fixed, thus only $$${i+1}_{th}$$$ to $$$i+6_{th}$$$ bits are free.

    Your code actually does similar things, but just in a reverse manner. Just your code fixed $$$i+7_{th}$$$ to $$$26_{th}$$$ bits are $$$0$$$, and only $$${i}_{th}$$$ to $$$i+6_{th}$$$ bits are free.

    Disclaimer: I might be wrong about the exact number of the bits above but I'm too lazy to validate them. Just roughly it could show that its $$$O(log(n) * max(a_i) * m)$$$.

  • »
    »
    2 года назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +2 Проголосовать: не нравится

    I had a O(nm / 2^B + m^B) solution

    You do a dp for all bits except for the smallest B bits and bruteforce the coefficient of smallest B bits

  • »
    »
    2 года назад, скрыть # ^ |
    ← Rev. 4  
    Проголосовать: нравится +8 Проголосовать: не нравится

    Problem E: after your setup, you want to receive a $$$k$$$-bit word and uniquely determine the word from your list it differs from in at most one position. So, in particular, every two words in your list must differ at 3+ positions, because otherwise you wouldn't determine the answer for a word that differs from both of them in at most 1 position.

    First of all, since every your codeword generates $$$k+1$$$ possible answers you want to map to it, we have $$$2025(k+1) \le 2^k$$$, so $$$k\ge 15$$$. Second, this construction is called "error-correcting code", I used some linear code that is basically a carefully chosen 11D subspace of $$$\mathbb{Z}_2^{15}$$$, so that every non-zero vector there has at least three ones. I learned such things in my university earlier, but, to my shame, I had to google this during the round.

    Apparently, you also needed to handle receiving -1, because it could happen any time and didn't mean that you did something wrong (???). Would be happy to hear the reason behind this

    UPD: ah sorry, I am talking about the last problem

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    What was the maths in problem A except computing lcms and using inclusion-exclusion principle for 3 numbers?

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    If understand it correctly your solution is indeed fast, and I have the same idea but used recursive approach: $$$rec(k, w)$$$ — number of ways to get weight = $$$w$$$ using the first $$$k$$$ bits. The idea is to try to use brute-force from the highest bits and memorize the values that you visited before, and most importantly to exit the recursive call if it is not possible to get required weight. (I sorted array $$$a_i$$$ to make it more convenient). It is not possible to get the weight = $$$w$$$ if $$$w \gt a_m \cdot (2^{k+1} - 1)$$$. In the worst case, $$$a_m = 100$$$, so if $$$w \gt 100 \cdot (2^{k+1} - 1)$$$ we can exit the recursion.

    This solution works fast, and can be proven in this way: For the $$$k \leq 18$$$ we can use $$$dp_{k, w}$$$ — number of ways to get the weight = $$$w$$$ using the first $$$k$$$ bits. This dp takes $$$\sum_{k=0}^{18} (2^{k+1} - 1) \cdot 100 \cdot 10 \approx 2^{20} \cdot 1000 \approx 10^9$$$ operations. And the last 8 bits can be calculated by brute-force in $$$m^8 = 10^8$$$ operations.

    On practice this solution works much faster because the brute-force for the last 8 bits has many cutoffs and dp is calculated recursively, which makes solution faster as well. My solution works in 2ms for all tests.

    Also, this problem is very similar to the 2123. Knapsack.

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In the post it says the semi-finals is one 2nd November, however in the website it says 3rd November. Can you please confirm which is correct?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to know whether I qualify? Also how to solve E?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Подскажите 64ый тест в задаче "А" в треке "Алгоритм".

»
2 года назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Yandex Can you add Node.js to Algorithm track next year?

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

What is wrong with my Algorithm A?

I used binary search with inclusion-exclusion principle, that give the number of good numbers less than $$$mid$$$ is

$$$mid/lcm(a,b) + mid/lcm(b,c) + mid/lcm(c,a) - 3*(mid/lcm(a,b,c))$$$.

But why am I getting WA on 25?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

where can I see the standing of algorithm round?

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +4 Проголосовать: не нравится

According to the telegram channel of Yandex Cup, everyone, who receives at least 3 points, advances to the semi-final. Also there are open standings now, and not only for algorithm track (for backend also, idk for other tracks).

(I'm talking about the algorithm track, for backend track you needed to receive at least 160 points).

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    So score cutoffs are:

    • Frontend — 26
    • Analytics — 31
    • Backend — 160
    • Algorithm — 3
    • iOS — 13
    • Android — 12

    This year Yandex employees were also allowed to take part in the competition. I thought initially that there will be a separate leaderboard for them. But now I see Chmel_Tolstiy in the analytics leaderboard and elizarov in the backend leaderboard.

    Does it mean that Yandex employees compete together with everyone else and potentially they can occupy some of the top-20 spots in the finals for each track? Please clarify this as it significantly influences strategy of choosing the track for the semi-finals for those who qualified to the semi-finals in multiple tracks.

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +25 Проголосовать: не нравится

Has the date of the Semifinal been changed from November 2nd?

According to the schedule on https://contest.yandex.com/yacup/schedule, it overlaps with AtCoder Grand Contest 069, so I would like to request a time adjustment if possible. Yandex maroonrk

Thanks!

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What's the solution for F. Zeroth Rome ?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

In problem F, why does code1 result in a runtime error on test 1, while code2 and code3 pass all tests?

It seems something might be off with test 1.

  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Do you handle this:

    If the given number k is greater, than the pharaoh wants – he does not wish to answer that many questions, the jury program will respond with the number −1. In this case, you must correctly terminate the program (to receive a correct verdict).
»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

В преддверии полуфинала трека "Бэкенд" завтра, кто-нибудь может поделиться своим шаблоном (предпочтительно на C++, но Java и Python тоже подходят) для взаимодействия с сервером по HTTP (к примеру, это было нужно в задаче D квалификационного раунда и, вероятно, понадобится в полуфинале)?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +20 Проголосовать: не нравится

In the email sent yesterday, it said, "The top 10 participants from the semifinals in each track will head to ancient Tashkent." But elsewhere it says "top 20." Which is correct?

Yandex

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Where is the Yandex Algorithm semi-final contest link? Is it the contest time now?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Where is contest link? I qualified but don't see how to enter

»
2 года назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

Каждый год пробую и каждый год одно и то же. Бекенд, 2:20 с начала соревнования, здравствуйте — уточнение условий! Это были увлекательные полтора часа в попытках угадать, где несоответствие тестов и условий, но я надеялся на другие цели в соревновании. Буду спрашивать ваших эйчаров, кто вычитывал задачи, чтобы случайно не собеседоваться в эту команду :)

»
2 года назад, скрыть # |
 
Проголосовать: нравится +10 Проголосовать: не нравится

How are ties broken in the Algorithm Semifinals?

»
2 года назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Is it possible to read problems and watch standings of the algorithms semi-finals while the contest is running?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Does anyone solve backed C task with DDoS?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Did anybody solve Backend C with DDoS?

»
2 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Could anybody briefly explain how to solve C in algorithms track?

»
2 года назад, скрыть # |
 
Проголосовать: нравится -35 Проголосовать: не нравится

Pretty bad contest tbh. Problems A and B are okay I guess? In problem C I knew it needed matrix exponentiation but am not really good with it so after some research I found a blog for Errichto with the same problem so I used the solution. Didn't read problem D, but if my solution for E is intended, it's really bad.

My solution for E
  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится +10 Проголосовать: не нравится

    You can find the largest distance from each node by finding the diameter of the subset of nodes with a certain prime factor. To find diameter, just find the farthest node in the subset from an arbitrary node, and then find the farthest node from that node. Precompute LCA distances to compute distances in O(1).

»
2 года назад, скрыть # |
 
Проголосовать: нравится +46 Проголосовать: не нравится
Комментарий удален по причине нарушения правил Codeforces
  • »
    »
    2 года назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Would be much better to have $$$T \lt = 100$$$. Spent so much time hardcoding all the base cases / tail optimization.

    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Why would you need to hardcode or optimize anything?

      • »
        »
        »
        »
        2 года назад, скрыть # ^ |
         
        Проголосовать: нравится 0 Проголосовать: не нравится

        if you try doing for power <= p, formula and for power > p, "pure" bruteforce, it becomes hard

        (i did for power >= 3, store them in a list and prefix sums, which passes easily)

        • »
          »
          »
          »
          »
          2 года назад, скрыть # ^ |
          ← Rev. 2  
          Проголосовать: нравится 0 Проголосовать: не нравится

          Yeah, I had to do formula until power $$$p \lt = 5$$$ and bruteforce for the rest. Had a bunch of code that looks like this to squeeze into TL.

          Unless there's a much simpler solution.

          	if (R < 2) {
          		return 0;
          	}
          
          	// special case: two digits
          	auto ans = Modular(R - 1) * Modular(R) / 2 * 2;
          
          	// three digits
          	long long n = sqrt(R);
          	auto threes = Modular(R + 1) * (n - 1);
          	// subtract 2^2 + .. + n^2
          	threes -= Modular(n) * Modular(n + 1) * Modular(n * 2 + 1) / 6 - 1;
          
          	ans += threes;
          
          	// four digits
          	long long low = 1, high = 1e6;
          	while (low <= high) {
          		long long mid = (low + high) / 2;
          		if (mid * mid * mid <= R) {
          			n = mid;
          			low = mid + 1;
          		} else {
          			high = mid - 1;
          		}
          	}
          
          	auto fours = Modular(R + 1) * (n - 1);
          	// subtract 2^3 + ... + n^3
          	auto sums = Modular(n) * Modular(n + 1) / 2;
          	sums = sums * sums;
          	fours -= (sums - 1);
          
          	ans += fours;
          
          	// five digits
          	low = 1;
          	high = 32000;
          	while (low <= high) {
          		long long mid = (low + high) / 2;
          		if (mid * mid * mid * mid <= R) {
          			n = mid;
          			low = mid + 1;
          		} else {
          			high = mid - 1;
          		}
          	}
          
          	auto fives = Modular(R + 1) * (n - 1);
          	// subtract 2^4 + .. + n^4
          	sums = Modular(n) * Modular(n + 1) * Modular(n * 2 + 1) * Modular(n * n * 3 + n * 3 - 1) / 30 - 1;
          	fives -= sums;
          	ans += fives;
          
          • »
            »
            »
            »
            »
            »
            2 года назад, скрыть # ^ |
             
            Проголосовать: нравится 0 Проголосовать: не нравится

            there are only <= 10^6 relevant numbers for powers >= 3. You can just binary search on a vector of those numbers after precomputing?

          • »
            »
            »
            »
            »
            »
            2 года назад, скрыть # ^ |
             
            Проголосовать: нравится +10 Проголосовать: не нравится

            Attaching the core of my solution; sounds similar to what has been mentioned above minus binary search.

            Spoiler
    • »
      »
      »
      2 года назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      It's just that it's code is pretty messy because of the r <= 10^18 condition so lotsa mods would've been much cleaner for r <= 10^9

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

27th place, any chance? Yandex were there any people <= 26 rank who are employees/school?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Does someone who solved F really quickly mind sharing their solution (e.g., hos.lyric)?

I got sidetracked for a while (misreading the problem at first, then trying to optimize a solution idea that was getting TLE38 but was actually wrong). Even if I had come up with the correct idea from the beginning there's no way it would have taken me less than twenty minutes to solve. :)

»
2 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

anyone mind to post semifinal solutions?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

When will the problems and standings of the Algorithm semi-finals be available to outside spectators?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Has the finalists of each track been announced?

»
2 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Has the finalists of each track been announced?