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

Автор mkisic, история, 4 года назад, По-английски

Hi everyone!

Second round of COCI will be held this Saturday, November 14th at 14:00 UTC. You can access the judging system here. If you are not familiar with COCI contest format, we encourage you to read the announcement.

The round was prepared by paula, Gabrijel, dpaleka, bukefala, pavkal5 and me.

Feel free to discuss the problems in the comment section after the contest ends.

Hope to see you on Saturday!

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

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

Great contest with interesting problems! The implementation task and the binary search one were very neat. I felt like Euclid was so smart, especially the way those subtasks guide you to the right solution, though I didn't utilize that until 20-30 minutes to the end. Kept me entertained for a few hours or so. :)

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

What is the idea for Svjetlo (last problem about bulbs)?

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

    I reduced it to the following problem: assign an integer weight to every edge and every vertex. Edge weights represent the number of times the edge is crossed while walking the sequence, and a vertex weight is the number of ends of the sequence that are at that vertex (so the sum of vertex weights across all vertices must be even). I also rooted the tree at an off bulb, and pruned off subtrees that only contain on bulbs. Then one can see the following constraints:

    1. All edge have weight at least 1.
    2. For every on bulb the sum of the vertex and the incident edges must be a multiple of 4.
    3. For every off bulb the sum must be a multiple of 2 but not 4.

    Those constraints are also sufficient for an Eulerian path to exist that leaves all bulbs in the right state.

    After that it's a tree DP, where for each subtree you solve for each possible combination of edge weight to the parent and sum of vertex weights within the subtree. Edge weights never need to be greater than 4, since otherwise one can just subtract 4.

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

So what's the solution for Euklid?

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

    Let $$$K$$$ be such that $$$h^K > g$$$. Then take the smallest $$$b \ge h^K$$$ such that $$$g | b$$$, and $$$a = hb + g$$$.

    Motivation: the solutions must be less than $$$10^{18}$$$, so there aren't that many things that one can try.

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

    I reduced the problem to finding such $$$m \geq 1$$$ and $$$k \geq 1$$$ so that $$$h^k \leq 2^mg < 2h^k$$$ and then the answer is $$$2^mg$$$ and $$$(2^mh+1)g$$$.

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

    I believe you've gotten to this point, but for those who didn't get there, here's what I've got so far:

    We've got two cases:

    1. h <= g
    2. h > g

    For the first case this formula always works: a = h * g, b = g. The other part I don't know yet.

    For the partial 15 points, brute force does fine, so this way we can score 4 + 8 + 8 + 15 = 35 points.

    EDIT: Now I see, the full solutions were posted above. Don't mind me.

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

Editorial is now published here.