시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 137 78 69 69.000%

문제

상근이는 학교에 관심있는 사람이 생겼기 때문에, D일동안(1일~D일) 입을 옷을 계획하기로 했다. 옷의 스타일과 최고 기온은 매우 밀접한 관계가 있기 때문에, 상근이는 D일 동안 일기 예보를 바탕으로 계획을 세우려고 한다. i일의 최고 기온은 Ti이다.

상근이는 총 N가지 옷을 가지고 있고, 이 옷은 모두 1번에서 N까지 번호가 붙여져 있다. 옷 j(1 ≤ j ≤ N)는 최고 기온이 Aj 이상 Bj 이하인 날에만 입을 수 있다. 또, 각 옷의 화려한 정도는 Cj이다.

상근이는 일기예보를 참고해 어느 날 어떤 옷을 입을지 결정하려고 한다. 같은 옷을 여러 번 입어도 되고, 한 번도 입지 않은 옷이 있어도 상관 없다.

비슷한 옷을 연속해서 입는다면, 그 사람이 상근이에게 호감을 느끼지 않을 수 있다. 따라서, 옷의 화려함의 차이의 합이 최대가 되도록 옷을 입으려고 한다. 즉, i일에 옷 xi을 입었다면, |Cx1 - Cx2| + |Cx2 - Cx3| + ... + |CxD-1 - CxD|를 최대로 하려고 한다.

화려함의 차이의 합의 최댓값을 구하는 프로그램을 작성하시오.

입력

첫째 줄에 D와 N이 주어진다. (2 ≤ D, N ≤ 200) 다음 D개 줄에는 i일의 의 최고 기온 Ti가 주어진다. (0 ≤ Ti ≤ 60) 다음 N개 줄에는 상근이가 가지고 있는 옷의 정보가 주어진다. (0 ≤ Aj ≤ Bj ≤ 60, 0 ≤ Cj ≤ 100)

상근이가 입을 수 있는 옷이 없는 날은 없다.

출력

첫째 줄에 상근이가 입는 옷의 화려함의 차이의 합의 최댓값을 출력한다.

예제 입력 1

3 4
31
27
35
20 25 30
23 29 90
21 35 60
28 33 40

예제 출력 1

80

힌트

1일에 옷 4, 2일에 옷 2, 3일에 옷 3을 입는다면, 절댓값의 차이는 |40 - 90| + |90 - 60| = 80이 되고, 이 값이 최댓값이다.

W3sicHJvYmxlbV9pZCI6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