Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically.
This is a code-golf challenge so shortest code wins!
Input
A single line containing values l and h, representing the length and height of the tic-tac-toe board, separated by a space.
Constraints
1 ≤ l ≤ 2,147,483,647
1 ≤ h ≤ 2,147,483,647
Output
A single number representing the number of Xs that can fit on the tic-tac-toe board without three in a row
Sample Inputs and Outputs
Input -> Output
2 2 -> 4
3 3 -> 6
2 3 -> 4
4 4 -> 9
Explanation
4 Xs can fit on a 2x2 tic-tac-toe board without having 3 Xs in a row anywhere
6 Xs can fit on a 3x3 tic-tac-toe board without having 3 Xs in a row anywhere
4 Xs can fit on a 2x3 tic-tac-toe board without having 3 Xs in a row anywhere
9 Xs can fit on a 4x4 tic-tac-toe board without having 3 Xs in a row anywhere
Credits
Lukas Zenick for creating the problem
Extra Data
https://docs.google.com/spreadsheets/d/1qJvlxdGm8TocR3sh3leRIpqdzmN3bB_z8N-VrEKSCwI/edit
[fastest-code]
challenge, you'll have to add how you're going to test the speed of each answer. E.g. are you going to test them on your own PC (in which case, what are the processor specs?) - and maybe installation instructions in answers might be useful then. Or, and this is probably easier, are you going by TIO or ATO execution time? EDIT: @pajonk beat me to it while I was typing.. \$\endgroup\$print(42)
via “optimizations” that will be meaningless to measure and won’t correlate with speed for larger inputs. Take a look at other fastest-code challenges for inspiration—it’s better to structure them to ask for the most number of values of some sequence in a fixed amount of time, rather than for a single fixed value in the shortest time. \$\endgroup\$