• 沒有找到結果。

DRM Inc. is a firm that produces digital road maps. A digital map is a set of places and a set of streets between places. Streets are not oriented, i.e., they are two-way streets.

N/A
N/A
Protected

Academic year: 2021

Share "DRM Inc. is a firm that produces digital road maps. A digital map is a set of places and a set of streets between places. Streets are not oriented, i.e., they are two-way streets."

Copied!
2
0
0

加載中.... (立即查看全文)

全文

(1)

11336 DRM

DRM Inc. is a firm that produces digital road maps. A digital map is a set of places and a set of streets between places. Streets are not oriented, i.e., they are two-way streets.

A road between a place a and a place b is a sequence of places ⟨u

0

, u

1

, ..., u

n

⟩ such that a = u

0

, b = u

n

, and there is a street between u

i

and u

i+1

for 0 ≤ i < n.

The definition of a map is accomplished incrementally: a new version of a map is built adding details to an already defined one. The new map must be consistent with the old one, i.e., the new one must be more detailed than the old one, in the sense that

• the new map has at least the same places than the old one;

• for every street between places u and v in the old map, in the new one there is a road between u and v. Any intermediate place of this road must be a new place (not considered in the old map).

DRM building process includes a comparison step between consecutive map versions in order to assure consistence between them. You must help DRM to evaluate if a map is more detailed than another one.

Input

A map is represented with several input lines:

• the first line contains an identifier for the map

• the following lines, except the last one, contains identifiers of two places that define a street between them. Identifiers are separated with a blank character. It is guaranteed that a street is described only once, but places naming it could be given in any order. On the other hand, streets are named without any specific order.

• the last line contains the string ‘* * *’ (star, blank, star, blank, star).

An identifier is a character string without blanks.

The problem input describes several cases, each one consisting of a pair of map representations. For each case you must evaluate if the second map of the given pair is a more detailed version of the first one.

The end of the input is specified by a line with the word END.

Output

Output texts for each input case are presented in the same order that input is read.

For each pair of maps named < id1 > and < id2 >, if the map named < id2 > is more detailed than the map named < id1 >, an output line of the form

YES: < id2 > is a more detailed version of < id1 >

must be written. In other case, the output must be of the form

NO: < id2 > is not a more detailed version of < id1 >

(2)

Universidad de Valladolid OJ: 11336 – DRM 2/2

Sample Input COL1

Bogota Cali

Bogota Barranquilla

* * * COL2

Barranquilla Bogota Armenia Cali

Barranquilla Armenia Bogota Cali

Cali Barrranquilla

* * * COL1

Bogota Cali

Bogota Barranquilla

* * * COL3

Bogota Armenia Armenia Cali Cali Medellin

Medellin Barranquilla

* * * END

Sample Output

YES: COL2 is a more detailed version of COL1

NO: COL3 is not a more detailed version of COL1

參考文獻

相關文件

•The PROC directive declares a procedure with an optional list of named parameters. an optional list of

在撰寫網頁應用程式 HTML 的語法當中,以下何者錯誤?(A)&lt;a&gt;是用來製作超連結的標記(Tag) (B)HREF 是一個在&lt;a&gt;與&lt;/a&gt;中指定其他

&lt; Notes for Schools: schools are advised to fill in the estimated minimum quantity and maximum quantity (i.e. the range of the quantity) of the items under Estimated Quantity

• A way of ensuring that charge confinement does occurs is if there is a global symmetry which under which quarks (heavy charges) are charged and the gluons and other light fields

 for…迴圈自初值開始判斷 &lt;條件判斷&gt; 是否為 true,若為 true 則執行 for 迴圈內的敘述,並依 &lt;增量值&gt;,每次增 加 (或減少) 指定的增量值,直至 &lt;條件判斷&gt;

• An algorithm is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output.. • An algorithm is

In digital systems, a register transfer operation is a basic operation that consists of a transfer of binary information from one set of registers into another set of

Debentures are (3) loan capital and are reported as (4) liabilities part in the statement of financial position. No adjustment is required. If Cost &gt; NRV, inventory is valued