1 / 13

Lucky Dip

Lucky Dip. 原案 : 津島 テスト : 伊藤,西出. 問題概要. W * H で壁と目的地が 与えられる (x, y) の壁が一つずつ除去される 何個取り除いたら (0, 0) から到達できるか. 解法. 塗りつぶし ただし,毎回 (0, 0) からでは間に 合わない 探索の状態を保存 して 開放 した 床 から 続ける O(W*H) Union Find Tree Y * W + X で番号付け 入力時に↑と←の床を unite 空いたら周りの床を unite O(α(W*H)). 塗りつぶし. .....#....

lita
Download Presentation

Lucky Dip

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lucky Dip 原案: 津島 テスト: 伊藤,西出

  2. 問題概要 • W * H で壁と目的地が与えられる • (x, y)の壁が一つずつ除去される • 何個取り除いたら(0, 0)から到達できるか

  3. 解法 • 塗りつぶし • ただし,毎回(0, 0)からでは間に合わない • 探索の状態を保存して開放した床から続ける • O(W*H) • Union Find Tree • Y * W + X で番号付け • 入力時に↑と←の床をunite • 空いたら周りの床をunite • O(α(W*H))

  4. 塗りつぶし .....#.... .....#.... .....#.... ######.... .......... ####...... ....###... t..#..#### ...##..... ....#...##

  5. 塗りつぶし vvvvv#.... vvvvv#.... vvvvv#.... ######.... .......... ####...... ....###... t..#..#### ...##..... ....#...##

  6. 塗りつぶし vvvvv#.... vvvvv#.... vvvvv#.... .#####.... .......... ####...... ....###... t..#..#### ...##..... ....#...##

  7. 塗りつぶし vvvvv#vvvv vvvvv#vvvv vvvvv#vvvv v#####vvvv vvvvvvvvvv ####vvvvvv ....###vvv t..#..#### ...##..... ....#...##

  8. 塗りつぶし vvvvv#vvvv vvvvv#vvvv vvvvv#vvvv v#####vvvv vvvvvvvvvv v###vvvvvv vvvv###vvv tvv#..#### vvv##..... vvvv#...##

  9. Union Find Tree .....#.... .....#.... .....#.... ######.... .......... ####...... ....###... t..#..#### ...##..... ....#...##

  10. Union Find Tree .....#.... .....#.... .....#.... .#####.... .......... ####...... ....###... t..#..#### ...##..... ....#...##

  11. Union Find Tree .....#.... .....#.... .....#.... .#####.... .......... .###...... ....###... t..#..#### ...##..... ....#...##

  12. 想定解答 • 塗りつぶし, C++ • 72行, 1688[byte] • UnionFindTree, C++ • 86行, 1878[byte]

  13. 結果 • First Acceptance • オンサイト: • オンライン: • Accept/Submit

More Related