시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 1 1 1 100.000%

문제

Monitor lizards are a kind of reptile known mainly for their cold-bloodedness and addiction to computer screens. Due to their love for digital displays, these scaly creatures spend most of their time at home glued to a small television in the lounge.

Conflict has arisen at one particular reptile house. The audience here has grown so large that not everyone will be able to see the screen at once any more; specifically, a lizard will only be able to see enough if it is strictly taller than all of the lizards sitting exactly along the straight line from itself to the television.

Monitor lizards aren’t particularly picky about the actual contents of the screen or being able to see it obliquely (or even from the front)—they just want to be able to keep an eye on it.

The lizards don’t want to move, however. It’s possible to chase a monitor lizard away in order for the ones behind it to see, or leave it alone, but re-homing somewhere else in the room is unthinkable.

Assuming lizards are removed optimally, how many at most can remain and still see the screen?

입력

  • one line containing the space-separated integers TX and TY (−106 ≤ TX, TY ≤ 106), the co-ordinates of the television.
  • one line containing the integer N (1 ≤ N ≤ 106), the number of lizards.
  • N further lines, each containing three space-separated integers XiYiHi (−106 ≤ X, Y ≤ 106 ; 1 ≤ H ≤ 106), the co-ordinates and height respectively of one lizard.

The co-ordinates of all televisions and lizards will be distinct.

출력

Output the maximum number of lizards that can stay and watch television at once.

예제 입력 1

50 50
2
60 50 1
65 50 2

예제 출력 1

2

예제 입력 2

50 50
3
60 55 1
70 60 1
40 45 1

예제 출력 2

2

예제 입력 3

-100 0
6
-99 1 2
-98 2 4
-97 3 3
-96 4 4
0 100 3
100 0 7

예제 출력 3

4