Marks :10
: 3 | : 4
You have been given information regarding K time series data.
A Discrete time series is an array of $$$(time_i,value_i)$$$ .
Let T1 = [ (0,1) , (3,5) , (7,2) ]
Let T2 = [ (2,2) , (3,3) , (6,1) ]
The time series denotes the spike at time $$$time_i$$$ with a magnitude of $$$value_i$$$. 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 $$$N_i$$$ of the $$$ith$$$ time series.
$$$N_i$$$ space separated integers corresponding to $$$time_j$$$ for the $$$ith$$$ time series.
$$$N_i$$$ space separated integers corresponding to $$$value_j$$$ for the $$$ith$$$ time series.
Constraints
$$$ 1 \le \sum N_i \le 10^7 $$$
$$$ 1 \le time_i , value_i \le 10^9 $$$
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 $$$time_i$$$ of the resultant time series.
Third line corresponds to N space separated integers corresponding to the $$$value_i$$$ 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.