luogu#P7892. 『JROI-3』田径

『JROI-3』田径

Background

You are getting ready to play MC.

Problem Description

You need to use fences to enclose a rectangular area. Suppose this rectangle has size a×ba \times b pixel cells. Then you need a fence frame of size (a+1)(a+1) in length and (b+1)(b+1) in width to enclose this area.

Now you find that your sheep and cows need exactly nn pixel cells to survive, and you have mm fences in your backpack. You want to know whether, with the fences you have, you can enclose nn pixel cells.

You do not need to use up all fences. As long as you can enclose a rectangle whose area is nn pixel cells.

Note that a,b,n,ma,b,n,m above must all be integers.

Input Format

The first line contains an integer TT, the number of test cases.

The next TT lines each contain two integers n,mn,m, as described.

Output Format

Output one string per line. If it is possible, output Good; otherwise, output Miss.

2
4 1
4 20
Miss
Good

Hint

Sample 1 Explanation

First test case:

It can be verified that it is impossible to use 11 fence to enclose 44 pixel cells.

Second test case:

You can consider enclosing 4=1×44=1 \times 4 pixel cells as follows.

Using the method below only requires 1414 fences.

The fence width is 1+1=21+1=2, the length is 4+1=54+1=5, and (2+5)×2=14(2+5) \times 2=14.

Constraints and Notes

This problem uses bundled tests.

  • Subtask 1 (30 pts): 1n,m1041\le n,m \le 10^4, T103T \leq 10^3;
  • Subtask 2 (70 pts): 1n,m1081\le n,m \le 10^{8}, T103T \leq 10^3.

In this problem, fences are abstract rather than concrete. That is, a fence will degenerate into a point rather than a cell. So we can compute how many fences a fence frame consumes by computing the perimeter (if you do not understand, you can look at the Sample 1 explanation).

Translated by ChatGPT 5