need help !!

Revision en2, by ultranoobs, 2019-06-05 14:49:03

we are provided with n different range(l,r) and each range have value (val) associated with it . now we have given k query , in each query we have given one integer X , and we have to tell the minimum value we can obtain form the ranges in which X
lies i.e L<=x<=R , if their does not exist any range print -1 .
Input :
n — number of range .
next n line contain — ( l , r , val )
q — number of query.
next q line contain — (X)
output :
q — line with minimum value.

For Example:

Input:

4
0 0 2
0 2 10
5 6 13
1 1 2
6
0
1
2
3
5
8

Output:

2
2
10
-1
13
-1

Tags binary search, two pointers

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ultranoobs 2019-06-05 14:49:03 149 Tiny change: '<br>0 0 2</br>\n0 2 1' -> '<br>0 0 2<\br>\n0 2 1'
en1 English ultranoobs 2019-06-05 14:44:10 626 Initial revision (published)