#K63272. Task Sorting Challenge
Task Sorting Challenge
Task Sorting Challenge
You are given a collection of tasks. Each task has a title, a description, a priority, and a due date. The due date is provided in the YYYY-MM-DD format. Your goal is to sort these tasks primarily by their due date in ascending order. In case two tasks have the same due date, they should be sorted by their priority in descending order.
The sorting criteria can be mathematically expressed as:
[ \text{Sort by } (d, -p) \quad \text{ where } d \text{ is the due date and } p \text{ is the priority.} ]
After sorting, output the tasks in the same format as they were provided, each on a new line.
inputFormat
The input is read from standard input (stdin) and follows the format:
N Title1 Description1 Priority1 DueDate1 Title2 Description2 Priority2 DueDate2 ... (N tasks in total)
Where N is the number of tasks. Each subsequent line contains a task's details separated by spaces.
outputFormat
The output should be printed to standard output (stdout). It should contain the sorted tasks, one per line, adhering to the same format as the input (without the initial N).
## sample5
Task1 WriteCode 5 2023-11-10
Task2 FixBugs 8 2023-11-05
Task3 UpdateDocs 4 2023-11-10
Task4 TeamMeeting 7 2023-11-01
Task5 CodeReview 6 2023-11-05
Task4 TeamMeeting 7 2023-11-01
Task2 FixBugs 8 2023-11-05
Task5 CodeReview 6 2023-11-05
Task1 WriteCode 5 2023-11-10
Task3 UpdateDocs 4 2023-11-10
</p>