|
||||||||||
Another Chess ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 44 Accepted Submission(s): 25 Problem Description You are given an infinite set $S = \left\{(x, y)|x, y \in Z, \lnot \exists i, j \in Z \; s.t. \; x = 2i + j,y = i - 2j \right\}$ and two pairs $(x_1, y_1), (x_2, y_2) \in S$. You have a pair $(x, y)$ in your right pocket which equals to $(x_1, y_1)$ in the beginning. You can pay Y_UME a coin at a time and then change $(x, y)$ to one element in S whose distance to $(x, y)$ is $1$. The distance between $(a_1, b_1)$ and $(a_2, b_2)$ is defined as $|a_1-a_2| + |b_1-b_2|$. You expect to get $(x_2, y_2)$ and minimize the number of coins given to Y_UME. Output the minimum number of coins and output the number of different ways to achieve the goal modulo $998244353$. Note that two ways differ if and only if there exsits some $i$ such that $i$-th steps in the two ways are different. Input The first line contains one positive integer $T(T \leq 2 \times 10^5)$ denoting the number of test cases. Each case starts with a line containing four integers $x_1, y_1, x_2, y_2(-10^5 \leq x_1, y_1, x_2, y_2 \leq 10^5)$. Output For each test case, output one line containing two integers denoting the minimum number of coins and the number of different ways modulo $998244353$. Sample Input
Sample Output
Source | ||||||||||
|