10pts向大佬求救
查看原帖
10pts向大佬求救
700122
hnxxwpf楼主2023/12/27 20:41

#1AC 其他WA 三维DP

#include<iostream>
using namespace std;
int n,m,t,x,y,ans,dp[1001][1001];
int main(){
	scanf("%d%d",&n,&m);
	for(int i = 0;i < m;++i){
		scanf("%d%d%d",&t,&x,&y);
		dp[x][y] = max(dp[x][y] , max(max(dp[x-1][y],dp[x+1][y]) , max(dp[x][y-1],dp[x][y+1]) + 1));
	}
	for(int i = 1;i <= n;++i){
		for(int j = 1;j <= n;++j){
			ans = max(ans,dp[i][j]);
		}
	}
	printf("%d",ans);
	return 0;
}

2023/12/27 20:41
加载中...