CF2178I.Numbers or Fireworks

NOI/NOI+/CTSC

通过率:0%

时间限制:12.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

Now that all the presents have been delivered, the North Pole is finally at peace — and it's time to celebrate with a spectacular New Year's fireworks show!

The North Pole is modeled as the Cartesian plane, with nn cities located at distinct lattice points. You are also given an integer kk.

For a proper subset∗^{\text{∗}} TT of the cities (TT may be empty), we define its explosiveness as follows:

  1. A firework is launched from every city in TT.
  2. For each city cc not in TT, let ff be the number of fireworks launched from cities that are exactly k\sqrt{k} Euclidean distance†^{\text{†}} away from cc. Assign the number (f+1)(f+1) to this city cc.
  3. The explosiveness of TT is the product of all numbers assigned in Step 2.

Compute the sum of the explosiveness of TT over all 2n−12^n-1 proper subsets TT of the cities. Since the answer may be large, output it modulo 998 244 353998\,244\,353.

∗^{\text{∗}}A proper subset is any subset which is not equal to the whole set.

†^{\text{†}}The Euclidean distance between two points (x,y)(x, y) and (p,q)(p, q) is defined as (x−p)2+(y−q)2\sqrt{(x - p)^2 + (y - q)^2}.

所有礼物都已送达,北极终于恢复了宁静——现在是时候用一场盛大的新年烟花秀来庆祝了!

北极被建模为笛卡尔平面,其上有 nn 座城市,分别位于互不相同的格点上。同时给定一个整数 kk。

对于城市集合的一个真子集∗^{\text{∗}} TT(TT 可以为空集),我们定义其爆炸力如下:

  1. 从 TT 中的每一座城市发射一枚烟花;
  2. 对于每一座不在 TT 中的城市 cc,设 ff 表示所有与 cc 的欧几里得距离恰好为 k\sqrt{k} 的城市所发射的烟花总数(即:这些城市属于 TT,且到 cc 的距离恰为 k\sqrt{k})。将数值 (f+1)(f+1) 分配给该城市 cc;
  3. TT 的爆炸力即为步骤 2 中分配给所有不在 TT 中的城市的数值之积。

请计算所有 2n−12^n-1 个城市的真子集 TT 的爆炸力之和。由于答案可能很大,请对 998 244 353998\,244\,353 取模后输出。

∗^{\text{∗}} 真子集是指不等于全集的任意子集。

†^{\text{†}} 两点 (x,y)(x, y) 与 (p,q)(p, q) 之间的欧几里得距离定义为 (x−p)2+(y−q)2\sqrt{(x - p)^2 + (y - q)^2}。

输入格式

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤10001 \le t \le 1000). The description of the test cases follows.

The first line of each test case contains two integers nn and kk (2≤n≤312\le n\le 31, 1≤k≤2⋅1041\leq k \leq2\cdot 10^4).

Then nn lines follow, the ii-th line containing two integers xix_i and yiy_i (1≤xi,yi≤1001\leq x_i, y_i\leq 100) — the xx and yy coordinates of the ii-th city, respectively. It is guaranteed that the coordinates of the cities are pairwise distinct.

It is guaranteed that the sum of n3n^3 over all test cases does not exceed 31331^3.

每个测试包含多个测试用例。第一行包含测试用例的数量 tt(1≤t≤10001 \le t \le 1000)。随后是各测试用例的描述。

每个测试用例的第一行包含两个整数 nn 和 kk(2≤n≤312\le n\le 31,1≤k≤2⋅1041\leq k \leq2\cdot 10^4)。

接下来是 nn 行,其中第 ii 行包含两个整数 xix_i 和 yiy_i(1≤xi,yi≤1001\leq x_i, y_i\leq 100),分别表示第 ii 个城市的 xx 坐标和 yy 坐标。保证所有城市的坐标两两不同。

保证所有测试用例的 n3n^3 之和不超过 31331^3。

输出格式

For each test case, print a single integer — the sum, modulo 998 244 353998\,244\,353, of the explosiveness over all proper subsets TT of the cities.

对于每个测试用例,输出一个整数——即所有城市真子集 TT 的爆炸性之和对 998 244 353998\,244\,353 取模的结果。

输入输出样例

  • 输入#1

    4
    3 1
    1 2
    2 1
    2 2
    2 20000
    1 1
    100 100
    9 5
    1 1
    1 2
    1 3
    2 1
    2 2
    2 3
    3 1
    3 2
    3 3
    13 25
    50 50
    55 50
    54 53
    53 54
    50 55
    47 54
    46 53
    45 50
    46 47
    47 46
    50 45
    53 46
    54 47

    输出#1

    16
    3
    8255
    560112

说明/提示

In the first test case, below are the 23−1=72^3-1=7 possible placements of fireworks. The numbers assigned to cities not in TT are circled.

The total explosiveness is (1⋅1⋅1)+(1⋅2)+(2⋅1)+(2⋅2)+(3)+(2)+(2)=16(1\cdot 1\cdot 1)+(1\cdot 2)+(2\cdot 1)+(2\cdot 2)+(3)+(2)+(2)=16.

In the second test case, there are 22−1=32^2-1=3 possible placements of fireworks. For every placement, since (1,1)(1,1) and (100,100)(100,100) have a Euclidean distance of (100−1)2+(100−1)2=19 602≠20 000\sqrt{(100-1)^2+(100-1)^2}=\sqrt{19\,602}\neq\sqrt{20\,000}, none of the cities will have fireworks that are exactly k\sqrt{k} away. Thus, the number 11 is assigned to every city without fireworks. Therefore, the explosiveness is 11 for every TT, and the answer is 1+1+1=31+1+1=3.

在第一个测试用例中,以下是 23−1=72^3-1=7 种可能的烟花布置方案。未在集合 TT 中的城市所分配的数字被标为圆圈。

总爆炸力为 (1⋅1⋅1)+(1⋅2)+(2⋅1)+(2⋅2)+(3)+(2)+(2)=16(1\cdot 1\cdot 1)+(1\cdot 2)+(2\cdot 1)+(2\cdot 2)+(3)+(2)+(2)=16。

在第二个测试用例中,共有 22−1=32^2-1=3 种可能的烟花布置方案。对于每一种布置,由于 (1,1)(1,1) 与 (100,100)(100,100) 的欧几里得距离为 (100−1)2+(100−1)2=19 602≠20 000\sqrt{(100-1)^2+(100-1)^2}=\sqrt{19\,602}\neq\sqrt{20\,000},因此没有任何城市会恰好位于距某处烟花 k\sqrt{k} 的位置。于是,每个未布置烟花的城市均被分配数字 11。因此,对每个 TT,其爆炸力均为 11,最终答案为 1+1+1=31+1+1=3。

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

首页