4713: P8687 [蓝桥杯 2019 省 A] 糖果

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Input

Output

Sample Input Copy

6 5 3
1 1 2
1 2 3
1 1 3
2 3 5
5 4 2
5 1 2

Sample Output Copy

2

HINT