#Q245. 「一本通 6.7 例 3」移棋子游戏
「一本通 6.7 例 3」移棋子游戏
Description
Given a directed acyclic graph (DAG) with nodes, some of the nodes contain chess pieces. Two players take turns moving the pieces.
Each move consists of moving any one piece along a directed edge to another node. The player who cannot make a move loses the game.
For the given graph and initial positions of the pieces, assuming both players play optimally, determine whether the first player has a winning strategy or not.
Input Format
The first line contains three integers , where is the total number of nodes in the graph, is the number of edges, and is the number of chess pieces.
The next lines each contain two integers and , representing a directed edge from node to node .
The following line contains space-separated integers, indicating the initial positions of the chess pieces.
Output Format
If the first player has a winning strategy, output win. Otherwise, output lose.
Sample 1
6 8 4
2 1
2 4
1 4
1 5
4 5
1 3
3 5
3 6
1 2 4 6
win
Constraints and Hints
For all test cases, .