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

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

The Benelux Algorithm Programming Contest 2018 takes place October 27th. This is a subregional contest for teams from Belgium, the Netherlands and Luxembourg, which feeds into NWERC.

The contest starts at 13:00 local time (GMT+2) and there is a semi-live contest starting half an hour later for which you can register here. For comparison, you can find last years problems in the gym here.

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

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

This is tomorrow. Looking at the schedule it seems the contest was moved to 13:30 so the live contest should then start 14:00 (GMT+2). There'll also be a livestream with solutions afterwards (see the main site).

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

Very nice problemset! The intended solution for problem I was binary search + flow?

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

    I used binary search + flow for I and got OK, but I guess binary search + Hall's mariage theorem might work too.

    Edit: You have to be a bit smart with your flow graph so you only get O(2s) vertices and O(s2s) edges.

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

    Depends a bit on what you mean by 'flow' :-) Our intention was that doing flow with shelters on the left and locations on the right would get TLE, since your flow graph might have size O(sn). I don't think anyone got through with that approach but I didn't check the online mirror very carefully.

    The livestream with solutions is here. I present I (and then D) around -31:00. But it's not very coherent, I was really tired and there was a loudspeaker next to me with about a 0.5s delay. Try pronouncing `indistinguishability' then :-)

    We'll try to put everything online in the next few days, including solution slides.

    EDIT: Here are the slides with solutions we used. There's some minor errors but they're mostly complete.

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

Any ideas for D? I had the following observations:

  • There's any easy quadratic solution by BFS on state graph.
  • If the answer d is small, then we can use d phases of rolling hashes to compute it in O(n·d).
  • We could use Hopcroft DFA-minimization over the binary alphabet in to check if the answer is "indistinguishable".

Then I tried to combine this with a heuristic solution where we run the state-graph BFS and keep the first 50 states we get for every vertex for both A and B. (But I was coding in the train and made too many stupid bugs, so I didn't debug it in time.) It would be nice if I could submit this somewhere.

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

    I loved problem D. I would like to submit it somewhere too.

    Here is my solution (not 100% sure about correctness).

    Let t[i] be 1 if we can see the tower and 0 otherwise. Let l[i] and r[i] denote where we go if we turn left and right.

    The idea is to execute quickly the following procedure:

    • Initially we can say that it must hold t[A] = t[B] (otherwise we have already finished).
    • At step 1 we can say that t[l[A]] = t[l[B]] and the same for r.
    • And so on.

    Here is the real solution:

    We keep a disjoint union data structure on the vertices (ancestor(i) denotes the root of the component to which i belongs). Two vertices i and j will be in the same component iff (at the current step) we know that t[i] = t[j] (we will always keep track of the current step, this way as soon as we find a contradiction we know the answer).

    • Initially we join A and B. And we insert in a queue the pair {A, B}.
    • We start popping pairs from the queue.
    • When we pop a pair i, j we join {ancestor(l[i]), ancestor(l[j])} and we insert such pair in the queue. If ancestor(l[i]) and ancestor(l[j]) are already equal we do nothing. We do the same with r[i] and r[j].
    • We keep doing the previous steps until the queue is empty or we find a contradiction. If we cannot find a contradiction then the answer is 'indistinguishable'.

    The overall complexity is pseudo-linear.

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

    FYI I think most your tests gave WA because you printed -1 instead of indistinguishable. Other than that I think you were only getting a proper WA on two cases or so. So you were close :-)

    Slides are here if you're interested, I won't be putting any spoilers in the comments here.

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

What is the preliminaries contest? Does it also contain good and original problems?

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

For those interested, the contest is available on Kattis now.