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

Привет, Codeforces!

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

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

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

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

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

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

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

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

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

Educational rounds are the best always good problems with good ideas

Good luck everyone and happy solving

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

I always had a question, How do you prepare educational contests so fast? Because creating new problems in one week is so difficult! awoo BledDest

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

    They have a lot of experience

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

      I know they are so experienced, But creating a new problem (actually a new hard problem which has standards of CF) is difficult, and I appreciate them for their hard work, Good job !

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

    They must have unlimited problem generator AI...

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

Hoping to become specialist after this :)

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

A long wait of almost 10 days after this contest : ( Waiting for this contest to be awesome and welcoming the fellow coders to have great competition : )

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

hope to change my color to green

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

Hi guys ^_^ I'd like to ask question here. Why codeforces educational rounds harder than other div2 rounds i mean what makes them specail I always do bad in educational rounds /: Amd GOOD LUCK FOR EVERYONE!!

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

Educational rounds don't charge penalty points for wrong submissions??

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

    The penalty for each incorrect submission until the submission with a full solution is 10 minutes.

    Maybe read the blog?

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

As a Romanian, it's pretty cool to participate in a Codeforces round on the National Day of Romania (which is today, December the 1st)!

Light-hearted meme
»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Why codeforces has become speedforces from past 2 — 3 contests.

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

C<<<<<<<<<<D

Drastic rise in difficulty

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

Okay fine D is the best problem I have ever seen, like enough already

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

Just one question... Monocarp is some type of reference or the name of a famous person? I have also seen Polycarp

Maybe carp means something that I don't know in english

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

    Carp is a large fish that lives in lakes and rivers

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

    The name Polycarp (which is a usual Russian name, though an uncommon one) was very commonly used in contests made by authors from Saratov State University, namely MikeMirzayanov and his students. The name Monocarp (which is NOT a usual Russian name) was originally used as a one-time joke for one of the ICPC qualification stages in our region (as a reference to Polycarp), but later on, we chose to make Monocarp the main character of most our problems.

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

    I used to read it as PolyCRAP and MonoCRAP

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

