#include #include #include "queue" #include int main() { int rows = 0; int cols = 0; std::cin >> rows; std::cin >> cols; std::map, int> map; int tmp; int sum = 0; for (int x = 0; x> tmp; sum += tmp; map.insert({{x, y}, tmp}); } } if (rows%2 == 1 || cols%2==1) { std::cout << sum << std::endl; } else { int max = 0; int tmp = 0; for ( int i= 0; i< rows;i++){ for (int j = 0; j < cols;j++) { if (i%2 == 0) { if (j%2==0) continue; else { tmp = map.at({i,j}); if (sum-tmp > max) max = sum-tmp; } } if (i%2 == 1) { if (j%2==1) continue; else { tmp = map.at({i,j}); if (sum-tmp > max) max = sum-tmp; } } } } std::cout << max << std::endl; } return 0; }