"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:
Given the final ranklist and a sequence of contestant ID's, you are supposed to tell the corresponding awards.
Each input file contains one test case. For each case, the first line gives a positive integer N (≤104), the total number of contestants. Then N lines of the ranklist follow, each in order gives a contestant's ID (a 4-digit number). After the ranklist, there is a positive integer K followed by K query ID's.
For each query, print in a line ID: award
where the award is Mystery Award
, or Minion
, or Chocolate
. If the ID is not in the ranklist, print Are you kidding?
instead. If the ID has been checked before, print ID: Checked
.
- 6
- 1111
- 6666
- 8888
- 1234
- 5555
- 0001
- 6
- 8888
- 0001
- 1111
- 2222
- 8888
- 2222
- 8888: Minion
- 0001: Chocolate
- 1111: Mystery Award
- 2222: Are you kidding?
- 8888: Checked
- 2222: Are you kidding?
- #include
- #include
- #include
- #include
- using namespace std;
- bool isPrime[10010], vis[10010], have[10010];
- int n, k, x, cnt;
- int r[10010], Prime[10010];
-
- int main() {
- cin >> n;
- isPrime[1] = 1;
- for (int i = 2; i <= 10000; i++) {
- if (!isPrime[i]) {
- Prime[++cnt] = i;
- }
- for (int j = 1; j <= cnt && i * Prime[j] <= 10000; j++) {
- isPrime[i * Prime[j]] = 1;
- if (i % Prime[j] == 0) {
- break;
- }
- }
- }
- for (int i = 1; i <= n; i++) {
- cin >> x;
- r[x] = i;
- have[x] = 1;
- }
- cin >> k;
- while (k--) {
- cin >> x;
- cout << setw(4) << setfill('0') << x << ": ";
- if (!vis[x]) {
- if (!have[x]) {
- cout << "Are you kidding?" << endl;
- } else if (r[x] == 1) {
- cout << "Mystery Award" << endl;
- vis[x] = 1;
- } else if (!isPrime[r[x]]) {
- cout << "Minion" << endl;
- vis[x] = 1;
- } else {
- cout << "Chocolate" << endl;
- vis[x] = 1;
- }
- } else {
- cout << "Checked" << endl;
- }
- }
- return 0;
- }