The difficulty gap between C and D is just too much. C is too easy for its position and D is too hard...

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

    Also I found B to be easier than A

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

    Just try E

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

      how to solve E? i was trying bfs from lab vertex is that correct ?

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

        yes. You then just have to check that you don't have more than 1 dot as neighbour.

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

          i am doing that ,though getting wa on test 3.

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

            What you are doing seems quite complicated, I believe it's you trying to debug your code.

            my code should show that the approach works and is quite readable (just don't ask me why I converted chars to int to convert it back at the end!)

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

              thanks ,i got the mistake ,it was in the implementation.yeah it was very difficult to debug it ,thats why i was doing multiple submissions

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

              Comment partly deleted to reduceit's size since intimidator found his issue. not much value in it anymore and it took plenty of space in the thread

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

          realized it just after the contest...

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

      I had one approach like, mark all the free cell + except the cells that helps in forming a cycle within a matrix. Because, robot just not follow the command and will move in cycle infinitely.

      Is this a right approach ?

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

        Also you don't need to mark as + vertices that don't have a path to L. And finding all vertices that are on a cycle doesn't look like a very easy task.

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

Please list out the 7 sequences for sample test 4 in quest D

4

0 1 2 3

which satisfy

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

How to solve F?

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

    Let's solve it by inclusion exclusion principle, let's denote $$$f(x)$$$ as the number of permutations with at least $$$x$$$ edges such that $$$c_{child} = c_{parent} + 1$$$. The answer to the problem is $$$f(0) - f(1) + f(2) - f(3) + f(4)$$$... up to n.

    To compute $$$f(x)$$$ for some fixed $$$x$$$, $$$x$$$ nodes should have exactly one child with their value minus one (it is impossible to have more than one since it is a permutation).

    Let $$$g(x)$$$ will be the number of ways to select $$$x$$$ edges such that there are no two edges with the same parent node, this can be reduced to a knapsack problem, with the degrees as items, all $$$g(x)$$$ can be solved in $$$O(n\log^2{n})$$$ with divide and conquer and fft since the sum of all items is up to n.

    Finally, $$$f(x) = g(x) \cdot (n-x)!$$$ since $$$x$$$ numbers are equal to the number of their parents minus one, so there are $$$(n-x)!$$$ possible permutations.

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

      Thank you, can you please clarify a bit more on reducing the problem of selecting X egdes to knapsack problem? And how you can find all g(i) in O(n Log^2n) ?

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

        For each node, 1) you choose a child that has their value minus one (select one edge) 2) not choose any child (no edge selected) There are (number of child) ways to choose 1). By multiplying (x + number of child) for every node, we can get a polynomial which the coefficient of x^i represents g(N-i). Multiplying N linear polynomial can be done in O(Nlog^2N) using FFT and divide and conquer.

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

      How to proof f(x)=g(x)⋅(n−x)!, I just can't notice that...

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

        Also took me a bit of time to understand this. I think the proof below works.

        You need to prove that there is a bijection between a valid configuration (i.e. values that satisfy the parent-child constraint for each of the $$$x$$$ selected edges) and the relative ordering of non-child nodes (there are $$$(n - x)!$$$ relative orderings). Note: with child nodes I mean the children of the $$$x$$$ selected edges.

        If there is a bijection it means that both sets are of equal size, and therefore there are $$$(n - x)!$$$ valid configurations.

        To prove that it is a bijection we need to prove that

        • For each valid configuration there is exactly one corresponding relative ordering of the non-child nodes
          • Proof: Since all values in a valid configuration are unique, the relative ordering of the values of the non-child nodes within the valid configuration is unique.
        • For each relative ordering of the non-child nodes there is exactly one corresponding valid configuration
          • Proof: If we fix the relative ordering of the non-child nodes, then the relative ordering of the child nodes is also fixed. Because for every child node its order must be equal to the order of the parent minus 1. Therefore there is exactly one way to achieve a valid configuration starting from a relative ordering of the non-child nodes.
»
2 года назад, # |
  Проголосовать: нравится -7 Проголосовать: не нравится

how to solve b?

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

    x mod y always gives values between [0,y-1] if we choose y as smallest element of the array then it is obvious that our requirements are met (given in the question)

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

    take the smallest number as y in all pairs. since x % y < y it satisfies the conditions

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

    Just take y as smallest element in array so that remainder is [0 , y-1] which doesnt exists in the array

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

What is test 2 on problem D ? I cannot figure out the edge case I am missing out on.

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

What is test 2 of D ? I cannot figure out the edge case i am missing.

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

Wasted a lot of time in D , could have done E instead.

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

For me, A > B and D > E. In other words, I felt E was easier than D and B was easier than A. Although A was easy too, just some bit of implementation.

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

    It was very easy to lose yourself into the implementation details of A and this is why I also felt like A was (much) harder than B.

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

      I guess much of A's implementation can be made easier if you consider x1 and x2 as strings rather than integers!

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

        That's actually what I did, as I struggled a lot with x1 and x2 implemented as ints, and then I thought: "screw it, I'm gonna do this cheap string trick"

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

        Or you can just subtract min(p1, p2) from p1 and p2, and then if min(p1, p2) + 8 < max(p1, p2), number who has bigger p is bigger, else you can just multiply x1 with 10^p1 and x2 with 10^p2, and check them like usual numbers.

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

Who thought that E was that hard and even harder than D man, that problem can be even a harder div2C, it's just a bfs.

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

I love the problem D, the solution is beautiful and it has two of my favorite subjects, combinatorics and DP!

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

Once again!!

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

