#K49937. Competition Winner

    ID: 28753 Type: Default 1000ms 256MiB

Competition Winner

Competition Winner

In this problem, you are given a programming competition scenario where there are (S) students and (D) session records. Each session record includes the student ID, the day number, and the points earned during that session. Additionally, there are (B) boosted days provided. On a boosted day, any points that a student earns are doubled. Your task is to compute the total points for each student and output the student ID with the highest score. In case of a tie, output the student with the smallest ID.

The total points for each student can be mathematically described as follows:
(\text{Total Points} = \sum_{i=1}^{D} \text{points}_i \times \begin{cases} 2, & \text{if the day is boosted} \ 1, & \text{otherwise} \end{cases})

inputFormat

The input is given via standard input (stdin).

The first line contains three space-separated integers: (S) (the number of students), (D) (the number of session records), and (B) (the number of boosted days).

This is followed by (D) lines, each containing three integers: the student ID, the day number, and the points earned in that session.

If (B > 0), the next line contains (B) space-separated integers representing the boosted day numbers. If (B = 0), this line will be omitted.

outputFormat

Print a single integer to standard output (stdout) denoting the student ID of the competition winner (i.e. the student with the highest total points). If multiple students are tied with the highest total points, print the smallest student ID among them.## sample

3 6 2
1 1 10
2 1 20
3 1 30
1 2 25
2 2 30
3 2 20
1 2
2