Permutation Game
시간 제한2초메모리 제한2048 MB
연결 그래프와 순열이 주어질 때 두 사람이 최선을 다해 플레이한 결과값을 구하고, 시뮬레이션 상대를 이겨 그 값 이상을 달성한다.
문제
Alice and Bob are childhood friends, and they love playing intellectual games. Today, they are playing a new game on graphs.
The game set contains a connected graph with vertices, numbered from to , and edges, numbered from to . The -th edge connects vertices and .
The game set also contains a permutation of length , where . Permutation is an array in which each number from to appears exactly once, in some order. The score of permutation is the number of indices such that .
The game will last for at most turns. In each turn, the following happens:
- If Alice decides to end the game, the game stops.
- Otherwise, Alice chooses distinct indices , where . Note that, the game does not require .
- Bob chooses an index of the edges of the graph and swaps and .
Alice wishes to maximize the final score of the permutation while Bob wishes to minimize the final score of the permutation.
Your task is to help Alice and play against Bob, whose moves are simulated by grader.
Let's define optimal score as the final score of the permutation if both Alice and Bob play optimally.
You will need to determine the optimal score of the permutation and then play the game with Bob to achieve at least that optimal score after some turns.
Note that Alice's strategy should work no matter what moves Bob makes, including if Bob makes unoptimal moves.
제한
- The graph is connected, contains no self-loops or multiple edges.
- is a permutation, i.e. for any .
예제
이 문제는 공개된 예제가 없습니다.