Formidable
You wander into the casino's smoky back-room lounge and discover Formidable, a lightning-fast duel of high cards and sharper wits. Both players draw cards. The dealer reveals all
of their cards face-up on the table. Then, you choose how to pair each of your
cards against the dealer's, one-for-one.
For every pair:
- You score
point if your card's value is strictly greater than the dealer's.
- The dealer scores
point if their card is at least as large as yours.
The side with more points wins. A tie goes to the house. Given both starting hands, can you beat the dealer?
Input
The first line consists of an integer
, the number of cards the dealer and you each have.
The second line consists of integers
, the values of the dealer's cards.
The third line consists of integers
, the values of your cards.
Output
If you can win the game, output "Yes". Otherwise, output "No".
Clarifications
- If both players have the same number of points at the end of the game, it is a tie. In this case, you do not win the game.
Example
Input 1
5
1 5 2 4 3
2 5 4 4 1
Output 1
Yes
You can win the game, as you can match:
vs
(win)
vs
(loss)
vs
(win)
vs
(loss)
vs
(win)
Note that this is not the only way she can win the game.
Input 2
3
200 200 200
300 100 100
Output 2
No
There is nothing you can do, the dealer will always win no matter how you match up your cards.
Comments