Автор awoo, история, 6 лет назад, По-русски

Привет, Codeforces!

В 23.03.2020 17:35 (Московское время) состоится Educational Codeforces Round 84 (рейтинговый для Див. 2).

Продолжается серия образовательных раундов в рамках инициативы Harbour.Space University! Подробности о сотрудничестве Harbour.Space University и Codeforces можно прочитать в посте.

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Роман Roms Глазов, Адилбек adedalic Далабаев, Владимир vovuh Петров, Иван BledDest Андросов и Максим Neon Мещеряков. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Удачи в раунде! Успешных решений!

Поздравляем победителей:

Место Участник Задач решено Штраф
1 EvenImage 7 230
2 Volkov_Ivan 7 272
3 Egor 7 343
4 2829908231 7 360
5 rainboy 7 707

Поздравляем лучших взломщиков:

Место Участник Число взломов
1 atakanysr 14:-8
2 Chrollo_Lucifer 5:-1
3 Learner 10:-13
4 RitikBaid 3
5 Ashiok 4:-3
Было сделано 139 успешных и 617 неудачных взломов.

И, наконец, поздравляем людей, отправивших первое полное решение по задаче:

Задача Участник Штраф
A fextivity 0:01
B Sonechko 0:05
C Isaunoya 0:05
D EvenImage 0:10
E AntiBsayer 0:11
F YangDavid 0:35
G rainboy 0:44

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

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

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

good luck :D

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

My Last contest the first time i solve two problems , and i solved them in less than 30 minutes, this contest i will solve at least three problems insha' allah :), Good Luck for all :).

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

Haven't participated an educational round properly before. Can someone tell me if the hacks are accounted in ranking?

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

AHH forget about what I said :)))

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

Educational codeforces rounds are a great harbour space initiative. The last educational codeforces round had easy A B and C questions but D and E were really really great for learning. Hope to learn a lot from this contest as well.

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

I hope the tasks will be interesting.

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

I just hope this round will have strong pretests. :D

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

Всем удачи ! Я желаю вам всем занимать самые высокие места.

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

I will Focus now

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

Teachers say that we loose our time in quarantine and we are doing nothing. LOOK TEACHERS... WE ARE GETTING EDUCATED

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

Thank you for giving the exact number of problems.

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

We need more contests during the quarantine please! When will we have a contest about Coronavirus?)

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

Hello, I am actually slow at solving the initial problems(but i solve them) and not able to solve the tougher ones. So basically the rating never increases. So what should be done ? Thanks.

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

