Screen resolution of Polycarp's monitor is a×ba×b pixels. Unfortunately, there is one dead pixel at his screen. It has coordinates (x,y)(x,y) (0≤x<a,0≤y<b0≤x<a,0≤y<b ). You can consider columns of pixels to be numbered from 00 to a−1a−1 , and rows — from 00 to b−1b−1 .

Polycarp wants to open a rectangular window of maximal size, which doesn't contain the dead pixel. The boundaries of the window should be parallel to the sides of the screen.

Print the maximal area (in pixels) of a window that doesn't contain the dead pixel inside itself.

Input

In the first line you are given an integer tt (1≤t≤1041≤t≤104 ) — the number of test cases in the test. In the next lines you are given descriptions of tt test cases.

Each test case contains a single line which consists of 44 integers a,b,xa,b,x and yy (1≤a,b≤1041≤a,b≤104 ; 0≤x<a0≤x<a ; 0≤y<b0≤y<b ) — the resolution of the screen and the coordinates of a dead pixel. It is guaranteed that a+b>2a+b>2 (e.g. a=b=1a=b=1 is impossible).

Output

Print tt integers — the answers for each test case. Each answer should contain an integer equal to the maximal possible area (in pixels) of a rectangular window, that doesn't contain the dead pixel.

Example

Input
6
8 8 0 0
1 10 0 3
17 31 10 4
2 1 0 0
5 10 3 9
10 10 4 8
Output
56
6
442
1
45
80
找出这个点左右上下四部分最大的一部分即可。
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int a,b,x,y;
while(t--)
{
cin>>a>>b>>x>>y;
int s1=a*y;
int s2=b*x;
int s3=a*(b-y-);
int s4=b*(a-x-);
s2=max(s1,s2);
s4=max(s3,s4);
cout<<max(s2,s4)<<endl;
}
return ;
}

Codeforces 1315A Dead Pixel (水题)的更多相关文章

  1. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  2. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  3. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  4. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  5. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  6. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

  7. Codeforces Gym 100286I iSharp 水题

    Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  8. CodeForces 705A(训练水题)

    题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it ...

  9. CodeForces Gym 100685C Cinderella (水题)

    题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要 ...

随机推荐

  1. c# 删除功能

    html界面: js: controller: app:

  2. 阿里云linux挂载云盘

    阿里云购买的第2块云盘默认是不自动挂载的,需要手动配置挂载上. 1.查看SSD云盘 sudo fdisk -l 可以看到SSD系统已经识别为/dev/vdb 2.格式化云盘 sudo mkfs.ext ...

  3. 实例:通过调用外部程序进行录制视频(ffmpeg.exe)

    相关知识点: 1. ffmpeg可以用下面的参数来录制Windows 桌面操作的视频. ffmpeg.exe -y -rtbufsize 100M -f gdigrab -framerate 10 - ...

  4. Mapper-元素和属性

    Mapper.xml文件内部的元素和属性     parameterType(输入类型) §  传递简单类型 §  使用#{}占位符,或者${}进行sql拼接, #{}括号中的值可以任意, ${}括号 ...

  5. Python中的模块简单认识

    将自己定义的方法,变量存放在文件中,为一些脚本或者交互式的解释器实例使用,这个文件称为模块. 细说的话,模块可以分为四个通用类别: 1 使用python编写的.py文件(自定义模块) 2 已被编译为共 ...

  6. redis本地能访问外网不能访问问题

    1.确认配置文件bind的ip是否正确,一般想要外网能访问,需要填写为0.0.0.0,表示监听任何ip 注意任何人都能访问,一定要开启密码 requirepass 你的密码 2.确认protected ...

  7. [NOIP2018(PJ)] 摆渡车

    题目链接 题意 有 $n$ 个同学在等车,每位同学从某时刻开始等车,相邻两趟车之间至少间隔 $m$ 分钟.凯凯可以任意安排发车时间,求所有同学等车时间之和的最小值. 分析 这题首先能想到是动态规划 很 ...

  8. keil里面的包

    1.使用Keil开发STM32程序时,需要下载STM32固件包 首先,keil就是一个编辑器,就跟记事本一样. 但keil还可以编译链接程序. 在创建一个工程时,要选择芯片序列. 要选择芯片序列的原因 ...

  9. 在 JavaScript 中为什么 typeof null 的结果是 object?

    java 中的 null:既是对象,又不是对象,史称「薛定谔的对象」. typeof null==='object';  ..//true null instanceof Object  //fals ...

  10. Port 3000 is already in use

    cmd输入:netstat -ano | findstr :3000//查看是谁占用了3000号端口 显示如下 TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 18412 T ...