harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-9270harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-9270Beppa and her group of geek friends communicate via a group chat in the messaging application SwerChat$^{\text{TM}}$. The chat consists of n members (excluding Beppa), each with a unique ID ranging from 1 to n. When a user opens the group chat, the app displays other members sorted by their last seen time, with the most recently seen member listed first.
Today, Beppa opened the group chat twice—once at 9:00 and again at 22:00. During these instances, she noted the list of members as displayed by the app. Now, she wants to determine the minimum number of other members who must have been online at least once during the time interval between her two chat openings.
Important Assumptions:
The input consists of multiple test cases. The first line contains an integer t (1 ≤ t ≤ 10000) — the number of test cases.
For each test case:
n (1 ≤ n ≤ 10^5) — the number of members in the group (excluding Beppa).n integers a_1, a_2, ..., a_n — the IDs of the members sorted by decreasing times of last seen online at 9:00.n integers b_1, b_2, ..., b_n — the IDs of the members sorted by decreasing times of last seen online at 22:00.Constraints:
1 ≤ i < j ≤ n, it is guaranteed that a_i ≠ a_j and b_i ≠ b_j.n across all test cases does not exceed 10^5.For each test case, output the minimum number of members that must have been online at least once between 9:00 and 22:00.
4
5
1 4 2 5 3
4 5 1 2 3
6
1 2 3 4 5 6
1 2 3 4 5 6
8
8 2 4 7 1 6 5 3
5 6 1 4 8 2 7 3
1
1
1
2
0
4
0
4 and 5 must have been online at some point between 9:00 and 22:00.Please place your solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.