Codeforces Round 118 (Div. 1)
C
Clever Fat Rat
Codeforces
2500
原题
← BD →
翻译中…

The Fat Rat and his friend Сerealguy have had a bet whether at least a few oats are going to descend to them by some clever construction. The figure below shows the clever construction.

翻译中…

image

翻译中…

A more formal description of the clever construction is as follows. The clever construction consists of $*n*$ rows with scales. The first row has $*n*$ scales, the second row has $(*n* - 1)$ scales, the $*i*$-th row has $(*n* - *i* + 1)$ scales, the last row has exactly one scale. Let's number the scales in each row from the left to the right, starting from $1$. Then the value of $*w*_{*i*, *k*}$ in kilograms $(1 ≤ *i* ≤ *n*; 1 ≤ *k* ≤ *n* - *i* + 1)$ is the weight capacity parameter of the $*k*$-th scale in the $*i*$-th row.

翻译中…

If a body whose mass is not less than $*w*_{*i*, *k*}$ falls on the scale with weight capacity $*w*_{*i*, *k*}$, then the scale breaks. At that anything that the scale has on it, either falls one level down to the left (if possible) or one level down to the right (if possible). In other words, if the scale $*w*_{*i*, *k*}$ $(*i* < *n*)$ breaks, then there are at most two possible variants in which the contents of the scale's pan can fall out: all contents of scale $*w*_{*i*, *k*}$ falls either on scale $*w*_{*i* + 1, *k* - 1}$ (if it exists), or on scale $*w*_{*i* + 1, *k*}$ (if it exists). If scale $*w*_{*n*, 1}$ breaks, then all its contents falls right in the Fat Rat's claws. Please note that the scales that are the first and the last in a row, have only one variant of dropping the contents.

翻译中…

Initially, oats are simultaneously put on all scales of the first level. The $*i*$-th scale has $*a*_{*i*}$ kilograms of oats put on it. After that the scales start breaking and the oats start falling down in some way. You can consider everything to happen instantly. That is, the scale breaks instantly and the oats also fall instantly.

翻译中…

The Fat Rat is sure that whatever happens, he will not get the oats from the first level. Cerealguy is sure that there is such a scenario, when the rat gets at least some number of the oats. Help the Fat Rat and the Cerealguy. Determine, which one is right.

翻译中…

Input

翻译中…

The first line contains a single integer $*n*$ $(1 ≤ *n* ≤ 50)$ — the number of rows with scales.

翻译中…

The next line contains $*n*$ space-separated integers $*a*_{*i*}$ $(1 ≤ *a*_{*i*} ≤ 10^{6})$ — the masses of the oats in kilograms.

翻译中…

The next $*n*$ lines contain descriptions of the scales: the $*i*$-th line contains $(*n* - *i* + 1)$ space-separated integers $*w*_{*i*, *k*}$ $(1 ≤ *w*_{*i*, *k*} ≤ 10^{6})$ — the weight capacity parameters for the scales that stand on the $*i*$-th row, in kilograms.

翻译中…

Output

翻译中…

Print "Fat Rat" if the Fat Rat is right, otherwise print "Cerealguy".

翻译中…

Note

翻译中…

Notes to the examples:

翻译中…
  • The first example: the scale with weight capacity 2 gets 1. That means that the lower scale don't break.
  • The second sample: all scales in the top row obviously break. Then the oats fall on the lower row. Their total mass is 4,and that's exactly the weight that the lower scale can "nearly endure". So, as 4 $≥$ 4, the scale breaks.
翻译中…

样例

Input #1
1
1
2
Output #1
Fat Rat
InputCopy OutputCopy
Input #2
2
2 2
1 2
4
Output #2
Cerealguy
InputCopy OutputCopy
Input #3
2
2 2
1 2
5
Output #3
Fat Rat
InputCopy OutputCopy
题目信息
题号
185C
时间限制
2.5 s
内存限制
256 MB
标签
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。