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

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

Is it allowed now to discuss the APIO? According to the schedule, the official competition is done by now... but also according to the schedule, the open contest is in about a week.

Edit: It seems like discussions should be kept until after the open contest ends. So, don't scroll down if you want to avoid any kind of spoiler to the open contest (and yes, let's stop discussing until then).

Edit2: Should be good now.

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

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

I was told that "we should not discuss openly about results and problems of APIO 2019, until 9:00 AM (UTC+9) of May 20th." from a responsible of APIO 2019 Tokyo venue.

So I think we can discuss (at least about results), but not confident.

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

Seoul site result is almost a meme. Best score is 253(GyojunYoun), and 4th ~13th are all tied to score 203. I expect 0G/13S/0B.

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

    Seems like 203 is pretty common result. Here we had two people with 203, and I've also heard of another 8 people with 203.

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

      Yeah, it's common, very very common. :)

      Congratulation for the perfect score, by the way!

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

        How did you know?

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

          I can see unofficial results :)

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

            So... you know the unofficial results, and you said that both 253-point scorer and 203-point scorer in Seoul is expected to get silver medal. So, it means, I got two informations, right?

            • $$$G_{border} \geq 254$$$
            • $$$203 \leq S_{border} \leq 253$$$
            • »
              »
              »
              »
              »
              »
              »
              5 лет назад, # ^ |
                Проголосовать: нравится 0 Проголосовать: не нравится

              Maybe it's even wrong, because it's unofficial anyway, and I didn't check it rigorously. I hope Korea can get gold.

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

      what is the distribution of 203 points btw?

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

Result of Vietnam: user202729_ scored 243, minhtung04042001 scored 233, and 5 others got 203.

I guest all people with 203 will get silver medals. (Actually no medal, but certificates saying that they are silver medalists).

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

Okay, so here is the known result of Japan:

Results in Japan

My first guess of medal borderline was 243/203/something, but since there could many participants than usual because of ties, it is possible that even I may get gold medal :)

P.S. I solved two problems (A and C) in 66 minutes :)

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится
Spoiler
»
5 лет назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

This thread will spoil the contest for participants of APIO Open, it's better not to discuss, or to hide solutions and warn not to read the future participants.

»
5 лет назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится
Top 3 in Kazakhstan:
»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by Noam527 (previous revision, new revision, compare).

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

Problems were pretty standard, almost trivial ideawise. Quite sad cause APIO had high problem quality. (I wanted to do call for tasks, but was too busy :( )

Can anyone solve B in $$$O(m^{1+\epsilon})$$$ time for $$$\epsilon > 0$$$, possibly using very complicated data structures?

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

    As far as I know, zero problems was received from call for tasks :)

    I'm not problem setter, so this information may be outdated, totally wrong, or something else.

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

    The ideas were not difficult to figure, and I also think the solutions relied heavily on constant factor... overall, didn't really like the problems.

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

    I also think problems are pretty standard and boring. Maybe somehow they only received some data structure problems.

    some narcissism
    • »
      »
      »
      5 лет назад, # ^ |
      Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

      Wow, I admire your skill in constant time optimizations!

      Actually, I've solved problem A and C in 66 minutes total. And I spent only another 9 minutes to get solution of problem B. And rested 25 minutes. Then, for another 100 minutes, I considered about existence of solution of which faster than $$$O(n^{1.5} \times \alpha(n))$$$ because I thought it is risky to implement, but my thinking failed. After that, I implemented + debugged my code and it took 40 minutes. I used remaining 60 minutes completely on constant optimization of it.

      However, I only got 27 points on problem B. I'm really bad at constant optimization...

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

        Is there anyone who spent 1hr for squeezing segment-tree based approach on A? Funny that I did, and succeeded XD

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

          Why did you need a segment tree on A? I think the common solution is finding period and sweepline.

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

            I plotted (x mod T, y) in a plane and calculated the area of union of rectangles. After contest I found out I was stupid, as usual.

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

          I tried, but after several hours I only got to 30 points :/

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

        I've met the same problem: solving A and C, spending loads of time on the O(n sqrt(n) alpha(n)) algorithm of B and getting only 27 points eventually.

        By the way, will the contestants' source codes be made public?

»
5 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится
Some whining about results
Asking for help to find a problem in the solution
  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +8 Проголосовать: не нравится

    I think std::set is a bad idea.. I know it's linear time, but still. I implemented everything on array, maintaining it sorted by merging original edge set with an updated edge set ($$$O(B\log B + M)$$$). I didn't saw anyone who skipped this optimization and pass.

    Also for me, optimal bucket size was 800.

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

    I think you can change your 'microdsu' to a dfs.

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

      dfs and bfs are not working good because of the vectors that i need to use to create graph

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

        You can use linked list to store edges. That worked fine for me.

        Also, you can just open a array of n*sqrt(n) and use it as 'vector's to store edges.

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

          Thank you, now it works faster, but i can't get 100 :( (check reply to the koo_saga comment)

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

Where can i see standings?

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

