Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

<almost-copy-pasted-part>

Привет! В 22.01.2020 17:35 (Московское время) начнётся Codeforces Round 615 (Div. 3) — очередной Codeforces раунд для третьего дивизиона. В этом раунде будет 6 или 7 задач (или 8), которые подобраны по сложности так, чтобы составить интересное соревнование для участников с рейтингами до 1600. Однако все желающие, чей рейтинг 1600 и выше могут зарегистрироваться на раунд вне конкурса.

Раунд пройдет по правилам образовательных раундов. Таким образом, во время раунда задачи будут тестироваться на предварительных тестах, а после раунда будет 12-ти часовая фаза открытых взломов. Я постарался сделать приличные тесты — так же как и вы буду расстроен, если у многих попадают решения после окончания контеста.

Вам будет предложено 6 или 7 (или 8) задач и 2 часа на их решение.

Штраф за неверную попытку в этом раунде (и последующих Div. 3 раундах) будет равняться 10 минутам.

Напоминаем, что в таблицу официальных результатов попадут только достоверные участники третьего дивизиона. Как написано по ссылке — это вынужденная мера для борьбы с неспортивным поведением. Для квалификации в качестве достоверного участника третьего дивизиона надо:

  • принять участие не менее чем в двух рейтинговых раундах (и решить в каждом из них хотя бы одну задачу),
  • не иметь в рейтинге точку 1900 или выше.

Независимо от того являетесь вы достоверными участниками третьего дивизиона или нет, если ваш рейтинг менее 1600, то раунд для вас будет рейтинговым.

Спасибо MikeMirzayanov за платформы, помощь с идеями для задач и координацию моей работы. Спасибо моим очень хорошим друзьям Дарье nooinenoojno Степановой, Михаилу awoo Пикляеву, Максиму Neon Мещерякову и Ивану BledDest Андросову за помощь в подготовке и тестирование раунда.

Удачи!

Также хочу сказать, что участники, намеренно отправляющие неверные решения и взламывающие их после окончания соревнования (пример), не будут показаны в таблице лидеров по взломам.

</almost-copy-pasted-part>

А еще у нас есть необычная, но приятная новость! Слово нашим друзьям и партнёрам из Harbour.Space:

Hello Muscat

Привет Codeforces!

В качестве специального приза за Codeforces Round #615 мы разыграем три бесплатных участия в Hello Muscat ICPC Programming Bootcamp, который состоится 19-25 марта (Оман) — полное покрытие оргвзноса, проживания и питания по системе «полупансион» на весь период учебного лагеря (но без перелёта). Путевки будут предложены топ-3 участникам, кто заполнил форму и соответствует условиям.

Условия:

  • Участие не менее чем в 10 рейтинговых раундах на Codeforces.
  • Максимальный рейтинг меньше 1900.
  • Еще имеете право принимать участие в ICPC и/или IOI.
Заполнить форму→

Таким образом, некоторые неофициальные участники раунда тоже участвуют в розыгрыше этого приза (если удовлетворяют ограничениям).

Всем удачи!

UPD: Хочу поблагодарить Артема Rox Плоткина и Дмитрия _overrated_ Умнова за неоценимую помощь в подготовке этого раунда!

UPD2: Разбор опубликован!

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

»
4 года назад, # |
  Проголосовать: нравится -33 Проголосовать: не нравится

First comment!!

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

**hope i will be cyan after contest **

»
4 года назад, # |
Rev. 3   Проголосовать: нравится -13 Проголосовать: не нравится

Queueeeeeeeeeeeee.

»
4 года назад, # |
  Проголосовать: нравится -12 Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится +51 Проголосовать: не нравится

codeforces: Div.3 contest
me: Let's get a speed performance check.

»
4 года назад, # |
  Проголосовать: нравится +24 Проголосовать: не нравится

Why is vovuh always in the makers of div3 rounds(This does not happen in div 2 rounds).

No complains, just curiosity.

»
4 года назад, # |
  Проголосовать: нравится -7 Проголосовать: не нравится

Why someone sumbit a wrong solution on purpose then hack his solution ?

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

Again into the ashes

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

I think smarter requirements are needed for prizes in order to get rid of smurfing.

»
4 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

15000 participants but 100 upvotes?

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

