시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
3 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 61 | 31 | 29 | 54.717% |
Yunee is going to challenge Woongbae with a game that Yunee invented. Yunee's game is called the Vertex Merge Game and it is played on an edge-weighted connected graph. The game consists of several rounds, and each round proceeds as follows.
Repeat the rounds until there is only one vertex left in the graph. Then the game ends, and the person with higher total points wins the game.
Given a graph, find out who wins the game when both Yunee and Woongbae play the game optimally. Note that their goal is to win the game, not to maximize their points.
The first line contains two integers $N$ and $M$ $(2\leq N \leq 100,000, 1\leq M \leq 300,000)$. $N$ is the number of vertices and $M$ is the number of edges.
The next $M$ lines describe the edges of the graph. The $i$-th line contains three integers $u_i, v_i, w_i$ $(1\leq u_i, v_i \leq N, 0 \leq w_i \leq 10^9)$. It represents an edge connecting $u_i$ and $v_i$ with a weight $w_i$.
It is guaranteed that the given graph is connected.
If Yunee wins, output win
. If Woongbae wins, output lose
. If there is a tie, output tie
.
3 3 1 2 3 1 3 4 2 3 1
lose
In the first example, the game may proceed as follows.
Yunee has $3$ points and Woongbae has $7$ points in total. Woongbae wins the game.