SOLVE

LATER

Make Groups

Problem

Editorial

Analytics

Fredo is a class teacher. Today, he wants his class to form groups for an activity. He noticed that some students are absent. The number of present students in the class is a multiple of 3. So, he asked the students to form a group of 3 students for the activity.

He knows that students will form groups as:

First three rank holders present in the class would make one group, next three would make other group and so on.

He wants to make an entry of all the groups formed. So, he wants you to maintain a table which stores the minimum and maximum ranked student's roll number for each group. He wants the groups to be ordered in the table such that the group with minimum ranked students comes first , then the next group with ranks greater than the previous group and less than rest groups , and so on.

See the sample input and output for clarity.

Table : **Students**

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

RollNo | INT |

Rank | INT |

**Sample Students Table:**

RollNo | Rank |
---|---|

2013023 | 13 |

2013045 | 23 |

2013001 | 45 |

2013005 | 1 |

2013040 | 3 |

2013044 | 14 |

first | last | |
---|---|---|

2013005 | 2013023 | |

2013044 | 2013001 |

Explanation

The groups formed are:

{2013005,2013040,2013023}

{2013044,2013045,2013001}

The group with member 2013005 has all ranks less than group with member 2013044, so that group comes first in the table.

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

Initializing Code Editor...

{"29f56e3": "/pagelets/problems-hint/sql/send-the-emails/", "29f56fe": "/pagelets/recommended-problems/sql/send-the-emails/", "29f5680": "/pagelets/show-submission/sql/send-the-emails/", "29f56c6": "/pagelets/problem-author-tester/sql/send-the-emails/", "29f56a7": "/pagelets/suggested-problems/sql/send-the-emails/"}

{}

realtime.hackerearth.com

80

5638c76cf705ababc6c4a4a8b30058f13d6a83cf

58a29e5cae2309f04b28

/realtime/pusher/auth/