F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

权值

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 189    Accepted Submission(s): 22


Problem Description
给定数组 $b_{1...n}$ 和 $c_{1...n}$,求有几个整数数列 $a_{1...n}$,满足 $0\leq a_i<2^{60}$,且 $a_i~xor~a_{b_i}\leq c_i$

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

Input
第一行一个正整数 $3\leq n\leq 10^5$

第二行 $n$ 个整数表示 $b_{1...n}$,满足 $1\leq b_i\leq n$,且 $b_i\neq i$

第三行 $n$ 个整数表示 $c_{1...n}$,满足 $0\leq c_i<2^{60}$
 

Output
输出答案
 

Sample Input
3 2 3 1 2 1 2
 

Sample Output
416046766
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 19:41:50, Gzip enabled