Marks :10
: 3 | : 4
You have been given information regarding K time series data.
A Discrete time series is an array of (timei,valuei) .
Let T1 = [ (0,1) , (3,5) , (7,2) ]
Let T2 = [ (2,2) , (3,3) , (6,1) ]
The time series denotes the spike at time timei with a magnitude of valuei. The magnitude remains same until a new spike occurs with an updated magnitude.
For T1 , value = 1 for [0,3) , 5 for [3,7) , 2 for [7,inf)
for T2 , value = 2 for [0,2) , 3 for [3,6) , 1 for [6,inf)
Adding T1 and T2 results in a new time series = [ (0,1) , (2,3) , (3,8) , (6,6) , (7,3) ]
Given K such time series, Print the resultant time series after adding all K time series.
First line contains one integer K corresponding to the number of time series data.
K Lines follow in similar manner as below :-
A single line containing the size Ni of the ith time series.
Ni space separated integers corresponding to timej for the ith time series.
Ni space separated integers corresponding to valuej for the ith time series.
Constraints
1≤∑Ni≤107
1≤timei,valuei≤109
First line corresponds to single integer N corresponding to the size of resultant time series.
Second line corresponds to N space separated integers corresponding to the timei of the resultant time series.
Third line corresponds to N space separated integers corresponding to the valuei of the resultant time series.
2 3 0 3 7 1 5 2 3 2 3 6 2 3 1
5 0 2 3 6 7 1 3 8 6 3
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.