Laser

杭昊空
2023-12-01

https://acs.jxnu.edu.cn/problem/CF15B

描述:

Petya is the most responsible worker in the Research Institute. So he was asked to make a very important experiment: to melt the chocolate bar with a new laser device. The device consists of a rectangular field of n × m cells and a robotic arm. Each cell of the field is a 1 × 1 square. The robotic arm has two lasers pointed at the field perpendicularly to its surface. At any one time lasers are pointed at the centres of some two cells. Since the lasers are on the robotic hand, their movements are synchronized — if you move one of the lasers by a vector, another one moves by the same vector.

Petya是研究所里面最靠谱的员工。所以他被要求完成一个非常重要的实验:用一个新型激光装置融化巧克力棒。装置由一个n*m个空间的矩形场和机械臂组成。每个空间占地1*1平方。机械臂有两束激光垂直指向举证的表面。任何一个时间里机械臂指向两个小空间的中心。因为激光在机械臂上,它们的运动是同步的————如果你向一个方向移动激光,另一个向相同方向移动

The following facts about the experiment are known:

  • initially the whole field is covered with a chocolate bar of the size n × m, both lasers are located above the field and are active;
  • the chocolate melts within one cell of the field at which the laser is pointed;
  • all moves of the robotic arm should be parallel to the sides of the field, after each move the lasers should be pointed at the centres of some two cells;
  • at any one time both lasers should be pointed at the field. Petya doesn't want to become a second Gordon Freeman.

关于本次实验,一下事实已知:

        起初场地被n*m的巧克力覆盖,两个激光都在场地上方且处于活动状态;

        巧克力在激光指向的一个场地内融化

        机械臂所有的移动都平行于场地两侧,在每次移动后必须指向两个小室的中心

        在任何时间激光必须指向场地,Petya不想成为第二个GF

You are given nm and the cells (x1, y1) and (x2, y2), where the lasers are initially pointed at (xi is a column number, yi is a row number). Rows are numbered from 1 to m from top to bottom and columns are numbered from 1 to n from left to right. You are to find the amount of cells of the field on which the chocolate can't be melted in the given conditions.

给你n和m与小室(x1,y1)和(x2,y2),激光起初指向的地方(xi是行坐标,yi是列坐标)。行从上到下从1到m进行编号,列从左到右从1到n进行编号。你要找到在给定条件下巧克力不能融化的区域的细胞数量。

输入:

The first line contains one integer number t (1 ≤ t ≤ 10000) — the number of test sets. Each of the following t lines describes one test set. Each line contains integer numbers nmx1, y1, x2, y2, separated by a space (2 ≤ n, m ≤ 109, 1 ≤ x1, x2 ≤ n, 1 ≤ y1, y2 ≤ m). Cells (x1, y1) and (x2, y2) are distinct.

第一行包含一个整数t——测试集的数量。每t行描述了一个测试集。每一行包含了一些整数n,m,x1,y1,x2,y2,由空格分开。两个小室是不同的;

输出:

Each of the t lines of the output should contain the answer to the corresponding input test set.

输出的每个t行都应包含对应输入测试集的答案。

 类似资料:

相关阅读

相关文章

相关问答