typedef long long ll; typedef long double ld; #include using namespace std; int main() { ll n,m; std::cin >> n>>m; vector a(n,0); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ll b; std::cin >> b; a[i] += b; } } vector> dp(n+1,vector(2,0)); // dp[i][1] 奇数番目状態で最大 dp[0][0] = 0; dp[0][1] = -1e15; for (int i = 0; i < n; i++) { dp[i+1][0] = max(dp[i][0], dp[i][1]-a[i]); dp[i+1][1] = max(dp[i][1], dp[i][0]+a[i]); } std::cout << dp[n][1] << std::endl; }