D. Captain Flint and Treasure(拓扑排序+贪心)

NoSuchKey