Question C could be solved with iterative binary search (https://codeforces.com/contest/1613/submission/137689165) but was giving TLE(at test case 5) with recursive binary search (https://codeforces.com/contest/1613/submission/137672043). This cost me 3 wrong submissions and a lot of time!

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

This is my first time attending cf contest!

Just curious that if I'm currently unrated, would this contest be rated for me?

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

    Yes.

    The rating takes a bit of time to be updated, partly becasue of the hacking phase. If you want an idea of your future rating, you can check cf predictor

    Edit : As beginners, since I am one too, I believe we shouldn't focus too much on ratings. Just start solving problems, enjoy and check where we land in a couple month =D

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

The first contest where I can do 3 problem

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

How to solve D?

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

    Use dynamic programming. You can get that there are only some types in mex correct sequence. First of all, Thre are a sequence which starts with 0 and looks like 0 0 0 .. 0 1 1 1 .. 1 2 2 .. 2 ...(from 3 to n-1) n n .. n n n. In this case, you can expand this sequence with adding n, n+1, or n+2. Also, there is another type of sequence. which also starts with 0 and like 0 0 0 .... (from 1 to n-1) ... n n n ... n+2 n n+2 n+2 n n n (don't have to alternative, just after all, you should add either n or n+2) In this case, you can exapnd this sequence with adding n or n+2 Finally, you can think about this kind of sequence: which is composed with only 1, like 1 1 1... 1. count first two kinds of sequences with dynamic programming with dp[i][j]=number of sequence which ends with i and type is j(either first or second) and count last one with just counting the number of 1. number of last kind of sequence is 2^cnt-1

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

      I found this observation during contest but couldn't figure out how to implement in dp.Anyway I will now learn, thanks for help

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

        Once you get that observation, then I think checking with some cases(which are on the above)will be helpful to you. I also struggled with some wrong cases at first.

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

      1 1 1... 1 sequence could be a special case of 0 0 0 .... (from 1 to n-1) ... n n n ... n+2 n n+2 n+2 n n n . So there is only two types of sequences: MEX n with max n — 1, MEX n with max n + 1.

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

any idea why this is wrong? this is problem C, I did binary search and pretty sure it is correct, but it gives wrong answer, ;_;

like I dont even get why 456 is not a correct solution for the last test case of sample tests? I am getting 456 as my answer to binary search and 456<470 (given answer) Help! please

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

    maybe you should use this: min((i+1<n?a[i+1] — a[i]:(int)2e18-a[i]),mid)

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

      Man, you are right!! Thanks a lot!!!! But what is the difference between the two? ;_; I dont think I would have ever been able to debug this.

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

        maybe you read the wrong question,the poison affect is refesh, not stack. And the time to kill dragon may bigger than 1e18

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

          Can you explain how the answer can be bigger than 1e18. I wanted to hack a solution because of this but could not come up with a case that has ans > 1e18.

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

            I mean the time to kill dragon may bigger than 1e18, not the ans. ans <= 1e18. if n = 1 and h = 1e18 and a[1] = 1e9, than the answer is 1e18 but you will kill the dragon at the moment of 1e18 + 1e9 — 1 which is bigger than 1e18

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

    a[i+1]-a[i]?

    Also (int)1e18 will overflow. Use long long.

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

Nice problemset, I enjoyed solving A-E! Looks like I'll also learn a lot from F once the editorial is published.

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

[Deleted]

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

    why??

    everyone knows that endl is slower than "\n"

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

      but not like more than 3 times slower

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

        actually, it's more than 10 times I guess. After I read this I changed my code from using endl to "\n", and the 2000ms tl become 217ms AC. Really learn a lesson in this problem.

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

    You learnt something new! What I would do after something like this, is try to find out why this happens. I would recommend you to do the same ;)

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

Thanks to this contest that I realise "cout << endl" will get TLE for the first time 137704588 137708870

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

Is there any idea to solve F? I enjoyed A to E but I couldn't get some idea to solve F. I think there should be some combinatorical good theory to solve.

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

Раунд классный, но по моему мнению стоит поменять местами задачи D и Е, а так все остальное вроде +- на своих местах

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

Does anyone knows why my submission for A is getting WA? As far as I know, it's mathematically correct but I can't figure out a test case that breaks it, thanks a lot. (The idea behind the solution is to represent both numbers as x+(10^p) and then take it log10 to reduce its size and compute the number) (also note that lli is defined as double)

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

    you use a and b as length, but then when you compare them, if you have a = b, you print equality, although this is equality of lengths, not numbers

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

For those struggling with TLE at test case 16 in E , when printing out the grid change from $$$endl$$$ to \$$$n$$$ and TLE will be gone

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

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

Can someone help me better in understanding what i could have done better to avoid wrong answer for problem C?

Here is my solution -> https://codeforces.com/contest/1613/submission/137670768

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

E. 2000ms for 1e6 input == Downvote

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

I am not a detective, but this group of contestants looks sus fifijonil nexoxogoc ybgbsydvh ouhtek robot_bobot

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

Could someone explain why my submission to A fails?

I am converting both numbers to scientific notation and then comparing the numbers. Does it have something to do with errors regarding precision?

Update: Well I did not know about such precision issues. But it turns out the error in my program is actually in the while loops because I was not converting numbers to scientific notation. In my old solution, I have > 10 when it is should be >= 10. Here is an accepted solution of converting the numbers to scientific notation.

tldr: converting to scientific notation seems to be a valid solution to A.

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

    Indeed it has

    eg. if I run this code

    double x = 0.1;

    cout << (x * 3 == 0.3) << endl;

    result is 0 (false) for me

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

    you can't compare numbers after mod operation, order is lost.
    (7 mod 5) > (10 mod 5), but 7 < 10

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

Is there any standard concept for solving problems like C?

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

As this is a DIV 2 contest, why does nothing change, when ticking the box "show unoffical". Do I miss something?

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

Any hints for dp states of problem D?

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

It was a great round, was able to solve 3 problems for first time in div 2 contest!!! Just had a confusion while solving A by generating the two numbers using pow function and using long long integer type , why did I get wrong answer on test case 2 ? Why did it fail, am I missing something?

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

    long long int is USUALLY (it depends on the compiler) coded on 64bit which means it's in a range -9e18 +9e18. To get the real limits, you should read <limits.h>.

    Anyway, in A, the exponent can be up to 10^6 so you will get numbers up to 1e1000006 which will overflow by a LOOOOOOOT,

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

How does https://codeforces.com/contest/1613/submission/137705083 work but https://codeforces.com/contest/1613/submission/137689153 WA on Test 10? Is this a thing with Python, or specifically with the math module in Python?

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

    h can be up to 10^18. Numbers above 2^53 cannot all be represented exactly by floats, so you lose precision.

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

E was pretty easy compared to D..the setters should try to place problems at the right place.A good contest btw

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

The heart is too anxious to miss green name. Too many penalties。 But the experience is better

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

Why don't you let $$$O(n\sqrt n\log n)$$$ pass F?

upd: I try my best to make it $$$O(n\sqrt n)$$$ and it finally passed.

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

Hope not to be heacked……

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

Where are the editorial for the problems?

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

Need help in question E.

Getting WA.

My approach was as follows.

1)Start BFS from Lab

