Given a directed graph, output YES
if it is acyclic, and NO
otherwise.
Input Specification
An adjacency matrix, 0
or 1
).
Output Specification
YES
or NO
.
Sample Input 1
Copy
3
0 1 0
0 0 1
1 0 0
Sample Output 1
Copy
NO
Sample Input 2
Copy
3
0 1 0
0 0 1
0 0 0
Sample Output 2
Copy
YES
Comments