#K48022. Crossing Participant Count
Crossing Participant Count
Crossing Participant Count
You are given a circular track with n positions and n participants. Each participant starts at a position given in the array a and finishes at a position given in the array b. A participant is considered to have crossed the starting position if his finishing position comes before his starting position in the cyclic order. In other words, for each participant i, if their starting position is \(a_i\) and finishing position is \(b_i\), then they are counted if and only if \(a_i > b_i\).
Your task is to determine, for each test case, the number of participants that crossed the starting position.
inputFormat
The first line contains an integer (T), denoting the number of test cases. For each test case, the input is given as follows:
- A line containing the integer (n) (the number of participants and positions).
- A line with (n) space-separated integers representing the initial positions (array (a)).
- A line with (n) space-separated integers representing the final positions (array (b)).
All input should be read from standard input (stdin).
outputFormat
For each test case, output a single line containing the count of participants who have crossed the starting position. The result for each test case should be printed on a new line to standard output (stdout).## sample
1
5
1 3 2 5 4
4 1 5 3 2
3
</p>