Submit | All submissions | Best solutions | Back to list |
EI20213FQ3 - The Highest Revenue |
You are given a list of transactions, each of them includes transaction code, product code, selling price, and quantity.
For each product, you have to find out the selling price at which the revenue is the highest. If there are more than one product that have the same highest revenue, print the lowest price.
Input
- The first line contains one integer N - the number of transactions (1 ≤ N ≤ 105).
- Each line in the next N lines contains four integers representing a transaction. All of them are not exceed 109
Output
For each product, output the product code and the required selling price and the highest revenue. The list of products should be sorted in ascending order of product code
Sample
https://drive.google.com/file/d/1FxoUcbMxkKt4mbsfK-S7MfXoviDsO1i4/view?usp=sharing
Input |
Output |
5 1111 1 1000 5 1112 2 100 1 1113 1 500 10 1114 2 99 1 1115 3 100 2
|
1 500 5000 2 100 100 3 100 200 |
Added by: | Ha Minh Ngoc |
Date: | 2021-07-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: GOSU |