1 / 8

11336: DRM

11336: DRM. ★★★★☆ 題組: Problem Set Archive with Online Judge 題號: 1 1336: DRM 解題者: 蔡權昱 解題日期: 200 8 年 12 月 1 日 題意: 有數位版的地圖,要你判斷新版的有沒有比舊版的詳細。地圖是無向圖,且有 N 個點。 詳細 必須符合以下兩點: 1. 舊版地圖上的點,新版都要包括。 2. 對於每個舊版上的邊,新版上的地圖都必須有一條路徑,使得路徑中所有經過的點 ( 如果有的話 ) 都是舊版上沒有的。. 題意範例: Sample input COL1 Bogota Cali

lucine
Download Presentation

11336: DRM

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. 11336: DRM • ★★★★☆ • 題組:Problem Set Archive with Online Judge • 題號:11336: DRM • 解題者:蔡權昱 • 解題日期:2008年12月1日 • 題意:有數位版的地圖,要你判斷新版的有沒有比舊版的詳細。地圖是無向圖,且有N個點。詳細必須符合以下兩點:1.舊版地圖上的點,新版都要包括。2.對於每個舊版上的邊,新版上的地圖都必須有一條路徑,使得路徑中所有經過的點(如果有的話)都是舊版上沒有的。

  2. 題意範例:Sample inputCOL1 Bogota Cali Bogota Barranquilla * * * COL2 Barranquilla Bogota Armenia Cali Barranquilla Armenia Bogota Cali Cali Barrranquilla * * * END // 讀到END代表輸入結束 Sample output YES: COL2 is a more detailed version of COL1

  3. 題意範例:Sample inputCOL1 • Bogota Cali • Bogota Barranquilla • * * * • COL3 • Bogota Armenia • Armenia Cali • Cali Medellin • Medellin Barranquilla • * * * • END • Sample outputNO: COL3 is not a more detailed version of COL1

  4. 解法:Connected Component • 設舊地圖為G,新地圖為G‘,接著我們對G’ – G 的那些點做Connected Component(去掉所有連回G的edge)。 • 然後對於G上所有的edgee(s,v)做以下檢查: • 如果該e(s,v)也出現在G‘上,OK(中間沒有點)。 • 如果沒有的話那想辦法找到一條路徑是s to CC,和一條路徑是CC to v,這樣也是OK(中間的都是新點)。 • Otherwise,Fail。 • PS. CC 是一開始做的 Connected Component。

  5. 解法範例: • G • A B • B C • A C • G’ • A B • B C • A D • D E • E C Old map G New map G’ A B A B C D C E

  6. 解法範例: • G • A B • B C • A C • G’ • A B// same edge, skip • B C • A D • D E • E C Old map G New map G’ A B A B C D C E

  7. 解法範例: • G • A B • B C • A C • G’ • A B • B C // same edge, skip • A D • D E • E C Old map G New map G’ A B A B C D C E

  8. 解法範例: • G • A B • B C • A C • G’ • A B • B C • A D • D E • E C Old map G New map G’ A B A B C D C E Connected Component A to CC and CC to C found! OK!

More Related