Give you n,A1...n,B1...nn,A_{1...n},B_{1...n}n,A1...n,B1...n, you need to calculate: Ck=∑i=1kAgcd(i,k)Bgcd(k+1i,k)C_k=sum_{i=1}^{k}A_{gcd(i,k)}B_{gcd(k+1-i,k)}Ck=∑i=1kAgcd(i,k)Bgcd(k+1i,k) Because t
Give you n,A1...n,B1...nn,A_{1...n},B_{1...n}n,A1...n,B1...n, you need to calculate: Ck=∑i=1kAgcd(i,k)Bgcd(k+1−i,k)C_k=sum_{i=1}^{k}A_{gcd(i,k)}B_{gcd(k+1-i,k)}Ck=∑i=1kAgcd(i,k)Bgcd(k+1−i,k) Because the output may be too large, let AnsiAns_iAnsi denote Ci mod 998244353C_i~mod~998244353Ci mod 998244353, you only need to output Ans1 xor Ans2 xor ... xor AnsnAns_1~xor~Ans_2~xor~...~xor~Ans_nAns1 xor Ans2 xor ... xor Ansn
(图片来源网络,侵删)