CF939F.Cutlet

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Arkady wants to have a dinner. He has just returned from a shop where he has bought a semifinished cutlet. He only needs to fry it. The cutlet should be fried for 2n2n seconds, in particular, it should be fried for nn seconds on one side and nn seconds on the other side. Arkady has already got a frying pan and turn on fire, but understood that maybe he won't be able to flip the cutlet exactly after nn seconds after the beginning of cooking.

Arkady is too busy with sorting sticker packs in his favorite messenger and can flip the cutlet only in some periods of time. Namely, there are kk periods of time in which he can do it, the ii -th of them is an interval of time from lil_{i} seconds after he starts cooking till rir_{i} seconds, inclusive. Arkady decided that it's not required to flip the cutlet exactly in the middle of cooking, instead, he will flip it several times in such a way that the cutlet will be fried exactly nn seconds on one side and nn seconds on the other side in total.

Help Arkady and find out if it's possible for him to cook the cutlet, if he is able to flip the cutlet only in given periods of time; and if yes, find the minimum number of flips he needs to cook the cutlet.

输入格式

The first line contains two integers nn and kk ( 1<=n<=1000001<=n<=100000 , 1<=k<=1001<=k<=100 ) — the number of seconds the cutlet should be cooked on each side and number of periods of time in which Arkady can flip it.

The next kk lines contain descriptions of these intervals. Each line contains two integers lil_{i} and rir_{i} ( 0<=li<=ri<=2n0<=l_{i}<=r_{i}<=2·n ), meaning that Arkady can flip the cutlet in any moment starting from lil_{i} seconds after the beginning of cooking and finishing at rir_{i} seconds after beginning of cooking. In particular, if li=ril_{i}=r_{i} then Arkady can flip the cutlet only in the moment li=ril_{i}=r_{i} . It's guaranteed that li>ri1l_{i}>r_{i-1} for all 2<=i<=k2<=i<=k .

输出格式

Output "Hungry" if Arkady won't be able to fry the cutlet for exactly nn seconds on one side and exactly nn seconds on the other side.

Otherwise, output "Full" in the first line, and the minimum number of times he should flip the cutlet in the second line.

输入输出样例

  • 输入#1

    10 2
    3 5
    11 13
    

    输出#1

    Full
    2
    
  • 输入#2

    10 3
    3 5
    9 10
    11 13
    

    输出#2

    Full
    1
    
  • 输入#3

    20 1
    3 19
    

    输出#3

    Hungry
    

说明/提示

In the first example Arkady should flip the cutlet in time moment 33 seconds after he starts cooking and in time moment 1313 seconds after he starts cooking.

In the second example, Arkady can flip the cutlet at 1010 seconds after he starts cooking.

首页