#P6586. 『JROI-1』 蒟蒻火锅的盛宴
『JROI-1』 蒟蒻火锅的盛宴
Description
There are distinct integers. Now there are integers that belong to the set .
Aw Dundun defines this set with the following rules:
- If , then .
- If is not among the integers, then do nothing.
- If for a set there are no elements that need to be added, then it is complete.
If the set is complete, output Great Set!. Otherwise, output at least how many more ingredients must be added according to the rules to make it complete.
Input Format
The first line is an integer , meaning there are integers in total.
The next line contains integers separated by spaces, all distinct.
The next line is a positive integer , meaning there are integers in the set , and all of them are among the integers.
The next line contains integers separated by spaces.
The last line is a positive integer .
Output Format
If this set is already complete, output Great Set!.
Otherwise, output the number of integers needed to make this set complete.
5
1 2 3 4 5
3
1 3 5
2
Great Set!
15
13 2 10 3 1 12 8 4 5 7 9 6 15 14 11
7
13 2 1 12 8 3 10
2
8
50
13 2 10 50 1 28 37 32 30 46 19 47 33 41 24 34 27 42 49 18 9 48 23 35 31 8 7 12 6 5 3 22 43 36 11 40 26 4 44 17 39 38 15 14 25 16 29 20 21 45
10
50 46 30 32 10 2 28 37 1 13
3
31
Hint
Sample Explanation
Sample 1 Explanation
This set contains . Here, , , and does not exist, so this set is complete.
Sample 2 Explanation
All remaining integers belong to this set.
Constraints
- .
- .
- .
Bundled Testcases
| Test Point ID | Time Limit | Score Allocation | |
|---|---|---|---|
The time limit for this problem has been set to times that of . Some test points are included in the attachment.
Translated by ChatGPT 5
京公网安备 11011102002149号