当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6565:The Magician

题目描述
In your quest to manifest your goals, it is essential that you establish a clear vision of what you wish to create and why you want to create it, before you take action. It is not simply enough to be motivated by ego (money, status, or fame) – you need to have a soul connection to your goals and intentions.

Background
Magician Alice and Bob are playing Magic Duel, which is an amusing turn-based game. Here goes the tutorial to the game. Their strategy and the process of the game are determined and all you need to do is to figure out the result.

Game Structure
The game consists of four separate areas containing several cards:Deck,Hand, Field, Grave.
Deck
The library of your cards – each turn you can draw a card from the top of the deck to your hand.
Hand
The collection of your available cards – each turn you can place a card from your hand to your field.
Field
The set of your active cards - the key to victory.
Grave
The place of all the discarded or destroyed cards.
Notice that the Field and the Grave are public (i.e. known to each other), whereas the Deck and Hand are private. All these four areas are independent for each player.

Process of the Game
Initially, each player draws five cards from the top of the deck, and two players play their own turns alternatively (Alice goes first). Each turn includes the following three phases in order.
Draw Phase
Draw a card from deck into hand. If the deck is empty this phase is skipped.
Main Phase
Select a card from hand, placing it into field and dealing corresponding effect. Player can choose to skip this phase.
End Phase
If the victory condition is reached by the player, he is announced to win immediately. Otherwise, switch the turn to the opponent.

Card Introduction
Two players’ decks consist of same cards but in different order. In each deck lie 25 cards in 5 categories evenly. In other words, each kind of cards contains 5 identical cards. Here goes the introduction to the effects produced by these cards when played.
Plain
Draw a card from the deck (if the deck is empty it has no effect).
Swamp
Enemy player selects a card from his hand and discard it into his grave (if enemy’s hand is empty it has no effect).
Mountain
Select a card inside enemy’s field and destroy it, sending it into enemy’s grave (if enemy’s field is empty it has no effect).
Island
No effect. However, in enemy’s turn, when enemy intends to play a card (notice that you don’t know the card’s type because it hasn’t entered the field), you can discard an island from your hand firstly and discard another card from hand as cost to counter-attack the card, sending it to enemy’s grave and preventing it from dealing any effects.
Forest
Select a card in his own grave and recycle it into his hand (if the grave is empty it has no effect).

Victory Condition
If the player has gathered five different kinds of cards in his field, he wins. If the game lasts 100 turns or both players have no cards in their decks or hands, it is a tie.

Strategy
Play Strategy
When selecting a card to play in Main Phase, the player labels his card in hand with three priority levels.
High Priority
There is no card of the same type in his own field and it has effect if played.
Medium Priority
There is no card of the same type in his own field but it has no effect if played.
Low Priority
There are cards of the same type in his own field.
For the cards with the same priority, the player selects them in the following order: Swamp, Plain, Mountain, Forest and Island. Notice that if the player only has low-priority cards in hand he will skip the Main Phase.

Discard Strategy
When player needs to discard a card from hand, this strategy works. The player will select the card with most occurrences in hand among all cards and discard it. For the cards with the same occurrences, player will select them in the following order: Island, Mountain, Plain, Swamp, Forest.

Destroy Strategy
When Mountain is played by player himself, he will select the card with the least occurrences in enemy’s field among all cards in enemy’s field and destroy it. For the cards with the same occurrences, player will select them in the following order: Forest, Island, Mountain, Plain, Swamp.

Counter-attack Strategy
When enemy intends to play a card, if enemy has gathered four kinds of card in his field and the number of the fifth kind of card in enemy’s grave is less than 5, player will choose to counter-attack. Obviously, player is required to have an Island and another card in his hand to have this done. The choice of cost card also follows the Discard Strategy.

Recycle Strategy
When player plays Forest, he selects the card with the least occurrences in his own field and hand among all cards in his grave and recycles it into his hand. For the cards with the same occurrences, the player will select them in the following order: Forest, Swamp, Mountain, Island, Plain.
输入解释
The first line contains a single integer $T$ ≤ 20000 indicating the number of tests.
For each test case, input contains two lines with 25 integers between 0 and 4 (inclusive) separated by spaces, representing the cards in Alice and Bob’s decks from top to bottom. 0, 1, 2, 3, 4 respectively stand for Plain, Swamp, Mountain, Island, Forest.
输出解释
For each test, start with “Case $i$:”, where $i$ indicates the number of the case, and then output a single line containing a string and an integer indicating the winner of the game (“Alice”, “Bob” or “Draw” if the game ties) and how many turns the game lasts, separated by spaces.
输入样例
3
0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3
3 4 4 4 4 4
0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3
3 4 4 4 4 4
4 3 2 1 1 3 1 2 1 3 2 3 0 0 4 0 3 4 0
4 2 2 1 0 4
0 0 3 2 4 3 4 0 2 4 1 2 4 3 1 1 3 2 2
3 1 0 1 4 0
4 0 0 3 1 2 4 4 1 3 1 3 0 4 0 2 2 1 2
2 3 3 4 1 0
4 0 4 1 4 1 4 1 4 0 0 2 3 1 3 2 3 2 1
0 2 3 0 2 3
输出样例
Case 1: Bob 36
Case 2: Alice 17
Case 3: Alice 9
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6565

最后修改于 2020-10-25T23:32:23+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)