Can someone explain me the difference between education codeforces round and normal div2 rounds . TIA

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

    Two biggest differences are the 12 hour open hacking phase and the score distribution (every problem carries the same weight in educational rounds).

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

    Compared with normal rounds, edu(educational) round don't have a "score distribution"

    Only two factors affect the ranking:"Problem solved" and "Penalty"

    That means, solving 2 problems is always better than solving 1 problem

    However, in normal rounds, problem F worths more points than problem A+B

    • Hacks:

    1.In the normal rounds,you can only hack if following conditions hold:

    • You solved the problem,and you locked it

    • The victim and you are in the same room

    • The contest is not ended yet

    However, in edu rounds, you can hack anyone in the open-hack phase(even if you didn't participate the contest), and you don't need to solve the problem."Room" doesn't exist in edu rounds.

    2.In edu rounds, you can copy the code and test it locally, which means you can preview whether or not the solution will fail.

    However, in normal rounds, it's forbidden to copy the code.

    3.In normal rounds,a successful hack gives you 100 points and an unsuccessful cost you 50 points.

    In edu rounds, hacks changes nothing to your penalty. The only difference is the victim loses a problem

    • System test:

    In normal rounds, system test begins shortly after the contest.All solution will be rejudged with pretests, maintests prepared by authors and successful hacks, if there are.

    In edu rounds, system test begins after the open-hack phase. All solution will be rejudged by pretests and successful hacks.There's no "maintest"

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

These days we need more and more contests :'D

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

Hope to learn something new and solve 3 or more question this time. . .

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

Please... make strong Pretest Cases!!

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

I really pray for the load on the server as all college students of India are at home and they have nothing to do so expecting mass participation today.

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

I really wish a color change this time!

Fingers crossed! All the best everyone.

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

My first unofficial Div.2

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

Only exciting thing to engage me, during this quarantine.

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

The biggest mistake of mine is not continuous in every codeforces contest...I request all of you those who are low rated do more and more contest & upsolve,,

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

Screenshot_2020-03-23-Harbour-Space---Codeforces.png

Hoping for strong pretest this time.

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

.

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

I remember that the number of problem was 6 at first. Is the purpose of extra problem to reduce difficulty gap, or is there some other purpose?

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

contest and chill

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

17k+ registration Going to be 18k soom Is it effect corona? I hope corona can't attack anyone on other way.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +66 Проголосовать: не нравится
  • Monday
  • Educational
  • 18k participants
»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +12 Проголосовать: не нравится

18584 registrations! Still increasing!! All the best everyone!!!

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

The server is gonna explode. 18K registration O_O

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

It's about time. Good luck everyone

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

I think that someone should stop coming up with problems

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

Спасибо awoo за его прекрасные задачи. Поскорей бы следующий educational ...

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

WrongAnswerforces

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

The statement of Problem C and E is poor. Is there a reason U / D operation changes x coordinate and L / R operation changes y coordinate in problem C, not U / D changes y and L / R changes x?

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

So, how to solve F? Is it inclusion-exclusion on each bit separately?

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

    Solve for each bit separately, multiply results.

    To solve for one bit, I did a linear DP setting 0s from left to right and counting ways to do so.

    Essentially you only have two restrictions to deal with:

    • First of all, for given position P you can't put 0 there if it is a part of some 1-segment.
    • In case you decide to put 0 there, the previous 0 can't be too far to the left so you don't have some 0-segment being completely between those two 0s.
  • »
    »
    6 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +59 Проголосовать: не нравится

    No inclusion-exclusion, but let's look at each bit separately.

    Consider some fixed bit, we have some ranges $$$l \ldots r$$$ where this bit must be constantly 1 and some other ranges where this bit must have at least one zero. Let's delete the ranges of the first type and shrink the array. Now we have some ranges and in each range we must have at least one zero (if some of these ranges became empty after the shrink, answer to the problem is 0).

    Now let $$$\mathrm{dp}[k]$$$ be the number of ways to fill the array up to $$$k$$$ such that there is a zero at $$$k$$$ and all the constraints that have the right endpoint $$$ \lt k$$$ are satisfied.

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

      Could you explain a sketch of a linear time DP?

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

        Let $$$dp[i]$$$ be the number of ways to fill up the array up to position $$$i$$$ with a $$$0$$$ at position $$$i$$$. If we're in a segment where only $$$1$$$s are allowed, then $$$dp[i] = 0$$$ (you can't set a $$$0$$$ there).

        Otherwise let $$$l_i$$$ be the rightmost starting point of the segments with ending points $$$ \lt i$$$. We now know that we need to put a zero somewhere between $$$l_i$$$ and $$$i - 1$$$, inclusive (otherwise there is no $$$0$$$ in said segment). This $$$l_i$$$ can be kept updated with proper bookkeeping. Since there are no other restrictions, we can set the zero anywhere between $$$l_i$$$ and $$$i - 1$$$, inclusive. This gives us:

        $$$dp[i] = \sum_{k=l_i}^{i - 1} dp[k]$$$

        We can calculate this sum in $$$\mathcal O(1)$$$ if we build a prefix-sum structure while calculating our dp. To get the result, we can just imagine counting the number of arrays of size $$$n + 1$$$ which end on a $$$0$$$. This gives us a total running time of $$$\mathcal O(k(n + m))$$$ which gives AC. Maybe there is a simpler solution than mine, but I hope, this already helps.

        Edit: Here is a link to my submission, maybe it helps to understand: https://mirror.codeforces.com/contest/1327/submission/74120243

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

          "let li be the rightmost starting point of the segments with ending points <i. We now know that we need to put a zero somewhere between li and i−1, inclusive (otherwise there is no 0 in said segment)."
          Shouldn't we put a zero somewhere between li and ri (where ri is the right border of the segment whose left border is li), instead of between li and i-1?

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

            We're only talking about the last $$$0$$$ before $$$i$$$. If we put the last $$$0$$$ at $$$i - 1$$$ for example, we can then look where we placed the last $$$0$$$ before $$$i - 1$$$. Either it's between $$$l_i$$$ and $$$r_i$$$, or afterwards. But even if it is afterwards, we slowly but steadily get closer to $$$r_i$$$ and when we're at $$$i = r_i + 1$$$, then we have no other option then putting it inside $$$l_i$$$ and $$$r_i$$$. In either way, we have put a $$$0$$$ inside $$$l_i$$$ and $$$r_i$$$.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
