Submission
Status:
[P-SSSSSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: meme_boi2
Problemset: อัศวินขี่ม้าขาว
Language: cpp
Time: 0.009 second
Submitted On: 2026-03-19 20:36:47
#include <bits/stdc++.h>
using namespace std;
int mat[1002][1002], dp[1002][1002];
int32_t main(){
cin.tie(nullptr)->sync_with_stdio(0);
int m, n;
memset(dp,2e9,sizeof(dp));
cin >> m >> n;
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++){
cin >> mat[i][j];
}
}
// dp[1][1] = (mat[1][1] < 0 ? 1 - mat[1][1] : 1) - mat[1][1];
for(int i = m; i >= 1; i--){
for(int j = n; j >= 1; j--){
dp[i][j] = max(1,min(dp[i+1][j],dp[i][j+1])) - mat[i][j];
// cout << dp[i][j] << ' ';
}
// cout << '\n';
}
cout << dp[1][1];
}
/*
3 3
-2 -3 3
-5 -10 1
10 30 -5
2 3
3 -20 30
-3 4 0
3 3
3 0 -3
-3 -2 -2
3 1 -3
c2_st65_knight
cd "c:\Users\RICOH-NB110\Desktop\Computer Programing\gchan\" ; if ($?) { g++ c2_st65_knight.cpp -o c2_st65_knight } ; if ($?) { .\c2_st65_knight}
*/