#P8333. Maximum Independent Set on a Hexagonal Lattice

    ID: 21512 Type: Default 1000ms 256MiB

Maximum Independent Set on a Hexagonal Lattice

Maximum Independent Set on a Hexagonal Lattice

Kelian loves computational geometry. She has drawn a special coordinate system in the plane where the positive x‐axis and the positive y‐axis make an angle of \(60^\circ\). Using this system, she selects all lattice points \((x,y)\) (where \(x,y\) are integers) satisfying the following conditions:

  • \(-2a+1 \le x \le 2a-1\),
  • \(-2b+1 \le y \le 2b-1\),
  • \(-2c+1 \le x+y \le 2c-1\),
  • and not both coordinates are even.

Then, Kelian wishes to color some of these points under the rule that any two adjacent points cannot both be colored. Here, for any point \((x,y)\) the six adjacent points are defined as: \[ (x, y+1),\quad (x, y-1),\quad (x+1, y),\quad (x-1, y),\quad (x+1, y-1),\quad (x-1, y+1). \]

Your task is to determine two things:

  1. The maximum number of points that can be colored so that no adjacent points are both colored.
  2. The number of coloring schemes achieving this maximum (output this number modulo \(998244353\)). Note that only the number of schemes is taken modulo \(998244353\); the maximum count is output as an integer.

Note: The lattice of points selected forms a hexagon‐shaped region in the special coordinate system. The input parameters \(a\), \(b\), and \(c\) are given so that the total number of points is small enough to allow a solution by brute‐force or state space search.

inputFormat

The input consists of a single line containing three positive integers \(a\), \(b\), and \(c\).

Constraints guarantee that the number of selected points is small (for example, the total number of points is at most around 50).

outputFormat

Output two space‐separated integers in one line: the maximum number of colored points and the number of ways to achieve that maximum (modulo \(998244353\)).

sample

1 1 1
3 2