#P10826. Guaranteed All-In Decision in Texas Hold'em
Guaranteed All-In Decision in Texas Hold'em
Guaranteed All-In Decision in Texas Hold'em
Daddy Dream is a world‐famous Texas hold'em player. Wolf Chicken, as a strong challenger, will go all‐in if and only if (regardless of the remaining two community cards ("the turn" and "the river") and Daddy Dream's two hidden hole cards) his final best five-card poker hand always beats his opponent's best hand. Otherwise, he will check.
In Texas hold'em, each player gets two hole cards (dealt face‐down) and there are five community cards (dealt face‐up in three stages: the flop (three cards), the turn (one card), and the river (one card)). Each player makes their best five-card hand from their two hole cards and the five community cards. The hand ranking, in increasing order, is:
- High card
- Pair
- Two pairs
- Three of a kind
- Straight, i.e. $a_1,a_2,a_3,a_4,a_5$ with $a_i=a_{i+1}+1$. Specially, if $a_5$ is Ace, $a_4$ can be 2 (Ace is considered one rank below 2).
- Flush, i.e. five cards of the same suit (ordered by value descending)
- Full house, i.e. three of a kind and a pair
- Four of a kind
- Straight flush, i.e. a straight all in one suit (with the same Ace-low rule as above)
- Royal flush, i.e. Ten, Jack, Queen, King, Ace of the same suit
If two hands are of the same type, their ordered card ranks are compared one by one; if all are equal, the hands tie. Note that suits are never used to break ties.
Given Wolf Chicken’s two hole cards and the three flop cards, determine whether he can be 100% sure to win (i.e. his best hand will beat the opponent’s best hand for every possible combination of the remaining two community cards and Daddy Dream’s two hole cards). If so, output YES
, otherwise NO
.
Note: In this problem, we assume that the two players never fold, and we ignore the usual betting actions. Also, every card is unique and comes from a standard 52‐card deck. Each card is represented by its rank and suit. Ranks are one of {2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A}, and suits are represented by a single character: C (clubs), D (diamonds), H (hearts), S (spades).
inputFormat
The input consists of a single line containing 5 space-separated strings. The first two strings represent Wolf Chicken's hole cards, and the next three strings represent the flop (community) cards. For example: AH AD AC AS KD
.
outputFormat
Output a single line: YES
if Wolf Chicken can be sure to win no matter what the remaining cards are, otherwise output NO
.
sample
AH AD AC AS KD
YES