# Codeforces Round #230 (Div. 1) D. Three Arrays

https://codeforces.com/contest/392/problem/DLet $f_A(k)$ be the minimum i such that $A_i=k$. If there doesn't exist such a index, we define $f_A(k) = \infty$. $f_B(k)$ and $f_C(k)$ are similarly defined. Then, we want to obtain t…