Hope to become cyan. Hey rising_from_the_ashes! I felt in love with your handle!

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

    Thank you

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

    I hope to become blue idk how the scoring works

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

      hey, you can install its browser extension so that u will get an estimate that ur rating is going to change by how much

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

        I think I will just wait to see what happens. Though the site is very unstable currently (last round only took 2 hours for ratings to change)

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

          The site's not unstable, this round has a hacking phase that goes on for 12 hours after the contest. As successful hacks can change the results, standings are subject to change during the phase, and thus rating is not updated because rankings can change. Rating will update (relatively) shortly after the phase ends.

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

Want to become cyan after this round.

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

Guys! please answer me. How to tag someone by its handle in codeforces?

»
4 года назад, # |
  Проголосовать: нравится +36 Проголосовать: не нравится

3bmcws.

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

Why i can't register now?

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

Why i can't register now?

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

Long Queue!

»
4 года назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

Please do something about the long queue time. Thank you!

»
4 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

Queueforces!!!

»
4 года назад, # |
  Проголосовать: нравится +63 Проголосовать: не нравится

»
4 года назад, # |
Rev. 5   Проголосовать: нравится -28 Проголосовать: не нравится

{Deleted}

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

    There is no reason to kill yourself right now because of some computer not working properly, you will die somewhen anyway

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

anybody know how to solve E ?

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится -8 Проголосовать: не нравится

    solve each column seperately. calculate how many steps of move 1 if you do k steps of move 2

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

    Solve for each column independently. For each shift $$$0 \le s \lt n$$$, count how many numbers will match their intended positions after shifting (let it be $$$f_i$$$ for a shift by $$$i$$$).

    Hint

    Then, for a fixed column, the answer is the minimum over all $$$n - f_i + i$$$, and the total answer is the sum of those.

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

How to solve C ?

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

    Get all prime divisors of the given number. To calculate first number Fix the first number as the very first prime number.

    To calculate second number: Start multiplying from next prime number onwards until the product becomes greater than first number.

    To calculate third number: Product of all the remaining prime numbers.

  • »
    »
    4 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +6 Проголосовать: не нравится

    Find all divisors of n.

    Than brute over all pairs of divisors and let that number be a, b.

    Than c = n/(a*b); if c is not divisible by that multiplication than don't select this pair. else you have found your answer.

    My Submission

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

      How your brute force pass?

      what is the maximum number of divisors a number has?

      I think it will be sqrt(n). Then how your solution pass.?

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

        no, it is cube_sqrt(n)

        see this: https://codeforces.com/blog/entry/651

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

        Any number less than $$$10^9$$$ has not more than $$$1344$$$ divisors, with $$$735134400$$$ having exactly that many. Actually, it is reasonable to estimate the number of divisors as $$$\sqrt[3]n$$$ for small numbers (even though it asymptotically grows slower than any polynomial).

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

    Simple and clear solution in 3 steps :
    1. find all divisors of n greater than or equal to 2.
    2. brute force the divisors using 3 loops and check whether you can get those 3 numbers say a,b,c such that a*b*c ==n and a!=b && b!=c && a!=c .If you got these 3 numbers then flag = true and break from all three loops.
    3.If flag is true then print yes and a,b,c else print no . for further reference see my code by clicking on C.cpp : C.cpp

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

    Greedy approach; let sq = sqrt(n) iterate i from 2 to sq, if n is divisible by i, store i in vector then divide n by i. Outside loop,if the vector size is 2 while looping, instantly break. if vector size < 2, print false. Else check if n(after loop) is not equal to numbers we push to vector and not equal to 1. If false then no, or else the answer is 2 numbers in vector and n that we get after looped.69322228

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

How do you lock your submission? I could not see the lock icon anywhere on the dashboard for the problems I solved.

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

    Submissions ran on system tests directly, so there are not pretests and options related to, like hacks and locking problem

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

how many number of divisors number has in problem c. In worst case.

»
4 года назад, # |
  Проголосовать: нравится -24 Проголосовать: не нравится

А кому в голову пришла замечательная идея запихнуть воостановление ответа в последнюю задачу?)

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

My approach for E: Process each column separately .For every column calculate cost for every possible rotation. For calculating the cost of every rotation loop through every value and find out for which rotation this element is at its correct position,and decrement the required no. of operation for that particular rotation by 1 .Choose rotation which require minimum operations .

