90分,第一个样例RE,不知道是为什么
import java.io.*;
import java.util.*;
public class Main {
static int N = 10010,n,m;
static int[] t = new int[N],x = new int[N],y = new int[N];
static int[] f = new int[N];
static int Int(String s){return Integer.parseInt(s);}
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
public static void main(String[] args)throws IOException{
String[] arrStr = br.readLine().split(" ");
n = Int(arrStr[0]); m = Int(arrStr[1]);
for(int i =1;i <= m;i++){
arrStr = br.readLine().split(" ");
t[i] = Int(arrStr[0]);x[i] = Int(arrStr[1]);y[i] = Int(arrStr[2]);
}
int res = 0;
for(int i = 1;i <= m;i++){
f[i] = 1;
for(int j =1;j < i;j++){
if(dist(i,j) > (t[i] - t[j])) continue;
f[i] = Math.max(f[j] + 1,f[i]);
}
res = Math.max(res, f[i]);
}
pw.println(res);
pw.flush();br.close();pw.close();
}
static int dist(int p1,int p2) {
return Math.abs(x[p1] - x[p2]) + Math.abs(y[p1]- y[p2] );
}
}