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

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

I've been trying to solve this problem from Timus OJ using max flow. Since the constraints are small, it can be brute-forced easily (checking all subsets of teams). Can there be any possible solution using max flow?

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

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

No, this problem is NP hard.

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

I have had been trying to solve this problem and could not find it's proper solution on internet. I have written a brute force solution which gives me TLE on test case 7. Can you please share your brute force solution ?

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

    Try to get rid of using map for each mask. For instance you can transform every teams to three numbers (before iterations over masks), and then just to use boolean array.