LCC/Moose '19 Contest 1 J3 - Emily and Timetable

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

As the President of MCPT, Emily needs to plan out the dates for lots of meetings. However, the school calendar is filled with N (1 \le N \le 10^5) events on the dates d_{1}, d_{2}, ... d_{n}, and the members of MCPT will get very unhappy if she schedules a conflict. The MCPT timetable needs to have K (1 \le K \le 10^5) meetings on the dates e_{1}, e_{2}, ... e_{k}, and Emily needs to finish planning it before it is too late! Can you tell Emily whether one of her meetings conflicts with an event from the school calendar?

Input Specification

The first line of input will contain two integers N and K, the number of school events and MCPT meetings, respectively.

The next line will contain N space-separated integers, d_{1}, d_{2}, \ldots d_{n} (0 \le d_{i} \le 10^9), the dates of the school events.

The next line will contain K space-separated integers, e_{1}, e_{2}, \ldots e_{k} (0 \le e_{i} \le 10^9), the dates of the MCPT meetings.

Output Specification

For every MCPT meeting, print Good if the meeting doesn't conflict with any events, or baf if it does, on its own line.

Sample Input

4 4
1 2 3 9
1 2 5 9

Sample Output

baf
baf
Good
baf

Subtasks

Subtask 1 [30%]

N \times K \le 2 \times 10^9

Subtask 2 [70%]

No further constraints.


Comments

There are no comments at the moment.