#P2482. Pig Country Kill – Final Result Prediction

    ID: 15752 Type: Default 1000ms 256MiB

Pig Country Kill – Final Result Prediction

Pig Country Kill – Final Result Prediction

This problem simulates a simplified version of the card game Pig Country Kill. In this turn‐based card game, each player (pig) is assigned one of three roles:

  • Main Pig (MP): The unique leader whose survival is paramount.
  • Loyal Pig (ZP): Pigs that protect the Main Pig; they share the win condition with the Main Pig.
  • Traitor Pig (FP): Pigs whose objective is to kill the Main Pig.

The win conditions are as follows:

  • Main Pig / Loyal Pig (MP/ZP) win if and only if the Main Pig is alive at the end of the game and there are no Traitor pigs present.
  • Traitor Pig (FP) win if the Main Pig is killed.

The game is played by a set of players, each having an initial state: a role, HP (health points), and a hand of four cards. There is also a deck of cards. Although the full game rules are very intricate (involving drawing cards, using various types of cards such as P (peach), K (attack), D (dodge) and other special cards with effects described in LaTeX as \(P, K, D, \) etc.), in this problem you are given the initial state and you are to predict the final result for a designated pig iPig under the following simplified assumption:

Simplified Assumption: The outcome is decided solely based on the initial roles. Namely, if there is any Traitor Pig (FP) in the game then, eventually, the Main Pig will be killed and the FP team wins. Otherwise, if there are no FPs, the Main Pig and Loyal pigs win.

Your task is to output WIN if the designated pig (iPig) belongs to the winning team, or LOSE otherwise.


Game Roles and Winning Conditions

  • If there are one or more FP in the game, the FP team wins. (Thus, the Main Pig and Loyal pigs lose.)
  • If there are no FPs, the MP/ZP team wins.

For example, if iPig is a Loyal Pig and there is no Traitor Pig, then iPig wins; if iPig is the Main Pig but there is any Traitor Pig then iPig loses. Similarly, if iPig is a Traitor Pig and there is at least one FP (obviously including himself), then iPig wins.


Note on LaTeX Formula

Any formula in the statement is to be rendered using LaTeX format. For instance, the number of roles is given as \(3\), and health points are initially set to \(4\), i.e. the maximum health is \(4\) and the starting health is also \(4\).

inputFormat

The input begins with a line containing two integers n and i (1-indexed), where:

  • n — Number of players.
  • i — The index of pig iPig whose final result you need to predict.

Then follow n lines, each describing a player. Each line contains:

  • A string representing the role, which is one of: MP (Main Pig), ZP (Loyal Pig), or FP (Traitor Pig).
  • An integer representing the current HP (health points) of the player (between 1 and 4 inclusive).
  • A 4-character string representing the player’s hand cards (each character is a card identifier such as P, K, D, etc.).

The final line of the input is a string representing the initial order of cards in the deck.

Sample Input:

3 2
MP 4 PKPD
ZP 3 PDKP
ZP 4 PDKP
PPKK

outputFormat

Output a single line: WIN if pig iPig belongs to the winning team according to the criteria mentioned above, otherwise output LOSE.

Sample Output:

WIN

sample

3 2
MP 4 PKPD
ZP 3 PDKP
ZP 4 PDKP
PPKK
WIN