South Pacific Regional Finals 2017 Problem B: Banner Help

Revision en2, by sturdyplum, 2018-03-26 18:21:31

I've been working on this problem for a while but can't find an efficient solution. So far my solution runs in about 40 seconds worst case. However the time limit is only 6 seconds. There seems to be no editorial for this contest and it went unsolved during the contest. My solution is bellow. Basically I am doing a backtracking solution that has some amount of memoization, and uses Hungarian matching to do heavy pruning. I was wondering if anyone has solved this problem or could offer some insight to how to solve it. Thank you!

PROBLEM & DATA

MY CODE

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English sturdyplum 2018-03-26 18:21:31 6296
en1 English sturdyplum 2018-03-26 18:19:03 7071 Initial revision (published)