3)While traversing push the co-ordinates of the cell which is free, only if at max there are 2 direction in which you can go(one of which will lead to lab).

Please tell what is wrong with my approach

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

    try this testcase:

    1
    5 5
    ##.##
    .....
    .#.#.
    .#.#.
    ..L..
    

    All the . should be + in answer.

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

    Not max 2 but max 1, you should replace '.' with '+' after each steps to reduce it down to 1 (if possible)

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

the problems are nice but the contest is imbalanced B < A < C < E < D one could also exchange A with C in above order because A is somewhat more implementation based.

I like the problem D. I was not able to implement D during contest but the problem is nice:).

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

I love problems like F. It requires unique ideas and has simple implementation(if you have the code for FFT).

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

I'm surprised that everyone uses BFS for problem E.

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

why my java code is giving tle for 'D' problem, it's giving AC in c++ 137748948

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

Just a small question, DFS on E gives runtime error while BFS passes. So in c++, cant we make 1 million nested function calls ? Does anyone know approx. what is the maximum number ?

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

O(NlogN) for N<=100 solution C instead of expected O(Nlog10^18) https://codeforces.com/contest/1613/submission/137680384

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

Update: Ok it got hacked

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

This is a really good contest, especially problem D, what a amazing problem! Hope to do a contest like this again!

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

