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

Автор chrome, история, 8 лет назад, перевод, По-русски

Привет!

Завтра в 19:00 MSK состоится TCO16 Round 1A.

Прочитать про TCO16 можно здесь.

И еще, количество участников ограничено, только 2500, и максимальное количество участников которые проходят на следующий тур — 750.

Предлагаю обсудить задачи после контеста.

GL && HF!!!

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

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

registration started , register soon since number of people allowed to participate are limited(2500)

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

Is it a rated contest?

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

What is the idea of 1000!!!

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

    Greedy approach is ok, try the least index to go now and check whether it is possible to finish process from current state.

    To check it one can prove that it is optimal to go to the deepest node from current one every time.

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

      Could not understand, what should be done in case of walking to the least index from current state doesn't brings to finish?
      Try the next unvisited least index or something else? If try the next — it's looks like bruteforce.

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

        We pick node with the least index and trying to find some answer(maybe not optimal one). If we can find it, we take this node to answer and trying to make next move, or try to pick node with greater index and so on.

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

          find some answer (maybe not optimal one)

          Still could not understand.. How to do it? Dirac's theorem about hamiltonian path or something else?

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

            To check if answer exists, every time we should go to the deepest node which is reachable from current one.

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

Is there any way to solve 1000 in O(N3)?

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

    Yep.

    Let's do the following process: suppose we have a function that is able to, given a sequence of already visited vertices (we are staying at the last vertex of that sequence), tell if this sequence can be extended to a correct permutation. Having such function, we can determine the answer in O(n2) calls of it by restoring the elements of the desired permutation one by one.

    Now we need to implement such function. This can be done via pretty easy DP, smth like D[v] =  minimum number of vertices above v we should visit in order to visit all vertices in the subtree of v. It can be calculated in O(n).

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

    If you can check if there exists a sequence starting with a1, a2, ... in O(N) then you can solve the question in O(N^3).

    To do this: we remove all the vertices in the sequence that we already decided to use from the tree: so if we decide to go to 2, then all of 2's children are now children of 2's parents, etc. Now we can perform a tree dp[], taking special consideration of which is the last a_i we decided to use.

    dp is number of times you need to leave the subtree.

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

      Could you please provide a link to your source code here?

      It would be helpful for me to understand the solution.

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

    Interestingly enough there is even an O(N^2) solution. The main idea is that you can find nodes that are "good to go to" without breaking the traversal of the tree in O(N). If you are interested you can see my code in the practice rooms. As a problem setter I decided to not give it with N <= 1000 xD

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

Not related to problem.

I am getting the above error. I tried reinstalling java, using javaws to run it from command line, downloading the applet again.

There is one solution where I have to add the site as exception list in java. But I don't know the exact site address of topcoder. If someone knows please help.

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

    I had the same problem and resolved it using your solution: added "http://www.topcoder.com" to the list of exceptions.

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

    i had the same problem. and i solved it finding the "java control panel".

    There you choose the sequrity tab and set it to medium .

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

      I think allowing medium would be riskier for other application. We actually trust topcoder that's why added it as exception :)

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

    I had the same issue and decided to try web applet, in my opinion it worked fine but it was difficult to find things like how enter to the contest, open a problem, test a code, and finally I couldn't find how to see the global ranking.

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

    Thank you! Now I can write 1001 reasons to hate the Arena! I only had 1000 till date!

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

can anybody please explain div-2 500 by binary search and DP ??

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

    Suppose you have another problem, you have an array A and an integer D, what is the maximum number of disjoint pairs you can form where a pair(x, y) can be formed if abs(A[x] — A[y]) <= D, this can be solved by dynamic programming in O(N^2).

    In the original problem we can binary search D.