| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12225 | Quiz2 (Bus Route Linked List) |
|
Description
[ 一定要用自己實現的 linked list 完成! ]
A bus route editor needs to support two operations:
INSERT (src, dst, new, method)
- src: the name of the source bus stop
- dst: the name of the destination bus stop, which is next to the src stop
- new: the name of the newly added bus stop
- method:
- 1: insert the new stop in between src-->dst
- 2: In addition to src-->dst, also insert the same stop in between dst-->src if appropriate
RENAME (old_name, new_name)
- Replace the name of all bus stop from the old_name to the new_name
The bus route contains NTHU and TSMC in the beginning. After performing the operations, you are required to output:
- The total number of stops starting from NTHU and back to NTHU (NTHU is only counted once)
- Minimum number of stops of each src-dst pair (from src to dst)
- If src or dst does not exist, output “Missing src”, “Missing dst”, or “Missing both”
You can redirect cin to a string according to problem 12156
Input