New Villa Acmソリューション戦略

I am trying to solve this ACM problem The New Villa

この問題にどうやってアプローチするのかは分かりませんが、ドアや部屋を他の部屋に切り替えた部屋は、一般的なソリューションを作るのが非常に混乱しています。この問題のための戦略を定義する上で私の身体を助けることができますか? また、ACM問題のディスカッションフォーラムが必要です

ありがとう として


1 答え


各頂点は、 n +識別子のバイナリベクトルで表すことができます。[ n は部屋の数です。

G=(V,E) where V = {all binary vectors of size n and a recored for which room you are in} and E = {(u,v) | you can switch from binary vector u to v by clicking a button in the room you are in, or move to adjacent lights on room }



  1. BFS - simplest to program, though slowest run time
  2. bi - directional BFS - since there is only one target node, a bi-directional search will work here, it is expected to be much faster then BFS
  3. A* - find an admissible heurstic function and run informed A* on the problem. It is harder to program it then the rest - but if you find a good heurisitc, it will most likely perform much better.


(*) This solution runs in exponential time on the number of rooms, but it should end up for d <= 10 as indicated in the problem in reasonable time.