#C10602. Minimum Operations to Convert Arrays

    ID: 39826 Type: Default 1000ms 256MiB

Minimum Operations to Convert Arrays

Minimum Operations to Convert Arrays

Given two arrays a and b of length n, where both arrays are sorted in non-decreasing order, your task is to compute the minimum number of operations required to convert array a into array b. An operation is defined as replacing an element in a with the corresponding element in b if they differ.

Formally, you are to count the number of indices \( i \) (with \( 1 \le i \le n \)) such that
\( a_i \neq b_i \). The answer is the total number of such indices.

inputFormat

The input consists of three lines:

  • The first line contains an integer \( n \), the length of the arrays.
  • The second line contains \( n \) space-separated integers representing the array a.
  • The third line contains \( n \) space-separated integers representing the array b.

outputFormat

Output a single integer representing the minimum number of operations required to convert array a into array b.

## sample
5
1 2 3 4 5
1 2 5 4 5
1