Description After midterm, kind teacher C.C. in class Rou decides to holds a bingo game in class Rou. The game rules are as followed: 1. Every student should prepare a 5 by 5 girds on the bingo card. 2. Filling bingo card with a number from 1 to 25. Each number should exist exactly once. 3. Handing the filled bingo card to the teacher. 4. According to teacher CC's mood, she will come out an order of the numbers from 1 to 25. 5. For each bingo card, the teacher will mark the number as the order in step 4. until all numbers in some lines are marked. 6. Each marked number will consider one additional point for the student. There are 12 lines in the bingo card, 5 vertical lines, 5 horizontal lines, and 2 diagonal lines. Please write a program to help teacher C.C. to judge bingo cards. Input The first line of input is an integer nn, shows the number of students, numbering through 1 to n. Followed by 5n5n lines are bingo cards. Every 5 lines are one card. The last line with 25 integers is the sequence which shows the ordering that teacher C.C. mark numbers on bingo cards. 1 \le n \le 301≤n≤30 All the numbers on cards will be filled to 2 digits with leader 0. Each number of {1, 2, ..., 25} should appear exactly once. Output For convenience, please group students with the same total additional points in the form "score: id id id" (exclude quarts). Each id behind a white space. Please order the total additional points and student IDs in increasing order. Sample Input 1  3 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 01 06 11 16 21 02 07 12 17 22 03 08 13 18 23 04 09 14 19 24 05 10 15 20 25 15 20 19 10 17 01 12 18 23 04 06 08 25 22 16 24 21 07 11 02 14 05 09 03 13 11 14 15 05 08 10 18 22 07 20 21 19 02 25 12 03 13 09 17 24 16 04 01 23 06 Sample Output 1 14: 1 2 15: 3

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Description

After midterm, kind teacher C.C. in class Rou decides to holds a bingo game in class Rou. The game rules are as followed:

1. Every student should prepare a 5 by 5 girds on the bingo card.

2. Filling bingo card with a number from 1 to 25. Each number should exist exactly once.

3. Handing the filled bingo card to the teacher.

4. According to teacher CC's mood, she will come out an order of the numbers from 1 to 25.

5. For each bingo card, the teacher will mark the number as the order in step 4. until all numbers in some lines are marked.

6. Each marked number will consider one additional point for the student.

There are 12 lines in the bingo card, 5 vertical lines, 5 horizontal lines, and 2 diagonal lines. Please write a program to help teacher C.C. to judge bingo cards.

Input

The first line of input is an integer nn, shows the number of students, numbering through 1 to n.

Followed by 5n5n lines are bingo cards. Every 5 lines are one card.

The last line with 25 integers is the sequence which shows the ordering that teacher C.C. mark numbers on bingo cards.

  • 1 \le n \le 301≤n≤30
  • All the numbers on cards will be filled to 2 digits with leader 0.
  • Each number of {1, 2, ..., 25} should appear exactly once.

Output

For convenience, please group students with the same total additional points in the form "score: id id id" (exclude quarts).

Each id behind a white space. Please order the total additional points and student IDs in increasing order.

Sample Input 1 

3
01 02 03 04 05
06 07 08 09 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
01 06 11 16 21
02 07 12 17 22
03 08 13 18 23
04 09 14 19 24
05 10 15 20 25
15 20 19 10 17
01 12 18 23 04
06 08 25 22 16
24 21 07 11 02
14 05 09 03 13
11 14 15 05 08 10 18 22 07 20
21 19 02 25 12 03 13 09 17 24
16 04 01 23 06

Sample Output 1

14: 1 2
15: 3
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY