TooDumbToWin's blog

By TooDumbToWin, history, 7 years ago, In English

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?

  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?
»
7 years ago, # |
  Vote: I like it +5 Vote: I do not like it

No, this problem is NP hard.

»
7 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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.