2023春-A-3 K Vertex
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目描述
Given a directed graph, a K-vertex is a vertex of which the out degree is larger than the indegree. For example, the vertices a and b in the figure are K-vertices.

Your job is to list all the K-vertices in a given graph.
输入格式
Each input file contains one test case. For each case, the first line contains 2 positive integers: () and , which are the number of vertices and the number of edges, respectively. Then lines follow, each gives a directed edge < v1 , v2 > in the format:
v1 v2
Here we assume that all the vertices are numbered from to . It is guaranteed that v1 is never the same as v2.
Finally a line of strings is given, where the -th string corresponds to the key of the -th vertex (). Each string consists of no more than 2 lower-cased English letters.
输出格式
Output the keys of all the K-vertices, each occupies a line, in alphabetical order. It is guaranteed that there is at least one output.
样例
4 5
0 1
2 1
3 1
2 0
3 2
c d b a
a
b
限制
Java (javac) 时间限制 900 ms 内存限制 256 MB
其他编译器 时间限制 400 ms 内存限制 64 MB