Logo
(追記) (追記ここまで)

34451번 - Multiple Choice 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB33262580.645%

문제

Mrs. Technoscan often gives multiple choice quizzes in her classroom. She likes this since she is able to feed the forms from the quizzes into a specialized scanner to automatically grade all of the quizzes.

However, this semester, Mrs. Technoscan's class is being held in a computer lab, and all of the students will have access to a computer during the quizzes. She created a website in which the students can input their multiple choice answers, and has the students' answers download to a file on her PC.

Help Mrs. Technoscan out by writing this program which reads this file on input, creating a grade for each student based on their answers, and creating sorted results on output.

입력

Input starts with a single integer on it's own line, $N$ (1ドル \le N \le 40$), which indicates the number of questions on the quiz. The next $N$ lines indicate the answer key, each line with the capital letter A, B, C, or D on it.

After reading the answer key, you will read a single integer on its own line, $M$ (1ドル \le M \le 300$), which indicates the number of students who took the quiz. Then, for each of the $M$ students comes:

  • A line with an integer $S$ (1ドル \le S \le 10^9$) on its own, indicating the student ID of that particular student. You are guaranteed that $S$ will be unique for each student in a particular input.
  • $N$ lines indicating the student's answers. You are guaranteed each line will only have the capital letter A, B, C, or D on it.

Finally, the last line of input will contain STUDENT_ID_ASC, STUDENT_ID_DESC, GRADE_ASC, or GRADE_DESC, indicating the order in which you should output the results. These values indicate sort by student ID (ascending or descending), or by grade (ascending or descending) respectively. When two or more students have the same number of correct answers, you should order those students by student ID, ascending.

출력

Output the student ID and grade (an integer with the number of correct answers) for each student on its own line, in the order specified by the input.

제한

예제 입력 1

5
A
C
D
C
B
3
1234
A
C
D
C
B
4321
A
C
C
B
D
800
B
D
D
C
D
GRADE_DESC

예제 출력 1

1234 5
800 2
4321 2

예제 입력 2

1
A
10
1500
A
1300
B
1400
C
1200
D
1100
A
600
B
700
C
1000
D
900
A
800
B
STUDENT_ID_ASC

예제 출력 2

600 0
700 0
800 0
900 1
1000 0
1100 1
1200 0
1300 0
1400 0
1500 1

노트

출처

School > CS@Mines > CS@Mines HSPC 2018 F번

  • 문제를 만든 사람: Jack Rosenthal
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /