All Tracks Problem

Confused Principal
Tag(s):

Medium

Problem
Editorial
Analytics

Mishki is the principal of a school and she wants the names of some of the exceptional students who study in her school..

She has 2 tables with details about each student.

First:
It will comprise the following information related to the first semester:
ID (Student's Id)
Student (Student's Name)
Subject (Subject Name)
Marks (Marks scored in a subject)

Second:
It will comprise the following information related to the second semester:
ID (Student's Id)
Subject (Subject Name: refers to a lecture)
Test (contains “Yes” (without quotes) if a test took place for a lecture, else “No” (without quotes))

She needs to determine the student names of the first semester, who attended lectures on their favorite subjects in the second semester and have given more than or equal to 2 tests (in that subject)
“Favorite subject” refers to the subject in which the student has scored the highest marks (as against other subjects) in the first semester.

Help her for the same, and output the Student Names in the lexicographically increasing order.

Note:
1) In the First table, no student will have same marks in 2 subjects.
2) In the Second table, there can be multiple same rows. Refer Sample data for more clarity. 3) All the Student ID will be unique.

Input Format:

Table : First

Field Type
ID int
Student int
Subject Text
Marks int

Table: Second

Field Type
ID int
Subject Text
Test Text

Output Format:

Field Type
Names Text

Sample Input:

Sample First Table:

ID Student Subject Marks
1 A Maths 205
1 A English 30
2 B Science 50
2 B Hindi 70
3 C Hindi 40

Sample Second Table:

ID Subject Test
1 Hindi Yes
1 Maths No
1 Maths Yes
2 Hindi Yes
2 Hindi Yes
3 Hindi Yes
3 Hindi Yes
1 Maths No

Sample Output:

Names
B
C
Time Limit: 5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: MySQL, PostgreSQL, MSSQL, Oracle Database

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications