SOLVE

LATER

Game Time

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.

Table : **Students**

Field | Type |
---|---|

Name | text |

RollNo | int |

Table: **Positions**

Field | Type |
---|---|

RollNo | int |

Rank | int |

Table: **Houses**

Field | Type |
---|---|

HouseName | text |

RollNo | int |

Field | Type |
---|---|

HouseName | text |

Name | text |

Points | int |

**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 |

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_Db

Initializing Code Editor...

{"1e1f190": "/pagelets/problem-author-tester/sql/houses/", "6f76f69": "/pagelets/show-submission/sql/houses/", "a683dbb": "/pagelets/problems-hint/sql/houses/", "a8cb50e": "/pagelets/suggested-problems/sql/houses/", "fb9c813": "/pagelets/recommended-problems/sql/houses/"}

realtime.hackerearth.com

80

10641c33102f8fc62642d6cadc55d76846dbcb8d

58a29e5cae2309f04b28

/realtime/pusher/auth/