»
4 года назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Thanks for the contest!

»
4 года назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

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

Can someone help me understand where I went wrong in Problem C. My Solution Thanks in advance

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

How to solve D?

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

    I use std::set to matain the answer, and the code is pretty short and clear, here's my submission:69350130.

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

    even shorter code by maintaining the count of remainders

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

    Maintain array $$$B$$$, indexed from $$$[0, x)$$$. Initially, $$$B[i] = i$$$.

    For each query, do $$$B[y_j \text{ mod } x] \text{ += } x$$$. The answer after each query is the minimum value of $$$B$$$; however finding the minimum naively would be too slow ($$$O(qx)$$$ over all queries). We could use a segment tree, or even just an ordered set (for each query, remove $$$B[i]$$$ from the set, update $$$B[i]$$$, then add it back to the set. $$$B$$$'s values would always be distinct), to reduce it to $$$O((x + q) \log x)$$$, which should pass. Do be careful about overflow; either use 64-bit integers or stop updating an index if it exceeds a threshold $$$> q$$$.

    This works because it is always optimal to change each $$$y_j$$$ to the minimum possible non-negative value not already in $$$A$$$ (the array in the problem description), and $$$B[i]$$$ represents the minimum non-negative value $$$b$$$ where $$$b \text{ mod } x = i$$$ and $$$b \notin A$$$.

»
4 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

How to solve D?

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

    The question becomes easy when you observe that a number when added to x or subtracted to x, it's modulo w.r.t 'x' remains the same.

    Now, you just need to maintain precomputed of first % 'x' numbers, i.e from 0 to x — 1.Let's say this array as 'a'. Now, whenever a number comes. Find its modulo w.r.t 'x', and maintain a map or set, to check whether that number has come before.

    if you use this number, let's say y. then increase that number in your precomputed array i.e a[y] += x.

    Why? Because whenever a number will come, it will be holding place for next place of that modulo multiplicity.

    I tried my best to explain to you. Take a look at my submission, you will get more idea.

    My Submission

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

How to try on the hack? Its showing Illegal contest ID on clicking on 'Hack it!'

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится -8 Проголосовать: не нравится

    I think there's no hacking phase. 'cause the solutions ran on system tests directly, and not pretests

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

    to hack in div 3 open the solution of whom you want to hack and on the top right by clicking on "hack it" you will be directed to test case window where you can put the hack test case.

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

when will editorial come

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

Who can explain to me why in my solution to Problem D I have to use long long.

the code:https://codeforces.com/contest/1294/submission/69352519

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

Where it is mentioned in problem D that we can increase or decrease one element in an operation more than once?? I mean a[i]-m*x or a[i]+m*x is possible for m>1 also in one single operation????

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

Very similar to Problem F ?

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

In problem F, what is wrong with this approach?. First, I find a diameter and take a and b as the ends of that diameter. Then I ban every edge that appears between a and b creating a new graph, and then I run DFS from every vertex between a and b. Finally I take c as the one whose depth is higher (depth 0 is also considered, in that case c is between a and b). This was my submission.

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

Hacks for C?

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

In problem F, what is wrong with this approach? First, I find a diameter and choose a and b as the ends of that diameter. Then, I banned every edge between a and b and create the new graph. After that, I run DFS from every vertex between a and b. Finally, I choose c as the vertex whose depth is higher (depth 0 is also considered, in that case c is between a and b). This was my submission.

  • »
    »
    4 года назад, # ^ |
      Проголосовать: нравится -6 Проголосовать: не нравится

    I didnt read your code but your approach is O(n^2) you can simply do a multisource bfs.

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

      Once I have erased the edges between the nodes in the diameter, I have a forest in which I have a tree rooted on each node and running DFS from them is O(V + E)

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

      Can you please explain your Multi-Source BFS Approach ?

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

        Its also basically the bfs, but initially in queue you have to put all the nodes whose distance is initially 0, also make their distance 0 initially. Now in the while loop instead of queue having a single node it will have many nodes with distances 0. The time complexity is same since it traverses whole graph, maintaining correct distances i.e O(V+E) .

        Now in this particular question after finding the diameter ends,for all the nodes in their path make their distance 0, and run multi-sources bfs to get the third node which is farthest from the path.

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

    TRY this case:

    12 11

    1 2

    2 3

    3 4

    1 5

    5 6

    6 7

    1 8

    8 9

    9 10

    8 11

    8 12

    I think the answer is 9 but your approach will give 10.

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

      please ignore. my bad. your approach will also give 9

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

        Don't worry, thanks. I got AC. The approach was right, I had a bug of using the name of the variable temp instead of diameter in my loop.

»
4 года назад, # |
  Проголосовать: нравится -10 Проголосовать: не нравится

69357392 I know my code is not that clean, but please check it for my bug on B!

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

In problem D, what does "in one move" mean? It means increase or decrease any element of the array only one time or any? I asked my friend after contest, he said any. Did i forgot something?

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

    One move means increase/decrease one element once, but since they give you unlimited moves, you in effect can do unlimited increases/decreases.

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

Approach for D?

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

    simplest way I can think to explain D

    #include<bits/stdc++.h>
    #include <utility>
    using namespace std;
    typedef long long int ll;
    
    int main()
    {
     ll q,x,i,j,k,l,m,o,p,t;
     cin>>t>>x;
     set<pair<ll,ll>> se;
      for(i=0;i<x;i++)
      {
          se.insert(make_pair(0,i));
      }
      map<ll,ll> mp;
      while(t--)
      {
          cin>>i;
          l=mp[i%x];
    
          se.erase(make_pair(l,i%x));
          mp[i%x]++;
          se.insert(make_pair(mp[i%x],i%x));
        //  cout<<(*(se.begin())).first<<(*se.begin()).second<<"dekh le\n";
          cout<<x*(*(se.begin())).first+(*se.begin()).second<<endl;
      }
    }
    
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I really liked this Div 3 round. Especially how Mathematical C and D were. And that there were only 6 distinct problems.

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

Is there anyone else with E failing on Test 8 ?

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

how to solve E? I heard that it is greedy, but i can't understand. Why greedy works? :(

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

    while traversing in each column(say j), if any element(x) is found which belong to column j in the final matrix. Then find no of moves required in the cyclic shift of this column so that x reaches to its correct position.

    Maintain a map[mv,fre]

    mv: no of moves required so that x reaches to its correct position in the cyclic shift.

    fre: frequency of such elements which reaches to its correct position after mv moves in the cyclic shift.

    Now, for each column min no of moves required(say min_col) is the n-max(difference between freq and mv). So the ans is sum of all min_col

    For better understanding have a look

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

can somebody help me with the testcase on which my soln is failing

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

hello all. My code for problem C gives the wrong answer on test case #2. Here is what I am doing: a) Find the "first" divisor of n greater than equal to 2. b) Find the "second" divisor which is not equal to the first divisor if possible. c) If possible then check if n/(first*second) is >= 2. d) If not possible then there is only one divisor >= 2 of n except itself. Then choose "second" = (first*first) and check if triplet is possible.

Please Help!![submission:69361400]

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

    Sure, try $$$100$$$ as test case. According to your code, your first divisor is $$$2$$$ and the second one is $$$4$$$, so you check if $$$4$$$ divides $$$50$$$ and that gives you NO, you should choose a divisor after extracting the previous one. Also, your code is $$$O(t*n)$$$ and $$$n \leq 10^9$$$ and $$$t \leq 100$$$, so it will give you TLE.

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

what is the hack for C ?

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

    Idk, but maybe it's due to the timeout since most of the hacked code got over 1900ms...

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

How to solve F with dp?

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

    Let $$$dp(v, i)$$$ be the maximum number of edges between chosen vertexes in the subtree of vertex $$$v$$$ if we took $$$i$$$ vertexes in this subtree($$$0 \le i \le 3$$$). To calculate it use another dp — $$$f(i, j)$$$ means we are currently on the $$$i$$$-th child of current vertex and took $$$j$$$ vertexes. Then iterate over childs of current vertex $$$v$$$, suppose we are on $$$i$$$-th child, iterate on how many vertexes we took from the previous childs, let it be $$$prev$$$, iterate on how many vertexes we take from the current child $$$u$$$, let it be $$$cur$$$, and let $$$cost$$$ be $$$1$$$ if $$$cur = 1$$$ or $$$cur = 2$$$ (in this case we will count edge from $$$v$$$ to $$$u$$$) otherwise $$$0$$$. Then update $$$f(i, prev + cur)$$$ with $$$f(i - 1, prev) + dp(u, cur) + cost$$$. In the end update $$$dp(v)$$$ with the help of $$$f$$$ and don't forget the possibilty to take vertex $$$v$$$.

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

      I think there is something wrong with calculating cost because why should we always pick vertex v? Our dp state was that the maximum number of edges if we pick j vertex from the vertex I subtree(not necessarily including i) what I am missing?

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

        We shouldn't always pick vertex v. But in any case if we took one or two vertexes in subtree of u we will count edge from v to u because it will lie on the path from some pair of chosen vertexes(because we will take at least one vertex out of subtree of u).

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

What is test case 8 in E??

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

hi guys can anyone tall me how to solve C? I don't understand why it always is optimal to try first divisor of n

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

    find all prime factors with their respective powers in sqrt(n) time then check three cases case 1. no. of prime factors are more than3 answer always exist and it is any combination you can pick up then

    case 2 only 2 prime factors but their total power is greater than or equal to 4 then answer exist else no. (a,b,a^x*b^y)

    case 3 only 1 prime factor available then check if its power>=6 (a,a^2 a^3) then answer always exist else no.

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

      I also wrote my solution based on same logic, except that I was considering for case 2 that the sum of powers should be greater than equal to 3

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

    We just need to find 2 different divisors such that one of them is a composite one with again 2 different divisors and also you need to check that they are greater 1.

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

    hmmmm you can list all of divisors of N, the max numbers of divisor of N is 100 (if N == 1e9) so you can use O(N^3), right? Use 3 loops and check every divisor by conditions of problem

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

      Not exactly n³ because no. Of divisors are way to less for numbers <= 1e9.Its not 100 but around 1700-1900 i guess

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

        you can check it! numbers of divisors of 1e9 is 100, I tried it before I wrote my solution

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

          Any number less than 1e9 has not more than 1344 divisors, with 735134400 having exactly that many. Actually, it is reasonable to estimate the number of divisors as cbroot n for small numbers (even though it asymptotically grows slower than any polynomial).

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

Guys, I am confused about the Problem D. In the example it states that: "After the fourth query, the array is a=[0,1,2,2]: you don't need to perform any operations, maximum possible MEX is 3 (you can't make it greater with operations)." __ However, if we add one to the last element will get a=[0,1,2,3] which I think has a MEX of 4. Can someone explain me why adding one to the last element does not improve the MEX?

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

    You can add only number x. In this testcase x equals to 3, so u cant add 1, u can add only 3 as many times as you want

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

Whats testcase 3 of problem F?

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

    This testcase worked for me:

    Input
    Output
»
4 года назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

No hacking in this Round? I am getting Illegal contest ID.

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

any idea to solve problm D please ?

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

When the ratings will be updated?-

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

Whoops, looks like I submitted a solution for 1294E - Obtain a Permutation that has an error in it not covered by the testing suite, but it's too late to hack it: 69397747

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

I think I am the only one who solved C via Miller-Rabin.

It proves that it is no use to think the problems as too difficulty in div3 rounds

»
4 года назад, # |
  Проголосовать: нравится -7 Проголосовать: не нравится

I have created the video solution for the first four problems, explaining my understanding and approach for the same. Codeforces 615 DIv3 Video editorials

Do like comment, share, subscribe if you like the video. Do subscribe for more such content

Happy Coding

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

I think your test cases for 1294E - Obtain a Permutation is too weak. 69353056 Shows: Output: 0 For Input: 4 4 5 2 3 4 Where the actual result is: 1

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

Huge gap between next contest....... Please decrease the gap

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

For problem E, I misread that each element of given matrix was an integer between 1 and "n * m". Today, I figured out that "n * m" transforms into some digits numbers. TT

»
4 года назад, # |
  Проголосовать: нравится -11 Проголосовать: не нравится

Hi dear,

I participated in Codeforces Round #615 (Div. 3) with my 2 personal handle (7ouda,7ooda) and submitted same solutions so my submissions was skipped, and I didn't know that it's a rules violation, so please can you help me.

Thanks, Mahmoud.