当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6591:Another Chess Problem

题目描述
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.
输入解释
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)$.
输出解释
For each test case, output one line containing two integers denoting the minimum number of coins and the number of different ways modulo $998244353$.
输入样例
3
1 1 5 2
1 1 2 5
1 1 1 1
输出样例
7 5
5 1
0 1
来自杭电HDUOJ的附加信息
Recommend liuyiding

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6591

最后修改于 2020-10-25T23:32:37+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)