4722: P8601 [蓝桥杯 2013 省 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

3 3
10 1 52
20 30 1
1 2 3

Sample Output Copy

3

HINT