시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 5 | 3 | 3 | 60.000% |
Bobo has an undirected graph with $(2n + 2)$ vertices conveniently labeled with the following pairs of integers: $(0, 0), (0, 1), \dots, (0, n), (1, 0), (1, 1), \dots, (1, n)$. The graph has three classes of edges.
Bobo would like to find the maximum flow from vertex $(0, 0)$ to vertex $(1, n)$.
The input contains zero or more test cases, and is terminated by end-of-file. For each test case:
The first line contains an integer $n$ ($1 \leq n \leq 5 \cdot 10^5$).
The second line contains $n$ integers $a_1, a_2, \dots, a_n$.
The third line contains $n$ integers $b_1, b_2, \dots, b_n$.
The fourth line contains $(2n + 1)$ integers $c_1, c_2, \dots, c_{2n + 1}$.
The constraints are: $1 \leq a_i, b_i, c_i \leq 10^9$.
It is guaranteed that the number of test cases does not exceed $10^5$, and the sum of all $n$ does not exceed $5 \cdot 10^5$.
For each test case, output an integer which denotes the maximum flow.
1 2 2 1 3 1 3 1 4 7 2 5 8 2 3 3 2 1 2 4
5 6