755B.md (1684B)
1 Source: https://codeforces.com/problemset/problem/755/B 2 3 B. PolandBall and Game 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 standard input 16 17 output 18 19 standard output 20 21 PolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already said. PolandBall starts. The Ball which can't say a new word loses. 22 23 You're given two lists of words familiar to PolandBall and EnemyBall. Can you determine who wins the game, if both play optimally? 24 25 Input 26 27 The first input line contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 103) — number of words PolandBall and EnemyBall know, respectively. 28 29 Then *n* strings follow, one per line — words familiar to PolandBall. 30 31 Then *m* strings follow, one per line — words familiar to EnemyBall. 32 33 Note that one Ball cannot know a word more than once (strings are unique), but some words can be known by both players. 34 35 Each word is non-empty and consists of no more than 500 lowercase English alphabet letters. 36 37 Output 38 39 In a single line of print the answer — "YES" if PolandBall wins and "NO" otherwise. Both Balls play optimally. 40 41 Examples 42 43 Input 44 45 ``` 46 5 1 47 polandball 48 is 49 a 50 cool 51 character 52 nope 53 ``` 54 55 Output 56 57 ``` 58 YES 59 ``` 60 61 Input 62 63 ``` 64 2 2 65 kremowka 66 wadowicka 67 kremowka 68 wiedenska 69 ``` 70 71 Output 72 73 ``` 74 YES 75 ``` 76 77 Input 78 79 ``` 80 1 2 81 a 82 a 83 b 84 ``` 85 86 Output 87 88 ``` 89 NO 90 ``` 91 92 Note 93 94 In the first example PolandBall knows much more words and wins effortlessly. 95 96 In the second example if PolandBall says kremowka first, then EnemyBall cannot use that word anymore. EnemyBall can only say wiedenska. PolandBall says wadowicka and wins.