#C3277. Maximum Observed Values per Date
Maximum Observed Values per Date
Maximum Observed Values per Date
Given a series of data entries, each consisting of a date in the format YYYY-MM-DD
and an integer value, your task is to compute the maximum observed value for each unique date. The entries should be processed in the order they are received; that is, the output should list dates in the order of their first appearance in the input.
For a given date \(d\), if the values associated with \(d\) are \(v_1, v_2, \dots, v_k\), then you should print the maximum value among these, i.e.,
\(\max_{i=1}^{k} v_i\).
This problem tests your ability to process input data, use appropriate data structures, and produce output in the correct format.
inputFormat
The first line contains a single integer \(n\), representing the number of data entries.
The following \(n\) lines each contain a date and an integer value separated by a space. The date will be in the format YYYY-MM-DD
.
outputFormat
For each unique date (in the order of their first appearance), output a line with the date followed by the maximum integer value observed for that date, separated by a space.
## sample5
2023-01-01 10
2023-01-01 5
2023-01-02 -2
2023-01-02 3
2023-01-02 1
2023-01-01 10
2023-01-02 3
</p>