chokudai's blog

By chokudai, history, 4 years ago, In English

We will hold AtCoder Beginner Contest 297.

The point values will be 100-200-300-400-500-500-600-600. We are looking forward to your participation!

  • Vote: I like it
  • +49
  • Vote: I do not like it

| Write comment?
»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How do you solve problem E?

  • »
    »
    4 years ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it +1 Vote: I do not like it

    maintain a set and take the smallest element at each step and add all elements that can be made from this element by adding the elements of the array and put them in the set , repeat this process k times. Note the set size should not exceed memory limit , to do that you can check and add the element only if set.size()<= some number , for me 1e6 worked , there may be a tighter bound. here is my solution.

»
4 years ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

I wasn't able to solve E :(

Seems like something very standard but I wasn't able to find it... And optimized bruteforces took a couple of minutes.

Any hints?

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve problem F

  • »
    »
    4 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    iterate over all possible heights and widths of the rectangle we can choose.

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve problem Ex

  • »
    »
    4 years ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it +23 Vote: I do not like it

    Use inclusion-exclusion, polynomial inversion to get the number of splendid array whose sum is k for 1<=k<=n.

    And we can use this information to calculate the answer by counting if we put a number $$$k$$$ on the array and the sum before the number is $$$x$$$ and after the number is $$$y$$$ and $$$k+x+y=n$$$, how many number of this array. If can be do by inclusion-exclusion and FFT if we get the first part answer.

»
4 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hi, can someone who solved E during contest share the thought process leading to their solution? Like what chain of thoughts led to spotting the idea. Is it similar to some other idea that is well-known?

  • »
    »
    4 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    You can see the process as running a shortest path algorithm on a hidden graph and your goal is to calculate the node with k-th distance to node 1. So you can easily solved this problem with a heap-optimistic dijkstra.

    • »
      »
      »
      4 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      ooooooooo, didn't realise this was graph, also hadn't seen dijkstra used like this before, very nice, thank you for your explanation.