F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Another Chess Problem

Time 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
3 1 1 5 2 1 1 2 5 1 1 1 1
 

Sample Output
7 5 5 1 0 1
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 16:40:23, Gzip enabled