I'm too old to take part in APIO now but I'm really curious as to what's the solution for B... no one I know managed to solve it. Can someone who has solved it give me a rough outline of the solution? Thanks :)

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

    It is a standard square root decomposition problem.

    Brief Outline: Divide the queries into $$$\sqrt{Q}$$$ buckets. For each bucket, note that at most $$$\sqrt{Q}$$$ edges have weights unchanged within the bucket. Sort all the queries by decreasing weight in the bucket, and maintain a DSU while adding edges that are not modified within the bucket one by one. For edges with weight modified in the bucket, we iterate through all of them and then add them to the DSU if they are usable, then remove them after we are done with a query (so $$$\sqrt{Q}$$$ additions and removals per query). This can be implemented with DSU with rollbacks.

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

      "DSU with rollbacks" — How is this implemented, with still $$$O(\alpha(n))$$$? (Providing some vague idea is fine)

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

        Use dfs instead of dsu here.

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

        Create a stack to record what you merged, then for every "undo" operation you can just look at the top of the stack and undo the changes (by reassigning values in the dsu array) and then pop from the stack. It's at most $$$O(\log n)$$$ since you still merge small to large (but don't do path compression).

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

          I understand — I guess this would not fit in the time constraint for this specific problem though.

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

            My solution using this method passed, though with some slight optimizations (I kept getting 71 at the beginning).

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

        You don't need to use "dsu with rollback". In each block, you can add edges that covers the whole block from big to small using dsu. And to answer each query, just simply connect the extra edges on this query and run dfs. (When connect these edges you can just regard a connected component as a single vertex with weight.)

        Using "dsu with rollback" will bring a log.

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

when will they be available for practice?

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

How many points have gold medals?

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

https://apio2019.ru/results/official-contest/ shows 104 medalists with 201 official contestants. Either I am not good at math or the APIO 2019 committee has clearly violated the regulations they provided themselves.

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

    I believe this is the solution for cut-off the team leaders selected:

    Get temporary standings according to top 6 people for each country, get medal cutoffs, include all participants that are tied, and give medals according to cutoffs calculated before, standings will contain more than 6 people for some countries

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

Hi! any news for testdatas? niyaznigmatul PavelKunyavskiy

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

You can solve all problems here: https://oj.uz/problems/source/389

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

    In problem B, both setter's and checker's solution got TLE on oj.uz (I downloaded them here)

    setter: weight_restriction_nb.cpp
    checher:sol_hanh.cpp

    Also, their description files are quite funny.

    File name: weight_restriction_nb.cpp
    Tag: TIME_LIMIT_EXCEEDED_OR_ACCEPTED
    Author: BudAlNik
    Change time: Sat May 18 02:22:51 MSK 2019
    
    File name: sol_hanh.cpp
    Tag: TIME_LIMIT_EXCEEDED_OR_ACCEPTED
    Author: BudAlNik
    Change time: Sat May 18 02:16:26 MSK 2019
    
»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For problem A In this solution it says that

Let f(x) = {(x + x / b) % a, x % b}

It's possible to prove that f(x) is periodic with smallest period = ab / gcd(a, b + 1)

How do I prove this?

please note that I have no experience in finding periods of periodic functions. If you can direct me to some resources that'll be great too.

thanks

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

    can someone help us, please ?

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

      Regarding what?

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

        For problem A In this solution it says that

        Let f(x) = {(x + x / b) % a, x % b}

        It's possible to prove that f(x) is periodic with smallest period = ab / gcd(a, b + 1)

        How do I prove this?

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

          I'll try to answer your question, if you haven't answered it by now.

          Suppose we are examining times $$$t_0$$$ and $$$t_1$$$. We know that our tuples are:

          $$$\left( \left( t_0 + \Bigl\lfloor \frac{t_0}{B} \Bigr\rfloor \right) \pmod{A}, t_0 \pmod{B} \right)$$$

          $$$\left( \left( t_1 + \Bigl\lfloor \frac{t_1}{B} \Bigr\rfloor \right) \pmod{A}, t_1 \pmod{B} \right)$$$

          We want to know when the two tuples are equal to each other. We know that $$$t_0 \equiv t_1 \pmod{B} \Longrightarrow t_0 = t_1 + KB$$$ for some $$$K \in \mathbb{Z}$$$. So now we want to know when

          $$$\left( t_0 + \Bigl\lfloor \frac{t_0}{B} \Bigr\rfloor \right) \equiv \left( t_1 + \Bigl\lfloor \frac{t_1}{B} \Bigr\rfloor \right) \pmod{A}.$$$

          Replacing $$$t_0 = t_1 + KB$$$, we have that:

          $$$\left( t_1 + KB + \Bigl\lfloor \frac{t_1 + KB}{B} \Bigr\rfloor \right) \equiv \left( t_1 + \Bigl\lfloor \frac{t_1}{B} \Bigr\rfloor \right) \pmod{A}.$$$

          A nice property of the floor function is that $$$\lfloor A/B \rfloor = \lfloor (A + KB)/B \rfloor$$$ for $$$K \in \mathbb{Z}$$$. Using this, we see that:

          $$$\left( t_1 + KB + K+ \Bigl\lfloor \frac{t_1}{B} \Bigr\rfloor \right) \equiv \left( t_1 + \Bigl\lfloor \frac{t_1}{B} \Bigr\rfloor \right) \pmod{A}.$$$

          Using some grade school level arithmetic, we have that:

          $$$KB + K \equiv 0\pmod{A}.$$$

          From here we see that $$$K$$$ has period $$$\frac{A}{\text{gcd} (A, B + 1)}$$$. So $$$KB$$$ has period $$$\frac{A \cdot B}{\text{gcd} (A, B + 1)}$$$.

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

How to solve problem C?