CF987C Three displays

题目描述

### 形式化题面 给定一个有两个性质 $s_i$ 和 $c_i$ 的数组,要求在其中选出三个数,满足: - $i

输入格式

第一行一个整数 $n$ 表示数组长度. 接下来一行 $n$ 个整数,表示 $s_i$. 接下来一行 $n$ 个整数,表示 $c_i$.

输出格式

一行一个整数,表示最小的 $c_i+c_j+c_k$ 翻译 @[zymooll](/user/289296)

说明/提示

In the first example you can, for example, choose displays $ 1 $ , $ 4 $ and $ 5 $ , because $ s_1 < s_4 < s_5 $ ( $ 2 < 4 < 10 $ ), and the rent cost is $ 40 + 10 + 40 = 90 $ . In the second example you can't select a valid triple of indices, so the answer is -1.