Hanzo Waiting
Time limit2sMemory limit256 MB
Each team assigns distinct troll picks to maximize the number of satisfied players; decide whether Wookje's team ends with strictly fewer troll picks.
- Level
Medium7 of 10
- Topics
- Graph, BFS, Binary search, Greedy
- Solved
- No attempts yet
Problem
Wookje is one win away from promotion to Grandmaster, and he has just seen something terrible: his teammates have started throwing the game.
Just as he is about to give up on the promotion, Wookje notices that the enemy team is throwing too! Now nobody can tell how the match will end.
Each team has players, and every player picks one hero before the game starts. Two players on the same team cannot pick the same hero. The game has a huge number of heroes, and of them are so bad that picking one decides the outcome of the game. Picking such a hero is called a troll pick. (Both teams play the same game, so the number of troll picks is the same for both teams.)
Since both teams are throwing, everyone decides to just have fun. Each player names the troll picks they want out of the troll picks, and each team assigns troll picks so that as many of its players as possible get one. A player who gets no troll pick has to settle for a healer.
The game matches players of similar skill, so the team with fewer troll picks wins. Given the troll picks each player on each team wants, determine whether Wookje reaches Grandmaster. A draw gives no points, so it does not count as a promotion. Of course, Wookje is throwing too.
Input
The first line contains the number of players on one team (), the number of troll picks (), and the numbers of wish entries of the two teams and ().
Each of the next lines contains two integers and (, ), meaning that player on Wookje's team wants troll pick .
The next lines give the troll picks wanted by the players on the enemy team in the same format.
Output
Print 네 다음 힐딱이 if Wookje gets promoted, and 그만 알아보자 otherwise. Print these Korean phrases exactly as shown.