|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||3||0||0||0.000%|
We are given n containers, where 1 ≤ n ≤ 4. At the beginning all of them are full of water. The liter capacity of the i-th container is a natural number oi satisfying inequalities 1 ≤ oi ≤ 49.
Three kinds of moves can be made:
Write a program that:
In the first line of the standard input one positive integer n is written (n ≤ 4), this is the number of containers. There are n positive integers written in the second line. These are the capacities of the containers (the i-th integer oi denotes the capacity if the i-th container, 1 ≤ oi ≤ 49). In the third line of the input file there are written n numbers. These are the requested final volumes of water in the containers (the i-th integer wi denotes the requested final volume of water in the i-th container, 1 ≤ wi ≤ oi). All integers in the second and the third line are separated by single spaces.
If it is not possible to result in requested final situation making only allowed moves, your program should write only one word NIE to the standard output, otherwise only one integer equal to the minimal number of moves which lead to the requested final situation should be written.
3 3 5 5 0 0 4
2 20 25 10 16