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

Автор JianfengZhu, история, 12 месяцев назад, По-английски

You are given a permutation of $$$n$$$. Build an undirected graph of $$$n$$$ nodes. There is an edge $$$(i,j)$$$ if and only if $$$i<j$$$ and $$$p_i < p_j$$$. Please find the maximum matching of the graph.

I don't know how to do it in $$$O(n \log n)$$$.

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

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

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

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

https://codeforces.com/gym/103627/problem/D is basically that. I only have polylog solutions, but I cited some sources that claim O(n log log n) solutions.

»
12 месяцев назад, # |
  Проголосовать: нравится -96 Проголосовать: не нравится

I gave ChatGPT this. then it gives me this. Code with a bit of explanation Um have no idea whether it is correct or not xd

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

    Not only is it too slow, but it's also wrong and I think it's due to its sqrt ""optimisation"". I instantly hacked it with the permutation 1 5 3 8 4 2 9 7 6 10.

    Don't rely on ML tools for code. They're mistake generators.