-->
当前位置:首页 > 题库

PROGRAMMING:Order of speech

Luz5年前 (2021-05-10)题库368
A company holds a project discussion meeting and requires every employee to speak. In order not to offend the employees with high rank, it is stipulated to speak in the order of high rank. The employees with high rank speak first, and the employees with low rank speak later. However, the company's rank system is very chaotic. At present, it only knows the superior subordinate relationship among some employees, so it is difficult for the host to find a comprehensive and reasonable speaking order. Please write a program to help the moderator determine a reasonable speaking order. Suppose there are n participants, numbered 0 to n-1.
###Input format:
Enter two integers n and E in the first line, both of which are no more than 300. N is the number of participants. Next, line e, where e is no more than 100, indicates the known level relationship between two employees. Each line has two integers a and B, indicating that employee a is the superior of employee B.
###Output format:
The output is a line of integers, and a space after each integer is the number of N employees, indicating the speaking order of N employees. If there are many possible orders, the output is the lowest dictionary order.
Note: dictionary order is the order of objects in the dictionary. For two digit sequences, the comparison starts from the first digit. When the digits in a certain position are different, the lexicographic order of the sequence with smaller digits in that position is smaller, for example, 1239 is smaller than 1245.
###Input example:
```in
4 3
0 1
1 2
2 3
```
###Output example:
```out
0 1 2 3
```







answer:If there is no answer, please comment