아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Win As Second

시간 제한60초메모리 제한1024 MB

요약
N이 주어지면 색칠 게임에서 후공이 이기는 N개 정점의 트리를 출력한다.
난이도

보통10점 중 6점

유형
게임 이론, 트리, 그리디
정답자
아직 제출이 없습니다

문제

Ueli and Vreni are playing a game. The game's board is a tree with N\mathbf{N} vertices, all initially colored blue. They alternate turns, with Ueli going first. In each turn, a player must choose a blue vertex, together with any subset (possibly none or all) of its blue neighbors, and color all those vertices red. If at the start of a players' turn, all vertices are red, then that player loses the game and the other player wins the game.

In the example game below, Ueli colored vertex 33 red in their first turn. Then, Vreni chose vertex 22 for their turn and colored both it and its neighbor (vertex 11) red. Because all vertices are now red, Ueli loses and Vreni wins.

Ueli and Vreni have noticed that it is much easier for Ueli to win this game because he has the first turn. Therefore they have adopted the following procedure: first, Ueli chooses an integer N\mathbf{N}. Then, Vreni chooses any tree with N\mathbf{N} vertices. And then they start playing as described above, with Ueli taking the first turn.

Vreni is hopeful that being able to choose the tree can help her overcome the disadvantage of going second. Can you demonstrate how Vreni can win games in this setup?

제한

  • 1≤M≤501 \le \mathbf{M} \le 50.

예제1

  1. 예제 1

    입력
    2
    3
    
    
    1
    1
    3
    
    
    4
    
    
    
    2
    3
    2 1 3
    
    
    2
    2 3
    
    
    -1
    
    예상 출력
    
    
    1 2
    1 3
    
    
    
    2
    1 2
    
    1 2
    2 3
    2 4
    
    
    
    1
    4
    
    
    1
    1