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

建议使用的浏览器:

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

3901:The Computer Game

题目描述
John and Brus are playing a military strategic game on a PC. The game is played on the flat world map. At the beginning of the game Brus places his army. Then John has to choose strategic points for his army according to the following rules:


each strategic point must be a lattice point (x, y) (a lattice point is a point with integer coordinates) such that |x| + |y| < N;
John can choose any positive number of strategic points;
all the strategic points must be distinct;
each of the strategic points must be free (i.e. not occupied by Brus’s army);
each pair of different strategic points must be connected (possibly via some other strategic points).


Here two different lattice points (x1, y1) and (x2, y2) are connected if |x1 – x2| + |y1 – y2| = 1. If A, B and C are strategic points, A and B are connected, B and C are connected, then A and C are also connected.
Your task is to find the number of ways for John to choose strategic points for his army.
输入解释
The first line contains single integer T – the number of test cases. Each test case starts with a line containing two integers N and M separated by a single space. N is the number mentioned in the first rule. M is the number of lattice points on the world map already occupied by Brus’s army. Each of the following M lines contains two integers Xk and Yk separated by a single space. Each lattice point (Xk, Yk) is occupied by Brus’s army.
输出解释
For each test case print a single line containing the number of ways for John to choose strategic points for his army.
输入样例
2 
2 1 
7 7 
2 3 
0 0 
4 -7 
7 -4
输出样例
20 
4
提示
Constraints:
1 ≤ T ≤ 74,
1 ≤ N ≤ 7,
1 ≤ M ≤ 225,
-7 ≤ Xk, Yk ≤ 7,
all (Xk, Yk) will be distinct.

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3901

最后修改于 2020-10-29T07:15:00+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000 65536