QOJ.ac

QOJ

Time Limit: 5 s Memory Limit: 512 MB Total points: 100

#13267. 异或和

Statistics

题目描述

给定 $m$ 和序列 $a_1, a_2, \dots, a_m$,令 $R = 2^{a_1} + 2^{a_2} + \dots + 2^{a_m}$,保证 $a_1 < a_2 < \dots < a_m$。

给定 $c$ 和 $c$ 个整数 $A_1, A_2, \dots, A_c$,令集合 $A = \{1, A_1, A_2, \dots, A_c\}$。

你需要选取 $n$ 个 $[0, R)$ 中的整数,使得:

  • 其异或和为 $0$。
  • 对于每个出现过的整数,其出现次数 $\in A$。

两种方案不同,当且仅当存在某个整数出现次数不同。

求出方案数取模 $998244353$ 的结果。

输入格式

第一行,三个整数 $n, m, c$。

第二行,$c$ 个正整数 $A_1, A_2, \dots, A_c$。若 $c=0$ 则没有这一行。

第 $[c > 0]+1$ 行,$m$ 个非负整数 $a_1, a_2, \dots, a_m$。

输出格式

一行,一个非负整数表示答案。

样例

样例输入 1

4 3 0
1 3 5

样例输出 1

1978

样例输入 2

3 5 1
2
0 1 2 5 6

样例输出 2

1494

样例输入 3

2333 2 5
2 3 4 5 6
114514 1919810

样例输出 3

264224065

数据范围

对于 $100\%$ 的数据,$1 \le n, m \le 10^5$,$0 \le c \le 10$,$0 \le a_1 < a_2 < \dots < a_m \le 10^{18}$,$1 < A_1 < A_2 < \dots < A_c \le n$。

各测试点数据范围如下表:

测试点编号 特殊限制
$1$ $n \le 3$,$a_m \le 6$
$2 \sim 3$ $c\le 0$,$m \le 1$
$4 \sim 6$ $c\le 0$,$n \le 7$,$m \le 100$
$7 \sim 9$ $c\le 0$,$n \le 10$,$m \le 100$
$10 \sim 12$ $c\le 0$,$n, m \le 100$
$13 \sim 15$ $c\le 0$,$n, m \le 5000$
$16 \sim 18$ $c\le 0$
$19 \sim 20$
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.