Cockroaches in the building Time Limit: 3.0 second Memory Limit: 64 000 KB
Petya
lives in a many-storied building where each flat occupies an entire
story. Petya has studied local flora and fauna for many years. Having
performed montly metering, he notices the following peculiarities:
- The number of cockroaches in each of the flats is an integer ranged from 0 to N, where N is a non-negative number not exceeding 30.
- The number of cockroaches in a flat during a month is a function
of three arguments: the number of cockroaches in this flat and the
flats
above and below this one during the previous month.
Petya becomes interested in inducing the ways the insects' population
size changes under these laws. To avoid the special cases of ground
floor and top floor, where the laws might be more complicated, Petya
decided to solve this problem for an infinite-storied skyscraper. Let's
consider that the number of cockroaches can decrease if they can be
distributed among the flats (having no more than N
in any) in such a way that in the next month the total number of
cockroaches in the building will decrease. Only a finite number of
cockroaches can exist in the building; thus, all the flats, except a
finite number of them, are free from these insects. Likewise, the
number of cockroaches can increase if they can be distributed among the
flats in such a way that in the next month the total number of
cockroaches in the building will increase (and may possibly become
infinite).InputThe first line of the input contains the single number N - the maximum number of cockroaches in a flat. Following are samples of the function that defines the changes in the
number of cockroaches in a flat. The samples are organized in a table having N+1 block, where each block has N+1 lines, and each line has N+1 numbers ranged from 0 to N. k'th number of i'th line of j'th block contains the number of cockroaches in the table for the current month
if in the previous month there were j cockroaches in it, i cockroaches
in the flat below, and k cockroaches in the flat above. The indices of blocks, lines, and numbers are zero-based. OutputThe output must contain either:
- =, if the number of cockroaches can neither increase or decrease, or
- <, if the number of cockroaches can decrease, but not increase, or
- >, if the number of cockroaches can increase, but not decrease, or
- <>, if the number of cockroaches can both increase and decrease.
Sample InputSample input #1
1
0 1
0 1
0 0
1 1
Sample input #2
2
2 0 0
0 0 0
0 0 0
1 1 1
1 1 1
1 1 1
2 2 2
2 2 2
2 2 0 Sample OutputSample output #1
=
Sample output #2
<> Problem Author: Andrew Rumyantsev Problem Source: Petrozavodsk summer training camp, August 2005.
Print
Statistic
Discuss
Submit
|