Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
2.1 kB
3
Indexable
1

init(4, 4, {{1, 2}, {1, 3}, {2, 3}, {2, 4}})

 

 

Refer to [Fig. 1].

2

addRestaurant(1, “abba”)

 

 

 

3

bestValue(“abb”)

0

abba

“abba” is the name of a restaurant which includes “abb.”

4

addRestaurant(2, “abb”)

 

 

 

5

addValue(“abb”, 3)

 

 

 

6

bestValue(“a”)

3

abb

“abb”, “abba” are the names of restaurants which include “a.”

The value of “abb” is 3 and that of “abba” is 0.

7

addRestaurant(4, “abbc”)

 

 

 

8

addValue(“abbc”, 4)

 

 

 

9

bestValue(“b”)

4

abbc

“abbc”, “abb”, “abba” are the names of restaurants which include “b.”

The respective values of “abbc,” “abb, ” and “abba” are 4, 3, and 0.

10

addValue(“abb”, 5)

 

 

 

11

bestValue(“bb”)

8

abb

“abb”, “abbc”, “abba” are the names of restaurants which include “bb.”

The respective values of “abb,” “abbc,” and “abba” are 8, 4, and 0.

12

bestValue(“c”)

4

abbc

“abbc” is the only restaurant whose name includes “c.”

13

regionalValue(3, 0)

0

 

There is no restaurant that can be reached.

14

addRestaurant(3, “sam”)

 

 

 

15

addRestaurant(3, “sung”)

 

 

 

16

addValue(“sam”, 5)

 

 

 

17

addValue(“sung”, 1)

 

 

 

18

regionalValue(4, 1)

12

abb : 8

abbc : 4

The restaurants in City #2 and #4 can be reached. In other words, “abb” and “abbc” can be reached.

19

regionalValue(3, 1)

14

abb : 8

sam : 5

sung : 1

The restaurants in City #1, #2, and #3 can be reached. In other words, “abba”, “abb”, “sam”, “sung” can be reached.

20

regionalValue(3, 0)

6

sam : 5

sung : 1

The restaurants in City #3 can be reached.

In other words, “sam” and “sung” can be reached.

21

regionalValue(3, 2)

17

abb : 8

sam : 5

abbc : 4

All restaurants can be reached.
Leave a Comment