All Tracks Problem

Little Shino and Contests
Tag(s):

Muito fácil, Very-Easy, とてもやさしい, 非常简单

Problem
Editorial
Analytics

You are a developer at HackerEarth. You have the data of Contestants, Contests and Submissions made by Contestants in the Contests. Its guaranteed that each contestant will make exactly one submission in each contest.

Contestants table contains the details (Contestant's Id, Contestant's Name) of the contestants that took part in contests.
Contests table contains the details (Contest's Id, Contest's Name) of the contests that are conducted on HackerEarth.
Submissions table contains the details (Submission's Id, Contest's Id, Contestant's Id, Score) of the submissions made by the contestants in a contest.

For each contestant, you have to find the details of his maximum score in any contest. In other words, you have to find Contest name, Submission Id and Score of the submission in which he scored most.

The output table should be ordered by Contestants Id in ascending order.

Input Format:

Table : Contestants

Field Type
C_Id integer
Contestant_Name text

C_Id is the contestant's Id

Table : Contests

Field Type
Co_Id integer
Contest_Name text

Co_Id is the contest's Id

Table : Submissions

Field Type
Submission_Id integer
Contest_Id integer
Contestant_Id integer
Score integer

Output Format:

Field Type
Contestant_Id integer
Contestant_Name text
Contest_Name text
Submission_Id integer
Score integer

Sample Input:

Sample Contestants Table:

C_Id Contestant_Name
1 jkxhx
2 uq
3 x
4 vk
5 r

Sample Contests Table:

Co_Id Contest_Name
1 q
2 u
3 wo
4 zmzs
5 m

Sample Submissions Table:

Submission_Id Contest_Id Contestant_Id Score
1 1 1 64
2 1 2 209
3 1 3 26
4 1 4 285
5 1 5 51
6 2 1 291
7 2 2 150
8 2 3 176
9 2 4 116
10 2 5 12
11 3 1 297
12 3 2 84
13 3 3 64
14 3 4 127
15 3 5 113
16 4 1 35
17 4 2 246
18 4 3 120
19 4 4 182
20 4 5 23
21 5 1 103
22 5 2 133
23 5 3 300
24 5 4 144
25 5 5 29

Sample Output:

Contestant_Id Contestant_Name Contest_Name Submission_Id Score
1 jkxhx wo 11 297
2 uq zmzs 17 246
3 x m 23 300
4 vk q 4 285
5 r wo 15 113
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

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications