knightnemo commited on
Commit
1c0c2ac
·
verified ·
1 Parent(s): 4b347ef

Upload code_segments/segment_5.txt with huggingface_hub

Browse files
Files changed (1) hide show
  1. code_segments/segment_5.txt +27 -0
code_segments/segment_5.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Timur is in a car traveling on the number line from point $0$ to point $n$. The car starts moving from point $0$ at minute $0$.
2
+
3
+ There are $k+1$ signs on the line at points $0, a_1, a_2, \dots, a_k$, and Timur knows that the car will arrive there at minutes $0, b_1, b_2, \dots, b_k$, respectively. The sequences $a$ and $b$ are strictly increasing with $a_k = n$.
4
+
5
+ ![](CDN_BASE_URL/bacc58f5d5013f5922e96a1311487b97)
6
+
7
+ Between any two adjacent signs, the car travels with a constant speed. Timur has $q$ queries: each query will be an integer $d$, and Timur wants you to output how many minutes it takes the car to reach point $d$, rounded down to the nearest integer.
8
+
9
+ The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases.
10
+
11
+ The first line of each test case contains three integers $n$, $k$, and $q$, ($k \leq n \leq 10^9$; $1 \leq k, q \leq 10^5$) — the final destination, the number of points Timur knows the time for, and the number of queries respectively.
12
+
13
+ The second line of each test case contains $k$ integers $a_i$ ($1 \leq a_i \leq n$; $a_i < a_{i+1}$ for every $1 \leq i \leq k-1$; $a_k = n$).
14
+
15
+ The third line of each test case contains $k$ integers $b_i$ ($1 \leq b_i \leq 10^9$; $b_i < b_{i+1}$ for every $1 \leq i \leq k-1$).
16
+
17
+ Each of the following $q$ lines contains a single integer $d$ ($0 \leq d \leq n$) — the distance that Timur asks the minutes passed for.
18
+
19
+ The sum of $k$ over all test cases doesn't exceed $10^5$, and the sum of $q$ over all test cases doesn't exceed $10^5$.
20
+
21
+ For each query, output a single integer — the number of minutes passed until the car reaches the point $d$, rounded down.
22
+
23
+ For the first test case, the car goes from point $0$ to point $10$ in $10$ minutes, so the speed is $1$ unit per minute and:
24
+
25
+ * At point $0$, the time will be $0$ minutes. * At point $6$, the time will be $6$ minutes. * At point $7$, the time will be $7$ minutes.
26
+
27
+ For the second test case, between points $0$ and $4$, the car travels at a speed of $1$ unit per minut