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

Автор chokudai, история, 5 лет назад, По-английски

We will hold AtCoder Beginner Contest 221.

The point values will be 100-200-300-400-500-500-600-600.

We are looking forward to your participation!

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

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

Honestly, I have been giving ABC for about 18 months now and I still dont understand what is the target audience for these contest. As usual we have 800 level problems on A-E and then F-H are literally 3500 rated problems.

There is no place for people like me who are on 1800-1900 level, cuz a certain problemset prefix is way too ez and then the problems are directly 3500 level

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

    P.S. I think F is very interesting problem (but very hard ;-;) . How do to do F ?

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

      We can consider two cases: one where the diameter is odd, and the other where it is even.

      The first case is simpler, as every subset can have only two nodes — one at an odd distance from the center, the other at even. So you just have to find the number of pairs at distance $$$D$$$, which is standard.

      To solve the second case, notice that when the diameter is even — there is only one center. So root the tree at this center, and corresponding to each of its children, find the number of nodes in their subtrees at distance $$$D/2$$$, let it be $$$f[child]$$$. Then the product of ($$$f[child] + 1$$$) over all children gives you the number of valid subsets. Now just subtract the number of subsets with at most $$$1$$$ nodes, and you're done.

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

        Can you please explain why we are multiplying f[child] + 1 in even case

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

          For every child $$$c$$$, you have $$$f[c]$$$ choices to select a node from the subtree corresponding to that child, and one more choice to not select any node at all. Hence, a total of $$$f[c] + 1$$$ choices.

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

            Ok,I got it but why are we multiplaying? When we multiply which situations are we counting

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

              Because each subtree is independent, and for each, you have a number of choices. It's similar to how you would count the number of subsets of a set, where for each element you have $$$2$$$ choices (one to choose it, one to leave it), and you multiply these over all elements. Here you just have $$$(f[c] + 1)$$$ choices instead of $$$2$$$ for each child $$$c$$$. In general, we multiply when we're counting the number of ways to do a task which can be partitioned into smaller subtasks independent of each other — we can instead count the number of ways to do those subtasks, and take their product.

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

        Can you show how to find number of pairs at a distance D? I'm assuming using 2D DP.

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

          There are a number of ways to do that in general (one involves centroid decomposition, which is what I did — and don't really recommend if you don't have it pre-written). You can do it using a $$$2D$$$ — $$$DP$$$ but it would be $$$O(N * D)$$$, so won't pass here. If you're not lazy, you could work up a simpler solution — notice that when $$$D$$$ is odd, there are exactly $$$2$$$ centers (say $$$u$$$ and $$$v$$$) and they are adjacent! Every diameter will have this edge $$$(u, v)$$$ in common. So, just count the number of nodes at a particular distance, say $$$k$$$ at either side of the edge (say $$$dl[k]$$$ for the nodes on the left, and $$$dr[k]$$$ for the nodes on the right). And then for each valid $$$k$$$, add $$$dl[k] \times dr[D - k]$$$ to the answer.

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

      Run a dfs(rooting at center). Find the maximum depth of the nodes in the subtree of each child of the root. Maintain a multiset of these depths.

      Suppose the multiset is {.......,d1,d2}.

      If d1=d2, you can take nodes(atmost one from subtree of each child of root) at depth d1.

      If d1!=d2, you can take only two nodes at a time, one at depth d1 and the other at depth d2.

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

      All diameters of a tree have a common element.
      If length is odd then the middle edge is common in all diameters. If length is even then the middle vertex is common in all diameters.
      Based on which case it is there are different methods to count while ensuring that all pairs of paths have that common element.

      Also to simplify the odd case you can make all edges of length 2 by placing a node in between all edges.

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

    I disagree. In my opinion, E was not very easy; it is just that there are many very similar problems across the internet, so most people would not be solving it for the first time. For an actual "beginner" who has never seen a similar problem before, I would argue it could be quite challenging. Furthermore, F was not substantially harder than E in my opinion it is just that everyone has seen a similar problem to E before, but not necessarily F. I think the difficulty curve was appropriate for a beginner contest.

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

