All Tracks Problem

Game Time
Tag(s):

Easy-Medium, 簡単-普通

Problem
Editorial
Analytics

Fredo is back again with an interesting activity for his class. Today, all students of his class are playing a game. Every student in the class has a unique roll number. Each student belongs to some house (Red/ Yellow/ Green/ Blue). The students are uniquely ranked in the game.
The student with rank $$i$$ gets $$(n+1-i)*100$$ points where $$n$$ is the total number of students in the class. Fredo wants to know the total points for each house and the best performing student's name for that house. Help him achieve the task.
Total points for any house is the sum of all students' points belonging to that house.Best performing student for any house is the student which earns the house most points.
Note: Output should contain the houses in ascending order of their names.

Input Format:

Table : Students

Field Type
Name text
RollNo int

Table: Positions

Field Type
RollNo int
Rank int

Table: Houses

Field Type
HouseName text
RollNo int

Output Format:

Field Type
HouseName text
Name text
Points int

Sample Input:

Sample Students Table:

Name RollNo
abc 2013001
def 2013002
ghi 2013003
jkl 2013004

Sample Positions Table:

RollNo Rank
2013003 1
2013001 2
2013004 3
2013002 4

Sample Houses Table:

HouseName RollNo
Yellow 2013001
Blue 2013002
Red 2013003
Yellow 2013004

Sample Output:

HouseName Name Points
Blue def 100
Red ghi 400
Yellow abc 500
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