#P3727. 曼哈顿计划E
曼哈顿计划E
Description
Aiden tries to hack into dedsec’s system and seize control, but dedsec responds and fights back.
The dedsec network can be regarded as a connected graph with nodes and edges (a tree). Each node has a stability value.
Aiden may choose a chain (a simple path) in the network and hack all nodes on that chain (i.e., detach that chain from the tree).
Suppose the chain has length (i.e., it contains nodes). You will then obtain nodes, and the game is played only on these nodes.
Aiden and dedsec then start a battle of moves. They take turns. Each move, a player may choose any node with a stability value greater than and perform an operation according to the rules below. After the operation, the stability value of that node must not become less than , otherwise the computer will explode. The player who cannot make a move loses.
Because dedsec has the advantage of defense, dedsec moves first.
Although Aiden is skilled at hacking, his phone ran out of battery. He has sent this information to you, hoping you can help save the world. You need to write a program to determine whether there exists a way for Aiden to win. Of course, dedsec’s defense might be flawless, and Aiden may not be able to win at all—in that case, you’ll have to run to the shelter and become a test subject.
Input Format
The input contains multiple test cases. The first line contains an integer , the number of test cases.
For each test case:
- The first line contains an integer , the number of nodes.
- The next lines each contain two integers , indicating an edge between and in the network.
- The next line contains integers , where denotes the stability value of node .
- The next line contains an integer , describing the move rules:
- If , you may decrease the stability by any positive integer.
- If , the next line contains a positive integer , and each move may decrease the stability by a non-negative integer power of .
- If , the next line contains a positive integer , and each move may decrease the stability by any integer greater than or equal to .
- If , each move you may either decrease the stability by any positive integer, or split a node with stability at least into two nodes whose stability values sum to the original (for example, split into ).
- If , neither player can make any move.
Output Format
For each test case, output one line:
If there exists a way for you to win, output Mutalisk ride face how to lose?.
If there is no way to win, output The commentary cannot go on!.
1
3
1 2
2 3
1 2 3
1
Mutalisk ride face how to lose?
1
3
1 2
2 3
1 2 4
1
The commentary cannot go on!
Hint
| Test point | |||
|---|---|---|---|
For of the testdata, .
All inputs are positive integers.
Translated by ChatGPT 5
京公网安备 11011102002149号