A15253 | Coloring
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You are given $n$ points on the plane, the coordinates of the $i$ -th point are $(x_i, y_i)$ . No two points have the same coordinates.
The distance between points $i$ and $j$ is defined as $d(i,j) = |x_i - x_j| + |y_i - y_j|$ .
For each point, you have to choose a color, represented by an integer from $1$ to $n$ . For every ordered triple of different points $(a,b,c)$ , the following constraints should be met:
- if $a$ , $b$ and $c$ have the same color, then $d(a,b) = d(a,c) = d(b,c)$ ;
- if $a$ and $b$ have the same color, and the color of $c$ is different from the color of $a$ , then $d(a,b) < d(a,c)$ and $d(a,b) < d(b,c)$ .
Calculate the number of different ways to choose the colors that meet these constraints.
The distance between points $i$ and $j$ is defined as $d(i,j) = |x_i - x_j| + |y_i - y_j|$ .
For each point, you have to choose a color, represented by an integer from $1$ to $n$ . For every ordered triple of different points $(a,b,c)$ , the following constraints should be met:
- if $a$ , $b$ and $c$ have the same color, then $d(a,b) = d(a,c) = d(b,c)$ ;
- if $a$ and $b$ have the same color, and the color of $c$ is different from the color of $a$ , then $d(a,b) < d(a,c)$ and $d(a,b) < d(b,c)$ .
Calculate the number of different ways to choose the colors that meet these constraints.
输入格式
The first line contains one integer $n$ ( $2 \le n \le 100$ ) — the number of points.
Then $n$ lines follow. The $i$ -th of them contains two integers $x_i$ and $y_i$ ( $0 \le x_i, y_i \le 10^8$ ).
No two points have the same coordinates (i. e. if $i \ne j$ , then either $x_i \ne x_j$ or $y_i \ne y_j$ ).
Then $n$ lines follow. The $i$ -th of them contains two integers $x_i$ and $y_i$ ( $0 \le x_i, y_i \le 10^8$ ).
No two points have the same coordinates (i. e. if $i \ne j$ , then either $x_i \ne x_j$ or $y_i \ne y_j$ ).
输出格式
Print one integer — the number of ways to choose the colors for the points. Since it can be large, print it modulo $998244353$ .
输入输出样例
输入 #1
3 1 0 3 0 2 1
输出 #1
9
输入 #2
5 1 2 2 4 3 4 4 4 1 3
输出 #2
240
输入 #3
4 1 0 3 0 2 1 2 0
输出 #3
24
In the first test, the following ways to choose the colors are suitable:
- $[1, 1, 1]$ ;
- $[2, 2, 2]$ ;
- $[3, 3, 3]$ ;
- $[1, 2, 3]$ ;
- $[1, 3, 2]$ ;
- $[2, 1, 3]$ ;
- $[2, 3, 1]$ ;
- $[3, 1, 2]$ ;
- $[3, 2, 1]$ .
- $[1, 1, 1]$ ;
- $[2, 2, 2]$ ;
- $[3, 3, 3]$ ;
- $[1, 2, 3]$ ;
- $[1, 3, 2]$ ;
- $[2, 1, 3]$ ;
- $[2, 3, 1]$ ;
- $[3, 1, 2]$ ;
- $[3, 2, 1]$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted