mango_lassi's blog

By mango_lassi, history, 5 years ago, In English

The 2019 NWERC (Northwestern European regional contest) is tomorrow. You should see the scoreboard here once the contest starts.

There will be an online mirror here.

Let's discuss the problems after the contest!

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

»
5 years ago, # |
  Vote: I like it +13 Vote: I do not like it

The contest starts in 20 minutes, the online mirror starts in 50.

There will also be a live stream on ICPC Live

»
5 years ago, # |
  Vote: I like it +16 Vote: I do not like it

How to solve B, D, H, J and K?

  • »
    »
    5 years ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    J: Make a segment tree that tells us for every interval how many removals we need to make to make that interval of posts into a alternating sequence that starts with negative / positive and ends with negative/positive. Combining this information is trivial.

    Initially each post must either be deleted or have the sign it initially has. Loop the amount of new accounts we create, when the number of accounts goes over $$$abs(votes_i)$$$, that position in the segment tree can now have any sign, so we update it. Every position gets updated at most once, and the segment tree operations work in $$$O(\log n)$$$, so that's our time complexity.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    D: For each edge count, find the shortest path with exactly this many edges when ignoring the constant x that is added to each edge. The actual length of such a path is then a line equation in terms of x. You then need to find all the lines which are minimal for at least one value (kind of like in the convex hull trick). Finally you need to find all the vertices which are on at least one of these paths.

  • »
    »
    5 years ago, # ^ |
      Vote: I like it +21 Vote: I do not like it

    You can also see the solution presentation if you skip back in the live broadcast.

»
5 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Did anybody manage to solve B?

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    Idk if my solution is correct, but I did manage to squeeze it in 4s

    solution

    I maintained all possible subtree sizes with a specific height by a vector of intervals. To get lexicographically smallest subtree I just checked if a specific prefix is possible. This needs some nasty optimizations because in almost all cases dp value is just one interval, but not always. Can anyone find a counter test for my solution?

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it +18 Vote: I do not like it

    I tried to write $$$O(n\log n)$$$ and got WA, but $$$O(n\log^2n)$$$ passes easily anyways. Designate a set of nodes such that none of them may be erased, and try adding nodes to this set in DFS order. After adding a node to the set, test whether the minimum possible size of a BBST containing all nodes in the set has size at most $$$k;$$$ if not, remove the node from the set.

    Code

    UPDATE: Here's $$$O(n\log n)$$$ (apparently it's slower tho lol)

    Code

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +8 Vote: I do not like it

      It's also possible in linear time.

»
5 years ago, # |
  Vote: I like it +26 Vote: I do not like it

What did happen with Oxford team ? They had 5 harder before frozen, and currently they are not on the leaderboard.

»
5 years ago, # |
  Vote: I like it +24 Vote: I do not like it

Will this contest be put into gym/opentrains for virtual participation?

  • »
    »
    5 years ago, # ^ |
      Vote: I like it +10 Vote: I do not like it

    In theory anyone can do it. The problem packages are available on the site: http://www.nwerc.eu/ -- most of the jury are travelling back from NWERC to our normal lives today. If nobody else has added the packages to Codeforces by the weekend, I can do it.

    You can also find the questions on Kattis already because like usual they hosted the semilive contest for us: Problems from Northwestern Europe Regional Contest