When will we get editorials?

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

    I guess it will be similar to past educational rounds? I don't get why people who have already participated in educational rounds keep asking the same sort of questions again and again? Do y'all run some script which posts some preset comments on recent blogs?

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

      you should learn how not to overreact on things unnecessarily

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

        I agree, maybe I could have stated my point a tad bit more politely. However, I am still curious as to why you posted the comment you did. Were you hoping for early editorials this time? If yes, then why? If no, then why the comment?

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

So when are the ratings coming?

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

Here are the video Solutions to the first 5 Problems in case you are interested.

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

First Submission
Second Submission

Submitted problem D twice, the only difference was in one line (I commented out "cerr << ..." in the second submission). Got idleness limit exceeded in the first submission. Can anyone tell me why this happened? And why did the idleness limit exceed on test 2, not test 1? Should it maybe be rejudged?

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

    Even though cerr output is not interpreted as the answer and does not get rejected as WA, it still causes a significant slowdown. The only mystery is why was this failed submission reported as "Idleness limit exceeded" instead of TLE?

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

Why aren't the ratings still updated?

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

My submission

can anyone find the flaw in my idea for problem D it passes 2 test cases and give WA on 3rd

my idea I used dp

the required sequence can be only of three types 0->0,1,2,3(consecutive) 1->0,1,3 (one skipped) 2->0,1,3,1,3,1,.....(alternating after one skipped)

so i created a dp[n+1][3] where first state corresponds to ending number of a sequence and second corresponds to type of sequence my transitions

  • for i>=2
  • dp[i][0]=(dp[i][0]+dp[i][0]+dp[i-1][0]);
  • dp[i][1]=dp[i][1]+dp[i][1]+dp[i-2][0]
  • dp[i][2]=(dp[i][2]+dp[i][2]+dp[i+2][2]+dp[i+2][1]+dp[i-2][2])
  • for i==0
  • dp[0][0]=(dp[0][0]+dp[0][0]+1)
  • dp[0][1]=0;
  • dp[0][2]=(dp[0][2]+dp[0][2]+dp[2][1]+dp[2][2])
  • for i==1
  • dp[1][0]=(dp[0][0]+dp[1][0]);
  • dp[1][1]=dp[1][1]+dp[1][1]+1;
  • dp[1][2]=(dp[1][2]+dp[1][2]+dp[3][2]+dp[3][1]+dp[2][2]);

can anyone explain why this is wrong

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

    And what is the result? sum of all dp[][] values?

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

    There is one main thing you are missing in this transition in $$$i==0$$$ case,
    $$$dp[0][2]=(dp[0][2]+dp[0][2]+dp[2][1]+dp[2][2])$$$
    Now, $$$dp[2][2]$$$ will store count of sequences ending at 2 and which are of the alternating form. There are two such sequences,
    1. 0 2 0 2 0 2....
    2. 0 1 2 4 2 4 2....
    But, you can append 0 to only the first type not to the second one by the definition of Mex-Correct sequence.
    You will have to change these transitions in $$$i>0$$$ cases as well because of this logic.
    One thing you can do is to make 2 separate $$$dp$$$ arrays(or increase the second dimension) to store these two types of alternating sequences.

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

      ohh now i understood what i was missing thanks for your reply Enigma20:).

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

        UPD:

        Finally got AC by using another dp2[n+1][2] this is to calculate alternating sequences of type 3.

        where first is the ending number of sequence and second specifies whether the ending number is increasing number of alternating sequence or decreasing number of alternating sequence.

        for example 1. 0 2 0 2 0 2.... 2. 0 1 2 4 2 4 2....

        here 2 is increasing number in alternation for sequence of type 1 and 2 is decreasing number in alternation for sequence of type 2

        Finally AC

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

How to solve E?

EDIT: I tried it to some extent but couldn't end up with a correct solution.

