Submit | All submissions | Best solutions | Back to list |
EIUTOPSALES - The highest sales by day |
You are given a list of transactions, each of them includes date, product code, quantity and selling price.
Your task is to write a program to print the products with the highest revenue day from minimum date to maximum date (Note: print all days from minimum date to maximum date).
If there is more than one product with the same highest revenue, print them too. For any date that has no transaction, print date, product code as 0 and selling price as 0.
Input
- The first line contains one integer N - the number of transactions (1 ≤ N ≤ 105).
- Each line in the next N lines contains 4 integers representing a transaction. All of these do not exceed 109, the difference between the maximum date and the minimum date is not more than 105.
- Dates are in ascending order.
Output
For each row, output the date, product code and its revenue. Dates are listed in ascending order; product codes are listed in ascending order.
Sample
Input |
Output |
8 10 1 20 200 10 2 10 150 12 3 18 100 14 2 20 180 14 4 30 80 14 3 40 90 16 4 15 90 16 1 10 180
|
10 1 4000 11 0 0 12 3 1800 13 0 0 14 2 3600 14 3 3600 15 0 0 16 1 1800 |
Added by: | Ha Minh Ngoc |
Date: | 2023-06-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET |