#P8333. [ZJOI2022] 计算几何

    ID: 9400 远端评测题 1000ms 1024MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>各省省选2022浙江O2优化组合数学线性代数

[ZJOI2022] 计算几何

Problem Description

Jiutiao Kelian is a girl who likes computational geometry. She drew a special plane coordinate system, where the angle between the positive xx-axis and the positive yy-axis is 6060 degrees.

From it, she takes all integer points whose xx- and yy-coordinates are not both even, and that satisfy 2a+1x2a1-2 a + 1 \le x \le 2 a - 1, 2b+1y2b1-2 b + 1 \le y \le 2 b - 1, and 2c+1x+y2c1-2 c + 1 \le x + y \le 2 c - 1.

Kelian wants to color some of these points, but adjacent points cannot be colored at the same time. Specifically, for a point (x,y)(x, y), it is adjacent to the six points (x,y+1)(x, y + 1), (x,y1)(x, y - 1), (x+1,y)(x + 1, y), (x1,y)(x - 1, y), (x+1,y1)(x + 1, y - 1), and (x1,y+1)(x - 1, y + 1). You may understand this together with the sample explanation.

Kelian wants to know the maximum number of points that can be colored under this rule, and the number of coloring schemes that achieve this maximum. Since the latter may be very large, for the number of schemes you only need to output it modulo 998244353998244353. Note that you do not need to take the maximum number of colored points modulo anything.

Input Format

The first line contains an integer TT, representing the number of test cases.

The next TT lines each contain three integers aa, bb, and cc, representing one test case.

Output Format

Output TT lines in total. Each line contains two integers: the maximum number of points that can be colored (not taken modulo) and the number of schemes modulo 998244353998244353.

6
2 1 2
1 1 137
3 94 95
3 1998 1996
998244 353999 999999
50 120 150

7 4
4 1
1124 31585548
23951 33873190
1289433675488 748596399
23600 480090154

Hint

[Sample Explanation]

As shown in the figure below, point JJ has coordinates (2,1)(2, 1), point FF has coordinates (1,0)(-1, 0), and point HH has coordinates (2,0)(2, 0). Among these three points, only point HH has both coordinates even. In the figure, the points at distance 11 from point AA are the six points B C D E F G\texttt{B C D E F G}.

In the first sample test case, the integer points satisfying the conditions are R N G B I J P F C K M L E D S T\texttt{R N G B I J P F C K M L E D S T}.

The maximum number of points that can be colored is 77, and there are 44 schemes, namely: P N L B D J T\texttt{P N L B D J T}, R M F B D J T\texttt{R M F B D J T}, R M G E C J T\texttt{R M G E C J T}, and R M G E I S K\texttt{R M G E I S K}.

In the second sample test case, the integer points satisfying the conditions are G B I F C L E D\texttt{G B I F C L E D}.

The maximum number of points that can be colored is 44, and there is 11 scheme, namely: L G I D\texttt{L G I D}.

[Constraints]

For all test points: 1T101 \le T \le 10, 1a,b,c1061 \le a, b, c \le {10}^6.

The specific limits for each test point are shown in the table below:

Test Point ID aa \le b,cb, c \le Special Constraints
11 33 a=b=ca = b = c
22 44
33 None
44 33 100100
565 \sim 6 10001000
787 \sim 8 50005000
9109 \sim 10 100100 a=b=ca = b = c
111411 \sim 14 None
1515 105{10}^5 a=b=ca = b = c
1616 None
171817 \sim 18 106{10}^6 abc106a \cdot b \cdot c \le {10}^6
1919 a=b=ca = b = c
2020 None

Translated by ChatGPT 5