Hi,
Can someone explain why the answer to E's 4th sample test case is 830 and not 574?
I am using a Segment Tree for finding the number of indices that can be included for each index, and am using a combination of Hash-Map and Priority-Queue for ordering the elements.
My Submission
Thanks.

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

I misread E (completely my fault) as the number of subsequences with the property that $$$A'_1 \leq A'_i$$$, $$$2 \leq i \leq k$$$ which was a similarly interesting problem but had a completely different solution. But the first three test cases had the same answer for this formulation as well, so it took a while for me to notice.

Edit: If you got $$$574$$$ as the answer for the last sample test case, then you did the same thing as me. rip :(

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

What is the standard problem I should know to solve E? Any links or what can I write on Google? Thanks

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

In problem E .my idea is similar to the editorial but my code got WA. please help anyone. submission link. https://atcoder.jp/contests/abc221/submissions/26319823

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

I just want to know can problem D be solved by coordinate compression.

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

I came up with an O(n^2) solution for E by iterating over all the pairs, and couldn't come up with an optimized approach for the same.

Any help would be appreciated!!!

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

maybe this is the easiest abc round after having 8 problems (I think :)qwq

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

I read the editorial of problem E but I couldn't understand it, can someone explain it in detail?

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

I can never tell whether the explanations are better in Japanese or whether whoever writes the atcoder beginner editorials is trying to dissuade people from doing competitive programming. Even the simplest problems can become confusing if you read the editorials after.

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

Cool contest with various concept and difficult problems.

The solutions provided in the editorial can be understood if you are experienced with the concepts mentioned there.

I recorded a video during the contest, solving A~D.

I haven't looked at the editorials of the problems that weren't solved/tried yet because I think that you should at least try a problem yourself before solving it.

Also, the announcement was made a little later than usual, so if you don't know, you could go to the contests page to check for upcoming contests.

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

The method to do with the Problem D is quite simliar with the problem ABC-188-D.

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

Thanks for the problems -- I couldn't compete live in the contest today, but I worked them afterwards. Problem G forced me to write a bitset class in Golang (which I now have for future problems), so thanks for that. I found most of the problems enjoyable.

My $0.02 is that I do like the extra 2 problems, but the time crunch is certainly more painful than in many other contests. It does feel like 8 problems in 100 minutes is overrewarding faster coders over people who can do the harder problems with a bit more time. I'd personally prefer 2 hours for 8 problems -- I don't know if I'm in the minority or not.

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

Can anyone explain the solution for task C to me, I didn't get the editorial :(. What I did was separated the numbers with odd/even number of digits. Observed something with odd and similarly with even and then tried to generate the two numbers but got WA on ~50% cases!

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

Hi, Here is my screen-cast of the first 6 problems (A — F). I have also discussed my approach towards the end of the video. Click — Click

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

Well,my friend submitted the code of B problem in the race, which had been accepted eventually. But it is NOT correct.

That's the submission

And the hack:

Input:

abb abc

Output: Yes Expect: No

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

First of all, thank you for the problems. I found them very interesting and educational.

I have a few comments regarding the editorial for problem H. I'm not sure what is the best way to report them, so I'll leave them here.

For each $$$k=1,2,…,N$$$, count the number of sequences of non-negative integers satisfying the following three conditions:

  • $$$\sum_{i=1}^k B_i\times (k - i - 1) = N$$$
    ...

I think, because of the 1-based indexing, it should actually be $$$\sum_{i=1}^k B_i\times (k - i + 1) = N$$$.

For a pair of integer $$$(x,y)$$$ satisfying $$$0\leq x,y\leq N$$$, define $$$f(x,y)$$$ as follows.

  • The number of sequences of non-negative integers satisfying the following three conditions:
    • $$$\sum_{i=1}^k B_i\times (k - i - 1) = N$$$
      ...

I think, here it should be $$$\sum_{i=1}^x B_i\times i = y$$$.