The game did not write out, after the end of listening to CCX seniors speak, just know that there are multi-thread DP, feel their vegetables into a dog, have not heard before, or too weak.
#include <iostream>#include<queue>#include<cstdio>#include<cstring>#include<cstdlib>#include<stack>using namespacestd;intdp[222][111][111];inta[111][111];#defineMAX4 (a,b,c,d) max (max (b), Max (c,d))intMain () {intt, N, M; scanf ("%d", &t); while(t--) {scanf ("%d%d", &n, &m); for(intI=1; i<=n; i++) { for(intj=1; j<=m; J + +) scanf ("%d", &A[i][j]); } memset (DP,0,sizeof(DP)); dp[0][1][1] = a[1][1]; for(intk=1; k<=n+m-2; k++) { for(intI=1; i<=k+1; i++) { for(intj=1; j<=k+1; J + +) {Dp[k][i][j]= Max4 (dp[k-1][I][J], dp[k-1][i-1][J], dp[k-1][i][j-1], dp[k-1][i-1][j-1]); if(i!=j) Dp[k][i][j]+=a[i][k+2-i]+a[j][k+2-J]; ElseDp[k][i][j]+=a[i][k+2-i]; }}} printf ("%d\n", dp[n+m-2][n][n]); } return 0;}
2016 Zhengzhou Institute of Light Industry school race B Clam-Wei's treasure