My main observation was that a cell will be only + if there are only two or one way to exit this cell for example x,y is a free cell and x+1,y is blocked and x-1,y is blocked so this cell can be a '+' provided it leads to the lab

so I ran a bfs starting from the lab. I enter only those cell which has only two ways or 1 way to exit it and I turn it into '+'.

But this solution is giving WA!

is my observation flawed or am I missing anything?

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

    you should compare the number of neighbors that is '+' or 'L' with the number of exit this cell, not just check the number of exit this, e.g.

    #..

    .L.

    ...

    although a[2][3] has three exit directions, it is '+'

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

can anybody help me? In problem D I have a solution based on dp[i][j] the number of sub sequece that i is the last number of Mex-correct subsequece and j is a type of Mex-correct (if j = 0 then mex of subsequece must be i — 1 otherwise of j = 1 then mex shuld be i + 1).

thus we have dp[i][0] = 2 * dp[i][0] + dp[i-2][1] and dp[i][1] = 2 * dp[i][1] + dp[i-1][1] + dp[i+2][0] but I got WA.

here is code

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

Why Ratings are still not updated?

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

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

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

Today is 2021,1202, which is a palindrome. we should celebrate it. wait for 20:21 in your time zone and see what will happen.(maybe a rating update)

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

What has happened to Codeforces? The system testing is not over yet?

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

During contest time I submitted my code and it was accepted on the second attempt. But after system testing I found WA because of TLE in the 7th test case. I found no reason behind it. Plz help me. Here is my submission link https://codeforces.com/contest/1613/submission/137660678

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

    Your code only passed weak pretests during the contest time. Then there was a 12 hours long hacking stage and people could freely submit their own stronger testcases (also known as hacks) to exploit various bugs and vulnerabilities in incorrect solutions. The final system test included all these extra testcases. Your solution failed to pass them.

    I suggest to look at the input data of the 7th test case and try to figure out what exactly killed your solution.

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

    Imagine a test case of $$$t = 10^4$$$ and in each case $$$p1 = 1, p2 = 1000000$$$. In this case your code will run $$$10^6 . 10^4 = 10^{10}$$$

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

Ok so carrot is predicting +79 and i need +81 rating for cm. I dont think my copium can handle this.

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

Will anyone please help me that why my solution for the question is getting tle in the 16th testcase. First I thought that in my code there is some infinite loop. So, to check it I changed my code specifically for case 1)m=1 2)n=1 and since, in this we only have to go in both directions from 'L'= lab until we encounter '#' or we have reached to the end of string. So I Directly use the while loop for that and still, I am getting tle. Its not clear to me whats the problem is. Link to my code.

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

    Just use '\n' instead of $$$endl$$$.

    And a good advice for the future, use $$$endl$$$ only in the case you want a flush, otherwise use \n

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

Is this Rated?

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

Rating is not updated yet. Moreover, previous contest ratings also has been rolled back. What's going on?

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

    Maybe someone in the headquarters was sleepy and instead of clicking on rating update he clicked on rating roll back . ( Not trying to disrespect anyone )

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

    You have been around long enough to know the drill. The only missing thing is a banner at the top of the site with a notification about temporary rating rollbacks.

    Looks like the plagiarism checks for the earlier Deltix round are almost complete and the scoreboard will be finalized soon with recalculated ratings. And then preliminary rating updates for the current round will become available too (followed by a rollback and finalization at a later date).

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

Rating ??

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

Kindly Update Ratings

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

Div. 1 participants got a delta rating as well xD

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

Div. 1 participants got a delta rating as well xD

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

Educational Codeforces Round [Rated for Div1 + Div2]

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

Hurray! new rating!

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

I guess there's something wrong with rating changes cause I should've got +147 delta according to cf-predictor but only got +71

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

    as you said , it is "predictor"

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

      looks like this trouble is not only mine so I believe predictor works fine with possible plus minus 15 delta diff

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

Is Mike high today?

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

    He just pressed some wrong buttons ig. Come on, everyone loves to play with buttons

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

Why aren't the problems still allotted to their difficulty rating ?