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

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

Today I implemented the intended solution of 1767E

Which unexceptedly got TLE...

Then I tested the sample which input is small (n=10, m=40) and recorded the time consuming of each step in my first solution

I discoverd that when good mask1 of vertex set A (1-m/2) is too much (about 2^19), the preparation of dp takes very long time (about 1000ms on my computer but 1700+ms on official judge)

However, in most of test samples the time consuming is not that much beacuse of a smaller set of good mask1. So I thought about if I permute the number of colors randomly......

In 1st attempt I still got TLE, but after changed the seed of java.util.Random, I got AC in the 2nd attempt

(I know there must be better implementation but I'm lazy QwQ)

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

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

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

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

Why downvote??

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

The solution with $$$O(2^{\frac{n}{2}})$$$ is the correct solution but maybe java is too slow... You can also try Bron's algorithm with $$$O(3^{\frac{n}{3}})$$$ which is a little faster. See the fastest code or my solution: 185938971