Logo
(追記) (追記ここまで)

10641번 - The J-th Number

시간 제한메모리 제한제출정답맞힌 사람정답 비율
10 초 512 MB111822812413.808%

문제

You are given N empty arrays, t1,…,tn. At first, you execute M queries as follows.

  • add a value v to array ti (a ≤ i ≤ b)

Next, you process Q following output queries.

  • output the j-th number of the sequence sorted all values in ti (x ≤ i ≤ y)

입력

The dataset is formatted as follows.

N M Q
a1 b1 v1
...
aM bM vM
x1 y1 j1
...
xQ yQ jQ

The first line contains three integers N (1 ≤ N ≤ 109), M (1 ≤ M ≤ 105) and Q (1 ≤ Q ≤ 105). Each of the following M lines consists of three integers ai, bi and vi (1 ≤ ai ≤ bi ≤ N, 1 ≤ vi ≤ 109). Finally the following Q lines give the list of output queries, each of these lines consists of three integers xi, yi and ji (1 ≤ xi ≤ yi ≤ N,1≤ ji ≤ Σxi≤k≤yi|tk|).

출력

For each output query, print in a line the j-th number.

제한

예제 입력 1

5 4 1
1 5 1
1 1 3
4 5 1
3 4 2
1 3 4

예제 출력 1

2

예제 입력 2

10 4 4
1 4 11
2 3 22
6 9 33
8 9 44
1 1 1
4 5 1
4 6 2
1 10 12

예제 출력 2

11
11
33
44

힌트

After the M-th query is executed, each ti is as follows:

[1,3], [1], [1,2], [1,1,2], [1,1]

The sequence sorted values in t1, t2 and t3 is [1,1,1,2,3]. In the sequence, the 4-th number is 2.

출처

Contest > ICPC Japanese Alumni Group > JAG Spring Contest > JAG Spring Contest 2013 I번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /