#Lutece3305. Calculate Probability
Calculate Probability
Description
Batman is caught by the Joker, but Joker does not want to kill Batman directly, he wants to play a game with Batman. Now Batman has a non-decreasing array of length . Joker has a non-decreasing array of length . Joker asks Batman to choose a number randomly from array . Meanwhile he chooses a number randomly from array . If , Joker will let Batman go. Batman now wants to know how many scenarios he could survive.
Input
The first line contains two integers and ().
The second line contains integers ().
The third line contains integers ().
Output
Print one integer, indicating the number of the scenarios he could survive.
Samples
5 5
2 3 4 5 6
1 2 3 4 5
15
Note
The answer may exceed the int
range.
Resources
电子科技大学第十三届 ACM 趣味程序设计竞赛