QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#12040. 递增序列

统计

给定三个长度为 $n$ 的序列 $a[1...n], l[1...n], r[1...n]$,你需要求满足以下所有条件的长度为 $n$ 的序列 $b$ 的个数

  1. 对于 $1\leq i\leq n$,$l[i]\leq b[i]\leq r[i]$
  2. 对于 $1\leq i < n$,$b[i] < b[i+1]$
  3. 对于 $1\leq i\leq n$,$a[i]\&b[i]=a[i]$,这里的 $\&$ 为二进制下的与 (and) 运算符号

由于答案可能很大,你只需要输出答案对 $998244353$ 取模后的值

输入格式

第一行一个正整数 $n$

第二行 $n$ 个整数,表示 $a[1...n]$

第三行 $n$ 个整数,表示 $l[1...n]$

第四行 $n$ 个整数,表示 $r[1...n]$

输出格式

输出答案对 $998244353$ 取模后的值

样例数据

样例 1 输入

3
0 0 0
0 0 0
10 10 10

样例 1 输出

165

子任务

$Task1~(22pts)$:$0\leq a[i],l[i],r[i]\leq 10^5$

$Task2~(26pts)$:对于所有的 $1\leq i\leq n$,满足 $a[i]=0$

$Task3~(52pts)$:无限制

对于所有数据,保证 $0\leq a[i],l[i],r[i] < 2^{60}$,$1\leq n\leq 100$

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.