ExpediaOA #1
Minimum Steps to Reorder Neural Network Layers
估计中等可在线判题
In each step, you may only take the layer at the end of the current list and insert it at any position. desired is guaranteed to be reachable.
输入格式
The first line contains n (1≤n≤200000), the second line current, and the third line desired. Both arrays are permutations of 1..n.
输出格式
Output the minimum number of operations.
样例 1
输入:
5
2 1 3 5 4
2 4 1 5 3
输出:
2
样例 2
输入:
3
1 2 3
1 2 3
输出:
0
样例 3
输入:
3
3 2 1
1 2 3
输出:
2