AT_abc453_b [ABC453B] Sensor Data Logging
Description
In a certain measurement, the sensor readings at times $ 0,1,\dots,T $ are recorded according to the following rules.
- At time $ 0 $ , the reading is saved.
- At times $ 1,2,\dots,T $ , the reading is saved if and only if the absolute difference between the current reading and the most recently saved reading is at least $ X $ .
The sensor reading at time $ i=0,1,\dots,T $ was $ A_i $ .
Output the times at which readings were saved and the saved values, in ascending order of time.
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ X $ $ A_0 $ $ A_1 $ $ \dots $ $ A_T $
Output Format
If $ k $ readings were saved, and the $ i $ -th saved reading in ascending order of time was at time $ t_i $ with value $ a_i $ , output in the following format:
> $ t_1 $ $ a_1 $ $ t_2 $ $ a_2 $ $ \vdots $ $ t_k $ $ a_k $
Explanation/Hint
### Sample Explanation 1
The measurement proceeds as follows.
- The reading at time $ 0 $ is $ 30 $ . Save it.
- The reading at time $ 1 $ is $ 35 $ . The most recently saved reading is $ 30 $ , and the absolute difference is less than $ 10 $ , so it is not saved.
- The reading at time $ 2 $ is $ 40 $ . The most recently saved reading is $ 30 $ , and the absolute difference is at least $ 10 $ , so it is saved.
- The reading at time $ 3 $ is $ 21 $ . The most recently saved reading is $ 40 $ , and the absolute difference is at least $ 10 $ , so it is saved.
- The reading at time $ 4 $ is $ 30 $ . The most recently saved reading is $ 21 $ , and the absolute difference is less than $ 10 $ , so it is not saved.
- The reading at time $ 5 $ is $ 12 $ . The most recently saved reading is $ 21 $ , and the absolute difference is less than $ 10 $ , so it is not saved.
- The reading at time $ 6 $ is $ 31 $ . The most recently saved reading is $ 21 $ , and the absolute difference is at least $ 10 $ , so it is saved.
### Constraints
- $ 1 \le T \le 100 $
- $ 1 \le X \le 100 $
- $ 0 \le A_i \le 100 $
- All input values are integers.