CF1697E.Coloring

提高+/省选-

通过率:0%

时间限制:3.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given nn points on the plane, the coordinates of the ii-th point are (xi,yi)(x_i, y_i). No two points have the same coordinates.

The distance between points ii and jj is defined as d(i,j)=∣xi−xj∣+∣yi−yj∣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 11 to nn. For every ordered triple of different points (a,b,c)(a,b,c), the following constraints should be met:

  • if aa, bb and cc have the same color, then d(a,b)=d(a,c)=d(b,c)d(a,b) = d(a,c) = d(b,c);
  • if aa and bb have the same color, and the color of cc is different from the color of aa, then d(a,b)<d(a,c)d(a,b) \lt d(a,c) and d(a,b)<d(b,c)d(a,b) \lt d(b,c).

Calculate the number of different ways to choose the colors that meet these constraints.

给定平面上的 nn 个点,其中第 ii 个点的坐标为 (xi,yi)(x_i, y_i)。任意两个点的坐标均不相同。

点 ii 与点 jj 之间的距离定义为 d(i,j)=∣xi−xj∣+∣yi−yj∣d(i,j) = |x_i - x_j| + |y_i - y_j|。

对每个点,你需要为其分配一种颜色,颜色用 11 到 nn 之间的整数表示。对于每组互不相同的有序三元组 (a,b,c)(a,b,c),需满足以下约束条件:

  • 若 aa、bb、cc 颜色相同,则 d(a,b)=d(a,c)=d(b,c)d(a,b) = d(a,c) = d(b,c);
  • 若 aa 与 bb 颜色相同,而 cc 的颜色与 aa 不同,则 d(a,b)<d(a,c)d(a,b) \lt d(a,c) 且 d(a,b)<d(b,c)d(a,b) \lt d(b,c)。

请计算满足上述约束条件的颜色分配方案总数。

输入格式

The first line contains one integer nn (2≤n≤1002 \le n \le 100) — the number of points.

Then nn lines follow. The ii-th of them contains two integers xix_i and yiy_i (0≤xi,yi≤1080 \le x_i, y_i \le 10^8).

No two points have the same coordinates (i. e. if i≠ji \ne j, then either xi≠xjx_i \ne x_j or yi≠yjy_i \ne y_j).

第一行包含一个整数 nn(2≤n≤1002 \le n \le 100)—— 点的数量。

接下来有 nn 行。其中第 ii 行包含两个整数 xix_i 和 yiy_i(0≤xi,yi≤1080 \le x_i, y_i \le 10^8)。

任意两个点的坐标均不相同(即若 i≠ji \ne j,则 xi≠xjx_i \ne x_j 或 yi≠yjy_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 998244353998244353.

输出一个整数——为这些点选择颜色的方案数。由于该数可能很大,请对 998244353998244353 取模后输出。

输入输出样例

  • 输入#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][1, 1, 1];
  • [2,2,2][2, 2, 2];
  • [3,3,3][3, 3, 3];
  • [1,2,3][1, 2, 3];
  • [1,3,2][1, 3, 2];
  • [2,1,3][2, 1, 3];
  • [2,3,1][2, 3, 1];
  • [3,1,2][3, 1, 2];
  • [3,2,1][3, 2, 1].

在第一个测试中,以下颜色选择方式是合适的:

  • [1,1,1][1, 1, 1];
  • [2,2,2][2, 2, 2];
  • [3,3,3][3, 3, 3];
  • [1,2,3][1, 2, 3];
  • [1,3,2][1, 3, 2];
  • [2,1,3][2, 1, 3];
  • [2,3,1][2, 3, 1];
  • [3,1,2][3, 1, 2];
  • [3,2,1][3, 2, 1]。

输入解题思路,AI测评打分。不知道怎么写?

首页