Why my code for E is wrong
»
6 лет назад, скрыть # |
Rev. 6  
Проголосовать: нравится +11 Проголосовать: не нравится

How to solve E :<

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

    I had a multiplication instead an addition and unfortunately I solved the problem 5 minutes after the contest ended.

    It is a combinatorial problem.

    Let's say we want to find the answer for block_size = i. This block will contain the same digits (lets name them with letter "a"). Because block_size can't be larger we want the adjacent digits to be different (lets name them with letter "b"). Now the picture is this: xxxbaa...aabxxx (x are the empty cells for now) You can have 10 possible values for "a". Total ways for a and b are 10 * 9. The rest cells can be anything, so we have 10^(N-i-2) ways to set them a value. Now for that fixed picture, ways are equal to 10 * 9 * 10^(N-i-2). But in how many ways we can fix a block of size "i" having two adjacent empty cells ? This can be done in N — i — 1 ways, so we multiply by that as well. Finally we need to add up (this is where I used multiplication by accident) the corner case where we have only one adjacent cell.

    Here is my source-code: https://mirror.codeforces.com/contest/1327/submission/74125507

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

    I used dynamic programming.

    First, let's consider a block of size n. Then there will only be 10 ways to fit them. I will represent the block as X.

    • X (10)

    Then, if we consider a block of size n-1, There will be 180 ways to fit them.

    • X? (10 * 9) 9 -> because it cannot be the same as X
    • ?X (90)

    Then, n-2, there are 2610 ways

    • X?? (90 * 10) X? + ?
    • ?X? (90 * 9) ?X + ?
    • ??X (900)

    You can see that the configuration ending with ? can be computed from the previous block size and the configuration ending with X can be computed naively.

    So, here is the dp.

    $$$dp_{n, s} = \begin{matrix} 10 * dp_{n+1, 0} + 9 * dp_{n+1, 1} & if : s=0\\ 10 * dp_{n+1, 1} & if : s=1 \end{matrix}$$$

    s = 0 is for configurations ending with ?, and s = 1 is for configurations ending with X.

    This doesn't work specifically for n-1, because the first ? (for ?X) is counted as 9 instead of 10, so make that a base case and use the dp starting for n-2.

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

    we could use FFT to solve this problem let f be [1,9,90,900...],and g=f*f,then 10*g[n-i] will be the answer for the i th term

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

In problem B, I thought that maybe it's better to use the word index rather than number. I misunderstand the word number as count.

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

if the contest was 2:15 or 2:30 min, then it might be better(since there was 7 qns). Anyhow nice problems.

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

How to solve D?

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

    If you draw a directed graph with edges $$$(v, p_v)$$$, then each its component will contain one cycle. When we raise our permutation to the power $$$k$$$, an edge from $$$v$$$ will start pointing at a vertex $$$k$$$ steps away. The initial permutation is OK if and only if we have a unicolored loop.

    Now, note that, for some loop of length $$$L$$$, if we raise our permutation to the power $$$m$$$ that $$$gcd(L, m) = G \ne 1$$$, we will be able to jump along this loop in such a way that we will only visit every $$$G$$$-th vertex, which reduces the number of vertices in our path and, hopefully, makes it unicolored.

    For example, if we have a loop of length $$$36$$$ and raise our permutation to the power $$$9$$$, then, starting at $$$s$$$, we will visit only $$$(s + 9k) \mod 36$$$-th vertices of a loop. Our big loop as though breaks into $$$9$$$ small loops of length $$$4$$$. We can travel along each of them and check if any one becomes unicolored.

    Now do it for every divisor of the length (since GCD of $$$k$$$ and some other number can be only a divisor of $$$k$$$) of every loop found. It wiil not TL as the number of divisors of a number less than $$$2 \cdot 10^5$$$ doesn't exceed $$$200$$$, and each such procedure takes linear time.

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

    You do not need graph theory at all. Each permutation is the product of cycles. https://en.wikipedia.org/wiki/Cyclic_permutation

    In each cycle a permutation p^k is like stepping through the cycle k times. So we need to find minimum k so that we start somewhere in the cycle, step by k while maintaining a color (looping around if needed), and eventually returning to our starting point.

    For the last example our cycles are (1 7 3 5) (2 4 6 8). Our cycle colors are (5 8 6 7) (3 4 5 4).

    In this case we only consider k that divides cycle length C. To see why consider repeatedly adding k mod C which is what we are doing. We end up stepping through all multiples of gcd(k,C). This gcd is less than k if k does not divide C so k was not optimal.

    In general we have [Lagrange's Theorem](https://en.wikipedia.org/wiki/Lagrange%27s_theorem_(group_theory)) For this case we consider (cyclic) subgroups of cyclic groups (one for each cycle).

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

How to do C?

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

Since recent previous contests had the first question based on parity, I could only think the solution based only parity. How the hell do you solve question-A?

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

Today's problem E

One can write a simple bruteforce for n = 5 and find this trivially.

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

Well done every one :D. Thanks for a nice contest(even though my rating drop :( )

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

How the hell do you solve A????

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

I would like to thank the authors for allowing me to use BM. https://mirror.codeforces.com/contest/1327/submission/74109025

Source — https://mirror.codeforces.com/blog/entry/61306

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

What should the answer be to this test case in D: n=3 , P = [3,1,2] ,C=[1,2,3]? There does not exist any k for this case right?

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

Amazing: 20000+ registered users for this round!

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

E is much easier than D?  I solved E even earlier than B.

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

    I spend lot of time on E, thinking of things like multinomials, but that would straight up blow the complexity. Also tried generating function, but gave up. Can you give a hint? Thanks!

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

      If a block has a size of i:

      There are 10 plans for all numbers in the block, 9 plans for each number adjacent to the block, 10 plans for each number not adjacent to the block.

      Then just discuss:

      The block includes both the first and last element.

      The block includes either of the first and last element.

      The block includes neither of the first and last element.

      Here is my submission.

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

        Oh now I feel it is easy! Thank you, clearly explained!

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

        I was doing the exact same thing, but don't know for what god-damn reason I gave up :(

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

        Say for example n=4, and we have to find the answer for block size = 2;

        Now _ _ _ _, I fill the second and third places with any number. 10 ways to do it. I fill the first and last place with any number other than the one I placed on second and third : 81 ways to do that.

        Total ways = 810.

        Now, _ _ _ _ I fill the (first and second) or (third and fourth) place with any number. 10 ways to do it The Remaining places can be filled with 9*10 = 90 ways. Total ways = 810 + (90*2*10) = 2610.

        Now my question is that, when I calculate it this way, Am I not repeating the same cases? For example, _ _ _ _ I fill the first 2 places with a two. then randomly the second and third place get a 3. the number is 2233. OR I fill the last 2 places with a 3, and then randomly fill the first 2 places with a 2. I end up getting 2233.

        These are the same cases. Dont we end up recalculating them? JKLover

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

      There is a common idea behind tasks like this on Codeforces.

      1. Write bruteforce
      2. Look on some first answers
      3. Try to transform them (like in this task divide all answers by 10)
      4. Try to find this sequence on OEIS.
      5. ???
      6. Profit!

      In example, there is this sequence for today's E

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

    Really? B was just a comprehension question. Masked in an annoyingly huge statement, was the real problem: perform the greedy mapping as described, and just check at the end if any princess and kingdom pair is unassigned. Implementation is trivial.

    E was not easy at all. The only reason I solved E is because I wrote a brute-force and observed the pattern for small values. I still have no idea why the pattern is there.

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

      I mean that E is easier than D.

      I agree with you,E is exactly more difficult than B.

      I solved E earlier than B just due to my mistake in conprehension.

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

      problem E can be solved in many different ways (including OEIS cough cough), and so I think it's significantly easier than D.

      But D doesn't require any algorithms, just an understanding of why it works in time limit. That might be why it's supposed to be easier than E.

      Whatever... I demand D and E to be swapped

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

    literally took two hours to solve D :D

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

I don't know why but my rating decreases in every Educational Round...Get educated....

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

What is the time complexity for D? I believe most submissions had O(n x logn x sqrt(n) [all divisors]). How could it pass?

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

How to solve C if we are required to minimize the number of operations ?

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

Why does this code give Runtime Error on Test 1?

https://mirror.codeforces.com/contest/1327/submission/74124335

It works on my machine and I couldn't find any source of undefined behavior in the code.

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


Wow! first time I see this number.

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

Hey guys, can anybody explain how to solve E? Thanks

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

    Refer this comment by JKLover : Link

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

    Consider a block of length $$$i$$$ ($$$i$$$ goes from $$$1$$$ to $$$(n-1))$$$. We can have $$$(n - i + 1)$$$ such blocks. Let the digit placed in the entire block be $$$k$$$. For every block, the immediate left and right digits surrounding the block can contain all digits except $$$k$$$, otherwise the length of the current block will change. Therefore, for these left and right places we have $$$9$$$ possible digits and for all remaining places we have $$$10$$$ possible digits. We need to handle two cases :

    Case 1 : The blocks of the kind $$$0...(i-1)$$$ and $$$(n-i)...(n-1)$$$ have only one surrounding digit in each, $$$(i)th$$$ and $$$(n-i-1)th$$$ respectively where we can place $$$9$$$ digits.

    Number of remaining places with $$$10$$$ possibilities at every place = $$$(n - i - 1)$$$.

    Total possible ways = $$$2$$$ x $$$10^{(n - i - 1)}$$$ x $$$9$$$

    Case 2 : All blocks except the two mentioned in case 1 (there will be $$$(n - i - 1)$$$ such blocks). Each of these blocks has both left and right surrounding digits.

    Number of remaining places = $$$(n - i - 2)$$$.

    Total possible ways = $$$(n - i - 1)$$$ x $$$10^{(n - i - 2)}$$$ x $$$9^2$$$.

    Overall answer for a block of length $$$i$$$ = $$$10 * (Case 1 + Case 2)$$$ (multiplied by 10 since the current answer is just for one possible digit across the entire block).

    Simplifying the expression gives the result = $$$9$$$ x $$$10^{(n - i - 1)}$$$ x $$$(9$$$ x $$$(n - i) + 11)$$$

    For $$$i = n$$$ the answer is simply $$$10$$$

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

      Great explanation. Thank you a lot.

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

      Say for example n=4, and we have to find the answer for block size = 2;

      Now _ _ _ _, I fill the second and third places with any number. 10 ways to do it. I fill the first and last place with any number other than the one I placed on second and third : 81 ways to do that.

      Total ways = 810.

      Now, _ _ _ _ I fill the (first and second) or (third and fourth) place with any number. 10 ways to do it The Remaining places can be filled with 9*10 = 90 ways. Total ways = 810 + (90*2*10) = 2610.

      Now my question is that, when I calculate it this way, Am I not repeating the same cases? For example, _ _ _ _ I fill the first 2 places with a two. then randomly the second and third place get a 3. the number is 2233. OR I fill the last 2 places with a 3, and then randomly fill the first 2 places with a 2. I end up getting 2233.

      These are the same cases. Dont we end up recalculating them? cuber_coder

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

        Yes you are right in your example that you are considering the number 2233 twice but for different block each time. Though the number is same but the interval used for block is different and we are counting number of blocks and not the frequency of number. Moreover it can be clarified from the fact that 2233 is chosen twice as it has 2 blocks 2 length 2. Hence in the given logic for each block length i a number is considered same number of times as the frequency of blocks having length i and same digit.

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

Мне кажется или этот код https://mirror.codeforces.com/contest/1327/submission/74109662 специально написан так, чтобы его смогли взломать? И его действительно взломали. Зачем это?

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

why is everyone in C , computing n times L,m times R, and then in a (n,m)loop D & U ??

whats logic ,and how did you all reached this condition

Are you guys are trying to access all points from most bottom(point) to the highest point, then why not begin() from lowest input point instead of (0,0), else ain't the length of out instruction will increase??

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

20K registration !!...happy quarantine...

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

How to solve G?

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

    You build an Aho-Corasick automaton from the t_i strings and then do a dp over the automaton states and the set of characters you've already used.

    So, for a bitmask m and a Aho-Corasick state s, dp[m][s] would be the highest value attainable using the characters corresponding to the set bits in m for the first popcount(m) question marks, while ending in state s. You'll need to know the cost of all strings ending in a state, which you'll have to propagate along back links. In the transition, you look at all possible characters you could use for the next question mark, and then add the cost of the state you get after using that character, and all the states you visit when adding the fixed characters up to the next question mark (or the end).

    This comes out to $$$O(14 \cdot 2^{14} 10^3 + 4 \cdot 10^8)$$$ which passes in 1.5s/4s for me.

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

    Use Aho–Corasick algorithm to build an automaton.

    Consider dp(automaton node, bitmask of used letter), and there will be up to $$$2^{14} \times 1000$$$ states. We can not use this state to iterator string $$$s$$$.

    But the transition of the dp state between two "?" is only related with automaton node. So between two "?", we only need to preform transition of the automaton node, and when we meet a "?", use the above transition to perform transition of complete dp state (this will only happen up to $$$14$$$ times).

    Sorry for my bad English, and you can see my submission 74095972.

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

Is finding the shortest cycle in the graph with edges between 'i' and 'input[i]' a wrong approach? After this, I considered nodes with the same colour separately like what is the path length between two nodes of same colour that maybe my answer too, took min of all possible answer. Got WA on 2nd test:( is the approach wrong?

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

Any hacks for A ?

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

how do they calculate the penalty in educational rounds?

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

    Summation of total time taken for each problem.

    Suppose you solve problem A in 10mins and Problem B in next 15 mins.

    Then total penalty is (10 + (15 + 10) + extra time penalty for previous wrong submissions) mins

    Or basically just sum up the time shown below your submissions in the ranklist and add extra time penalty for wrong submissions )

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

Statement of D was very confusing is there any sense for using same letter $$$(c)$$$ to denote colors as well as multiplication of permutations?

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

As I know little about replacement I think E is much easier than D...

But I didn't try to solve E on the contest...

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

Problem B: how fast is your reading comprehension

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

Were today's A,B,C easier than usual educational round problems ?

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

A long time ago, I used an extension that computed approximate rating changes before official results were out. Can anyone send link to that?

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

Is this kind of self-hacking allowed? https://mirror.codeforces.com/contest/1327/submission/74121343

It seems kind of obvious and shameful that people would stoop to such low levels. Very disappointed.

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

In Problem D, it says that the answer always exists.

I maybe wrong, but I feel that for this testcase the answer doesn't exist. 1 4 2 1 4 3 4 3 1 2

I don't think an answer exists. because the p^2 = 1234 p^3 = 2143 .......... and so on. We never get an answer here. Please correct me if I am wrong.

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

Bad Day for me. On looking the number of submissions, i thought E is more easier than D but failed to solve E at the time of contest. Later on i found D was more easier for me than E.

Did you guys solved any problem similar to E before??

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

You can try to think about a clever solution for problem E... ooor you can brute force first values and let Berlekamp Massey do its magic finding a linear recurrence that solves the problem without understanding anything of what it is doing: submission :P

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

System showing me a message "illegal id" whenever I try to hack a solution of another guy, can anyone tell me what's the problem here doing that?

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

Why so much delay in the editorial ?

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

Can someone explain the problem statement for D?

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

Can someone explain the problem statement for D?

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

in problem D: for this input: 1 3 2 3 1 1 2 3 I ran it on an accepted solution and it got 3 can anyone please explain to me why?

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

For problem E this can help https://oeis.org/A255380 As in the given link it's for special case 10. we didn't need that , so in the formula just remove a(n-11) that's all.

Overall didn't liked the problem as 'E'.

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

Why there are more participants solved E than D? (;´д`)ゞ

In my opinion, it is better to swap D and E. I managed to solve D but then I did not have enough time to solve E. (Honestly I had. But I just kept making foolish mistakes..) Maybe I should stop to solve E instead of insisting on D as soon as I noticed that fact.

All in all, nice contest! Like it! (*^▽^*)

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

How many people solve problem E with OEIS?

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

Thanks to codeforces for giving us opportunity to participate in too many contests. I have a request. Please make contests more frequent during this hard time.

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

I hope will finally become purple today, thanks for the contest.

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

When rating will be changed?

12 hours hacking phase has been finished.......

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

Can anyone please exaplain me question E??

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

why dafuq does it happen? my sol of A didnt get accepted bcoz the datatype was int and not long long int. Although it was given that the limits were till 10 to the power 7

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

Will there be official Editorial?Thanks.

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

For Problem D, Can somebody help me understand the complexity difference between these solutions?

AC — 74168483

TLE — 74168686

Note: Both of these are my submissions, only difference is in solve function (that iterates over factors and finds the ans)

Edit: Use of unordered_map, map, or any other hash table is slowing the solution by order of 10.

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

    i only noticed the additional logN in the complexity. Maybe that's enough to give TLE.

    But, instead of using map, you can just use an array. And don't do this: st[((k%j)<<30LL)+ v[k]]++;. Just do simple if else. If the current loop is not yet colored (first time getting colored), then color it. If somehow in the middle the color changes, the loop is invalid

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

    $$$len(fac)*(len(v)*log(len(v))+len(fac))$$$ -TLE $$$len(fac)*log(fac)+len(fac)*(sum(fac)*log(len(v))$$$ -AC ($$$log(len(v))$$$ if numbers are distinct in v) I think.

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

When can we see the rating changes ?

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

CF-Rating Predictor showing -5, the rating updated by +5 :P

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

E is quite simple and easy to implement. But how about deleting the ',' (That means the string is like 001002003004...999)? How can this task be solved? Sorry about my poor English and mathematics :(

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

Where is the editorial ?

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

Please upload the editorial!!

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

the announcement "Digits from different numbers don't from blocks", what does that mean? I don't really understand.

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

Can somebody please explain why should the ans for Problem D fot the input test case : 1 4 2 4 1 3 2 1 2 1

is 2 . I am getting 4.

Thanks!!

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

Oooops. Wanted to post this comment under announcement of introducing 64bit system

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

Why does O(N^2) work for DIV2 B ? Can anyone provide a source where I can learn how to estimate the time complexity required properly .... I thought that O(NK) wouldn't work in B because N was given as 2* 10^5 and thus couldn't solve it during the contest. Thanks in advance !

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

Why does O(NK) work for DIV2 B ? Can anyone provide a source where I can learn how to estimate the required time complexity properly ... I thought that O(NK) wouldn't work for B because N was given as 2* 10^5 and K <= N and thus couldn't come up with a solution.

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

    "It's also guaranteed that the total number of kingdoms in lists over all test cases does not exceed 10^5."

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

    It is O(N+sum(g_i)) which is O(N+K), as you do not do K operations N times, you do g_i operations each time.

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

      Thanks for you reply ! I kind of now understand where I went wrong with the calculation. Any source where I can learn how to estimate the required time complexity properly ?

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

        Well, aside from this trick, I don't know what is there to learn. Just maybe try to count number of operations in different ways.

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

I messed up in this round :(

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

is editorial qurantined

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

In B ... can more than one daughter marry same princes...?

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

I want editorial...

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

Auto comment: topic has been updated by awoo (previous revision, new revision, compare).

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

del

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

EDU 84 became invisible from everyone's profile's contest section but ratings still exist. Maybe some updates/changes are coming.

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

Добавьте разбор в материалы соревнования.

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

Can anyone please tell me why this solution of mine wouldn't work? https://mirror.codeforces.com/contest/1327/submission/74190187 I have shifted all pieces first to extreme right, then extreme down. After that I have traversed all blocks in the matrix one by one.

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