V_CIIC_E - Storm
Its widely known that the fibonacci sequence is associated to natural phenomenoms, in the case of atmospherics and great storms, within its patterns there are fibonacci numbers.
As we should know, the fibonacci sequence starts in 0 and 1, these numbers belong to the X0 y X1 being X2 The sum of the two previous numbers, we are considering that F(0) = 1 and F(1) = 2, that is:
1 2 3 5 8 13 21 ...
We are developing a new method of storm detection according to studies applying the fibonacci sequence, if there is data in the storm of at least K fibonacci consecutive numbers we consider the storm of grade K.
We need that, given the set of numbers in a storm and any K, you must affirm or deny if such storm is at least grade K
INPUT DETAILS
The first line contains two integers N and M that denotes the dimension of the matrix, followed by the data of storm given in N lines with M numbers in each line, separated by a space, then, the number K that it's the grade to evaluate.
OUTPUT DETAILS
You must print “YES” if the grade of storm is at least K, print “NO” otherwise.
INPUT |
OUTPUT |
3 4 2 1 5 4 8 9 2 7 3 5 4 1 6 |
YES |
CONSTRAINTS
0 < K ≤ 40
0 < N,M ≤ 1000
Added by: | Venezuelan Programming League |
Date: | 2013-02-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |