Due to the recent Pokémon games that came out, Sun and Moon, we might as well create a problem based on it.
Given the effectiveness of certain types over another, and the typing of the Pokémon, determine which type would be the most effective against the Pokémon.
Input Specification
The first line of input includes 2 integers,
The next
The next line shows you the number of types the Pokémon has.
The following line shows the type(s) of that Pokémon (a Pokémon can only have either one or two types).
Output Specification
The output will consist of one number which is the type that the Pokémon is weakest against.
Please note the following:
- A type that is super effective against both of the Pokémon's types is better than a type that is super effective against only one of the types.
- If a type is super effective against one of the types of the Pokémon, but is not effective against the other, it is considered neutral.
- If none of the types are super effective against the Pokémon (That is, all the types are not effective or do neutral damage to the Pokémon), then output
. - If one type has the same effectiveness against the Pokémon as another type, output the smaller/smallest number.
Constraints
Subtask 1 [100%]
Subtask 2 [0%]
Sample test cases.
Sample Input 1
4 3
1 2
2 3
3 4
2
3 4
Sample Output 1
2
Sample Input 2
3 2
2 1
3 2
2
1 3
Sample Output 2
0
Comments