It’s Karaoke time! DreamGrid is performing the song Powder Snow in the game King of Karaoke. The song performed by DreamGrid can be considered as an integer sequence D 1 , D 2 , … … , D n D_{1}, D_{2},……,D_{n} D1,D2,……,Dn , and the standard version of the song can be considered as another integer sequence S 1 , S 2 , … … , S n S_{1},S_{2},……,S_{n} S1,S2,……,Sn . The score is the number of integers i satisfying 1 ≤ i ≤ n 1 \le i \le n 1≤i≤n and S i = D i S_{i} = D_{i} Si=Di .
As a good tuner, DreamGrid can choose an integer (can be positive, 0, or negative) as his tune and add to every element in . Can you help him maximize his score by choosing a proper tune?
There are multiple test cases. The first line of the input contains an integer T (about 100), indicating the number of test cases. For each test case:
The first line contains one integer n ( 1 ≤ n ≤ 1 0 5 1 \le n \le 10^{5} 1≤n≤105 ), indicating the length of the sequences D and S.
The second line contains n integers D 1 , D 2 , … … , D n D_{1},D_{2},……,D_{n} D1,D2,……,Dn ( − 1 0 5 ≤ D i ≤ 1 0 5 -10^{5} \le D_{i} \le 10^{5} −105≤Di≤105 ), indicating the song performed by DreamGrid.
The third line contains n integers S 1 , S 2 , … … , S n S_{1},S_{2},……,S_{n} S1,S2,……,Sn ( − 1 0 5 ≤ S i ≤ 1 0 5 -10^{5} \le S_{i} \le 10^{5} −105≤Si≤105 ), indicating the standard version of the song.
It’s guaranteed that at most 5 test cases have n > 100.
For each test case output one line containing one integer, indicating the maximum possible score.
2 4 1 2 3 4 2 3 4 6 5 -5 -4 -3 -2 -1 5 4 3 2 1
3 1
将两个序列作差之后对差值计数,出现最多的差值的次数即为最大得分,输出结果。这里用map计数很好用。
