#Lutece1476. Magic boy Bi Luo with his excited math problem
Magic boy Bi Luo with his excited math problem
Migrated from Lutece 1476 Magic boy Bi Luo with his excited math problem
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
As we know, Bi Luo is a magic boy, he always has some excited questions , now a new question comes.
You are given two sequences and , he wants to caculate the of two sequences.
- = $\sum_{i=1}^{N}\sum_{j=1}^M | A_i \oplus (-B_j) + 2\ast ( A_i \& (-B_j) ) | \ast|i-j|$
Input
First Line is an positive integer , ( ) , represents there are test cases.
For each test case:
The first line contains two positive integers .( )
The second line contains non-negative integers represents .( )
The third line contains non-negative integers represents .( )
You can assume
Output
For tht - test case , first output Case #i: , then output one integer represents the Excited Value,because the Excited Value may be large , so you need to output the Excited Value mod
Samples
1
3 3
1 2 3
4 5 6
Case #1: 24
Note
The symbol of is ( https://en.wikipedia.org/wiki/Exclusive_or )
The symbol of is ( https://en.wikipedia.org/wiki/Logical_conjunction )
Resources
“玲珑杯”ACM比赛 Round #2