Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
After hard work Igor decided to have some rest. He decided to have a snail. He bought an aquarium with a slippery tree trunk in the center, and put a snail named Julia into the aquarium. Igor noticed that sometimes Julia wants to climb onto the trunk, but can't do it because the trunk is too slippery. To help the snail Igor put some ropes on the tree, fixing the lower end of the i -th rope on the trunk on the height l i above the ground, and the higher end on the height r i above the ground. For some reason no two ropes share the same position of the higher end, i.e. all r i are distinct. Now Julia can move down at any place of the trunk, and also move up from the lower end of some rope to its higher end. Igor is proud of his work, and sometimes think about possible movements of the snail. Namely, he is interested in the following questions: «Suppose the snail is on the trunk at height x now. What is the highest position on the trunk the snail can get on if it would never be lower than x or higher than y ?» Please note that Julia can't move from a rope to the trunk before it reaches the higher end of the rope, and Igor is interested in the highest position on the tree trunk . Igor is interested in many questions, and not always can answer them. Help him, write a program that answers these questions. The first line contains single integer n ( 1 ≤ n ≤ 100000 ) — the height of the trunk. The second line contains single integer m ( 1 ≤ m ≤ 100000 ) — the number of ropes. The next m lines contain information about the ropes. The i -th of these lines contains two integers l i and r i ( 1 ≤ l i ≤ r i ≤ n ) — the heights on which the lower and the higher ends of the i -th rope are fixed, respectively. It is guaranteed that all r i are distinct. The next line contains single integer q ( 1 ≤ q ≤ 100000 ) — the number of questions. The next q lines contain information about the questions. Each of these lines contain two integers x and y ( 1 ≤ x ≤ y ≤ n ), where x is |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
34697037 |
Scut82 |
F |
Jan. 30, 2018, 4:15 a.m. |
OK |
GNU C++ |
TESTS |
46 |
46 |
8704000 |
|
2900 |
|
26630490 |
1919810 |
F |
April 23, 2017, 11:41 p.m. |
OK |
GNU C++ |
TESTS |
45 |
109 |
11366400 |
|
2900 |
|
37084926 |
yukuai26 |
F |
April 8, 2018, 1:05 a.m. |
OK |
GNU C++ |
TESTS |
46 |
124 |
81305600 |
|
2900 |
|
27328555 |
AkaneSasu |
F |
May 25, 2017, 3:12 a.m. |
OK |
GNU C++ |
TESTS |
46 |
139 |
10342400 |
|
2900 |
|
37125100 |
yqaqaqy |
F |
April 9, 2018, 3 p.m. |
OK |
GNU C++ |
TESTS |
46 |
140 |
12390400 |
|
2900 |
|
37125179 |
yqaqaqy |
F |
April 9, 2018, 3:04 p.m. |
OK |
GNU C++ |
TESTS |
46 |
155 |
12390400 |
|
2900 |
|
34696869 |
Scut82 |
F |
Jan. 30, 2018, 4:06 a.m. |
OK |
GNU C++ |
TESTS |
46 |
156 |
7680000 |
|
2900 |
|
34509447 |
GXZlegend |
F |
Jan. 24, 2018, 8:28 a.m. |
OK |
GNU C++ |
TESTS |
46 |
171 |
11059200 |
|
2900 |
|
42194492 |
luogu_bot5 |
F |
Aug. 28, 2018, 5:35 a.m. |
OK |
GNU C++ |
TESTS |
46 |
265 |
260915200 |
|
2900 |
|
37085112 |
_SHENZHEBEI_ |
F |
April 8, 2018, 1:28 a.m. |
OK |
GNU C++ |
TESTS |
46 |
280 |
215961600 |
|
2900 |
|
42300888 |
laofudasuan |
F |
Aug. 31, 2018, 7:37 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
11468800 |
|
2900 |
|
40981860 |
ReaLNero1 |
F |
July 30, 2018, 6:10 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
64102400 |
|
2900 |
|
37038073 |
nn020701 |
F |
April 7, 2018, 5:28 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
67686400 |
|
2900 |
|
37040837 |
yasugongshang |
F |
April 7, 2018, 7:02 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
93 |
70758400 |
|
2900 |
|
27320766 |
Manchery |
F |
May 24, 2017, 1:32 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
109 |
8294400 |
|
2900 |
|
30243067 |
RNS |
F |
Sept. 10, 2017, 10:44 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
139 |
5222400 |
|
2900 |
|
27338886 |
Dirak |
F |
May 25, 2017, 2:38 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
139 |
7065600 |
|
2900 |
|
34654900 |
zhouyuyang |
F |
Jan. 29, 2018, 8:07 a.m. |
OK |
GNU C++11 |
TESTS |
46 |
155 |
9113600 |
|
2900 |
|
26632682 |
tqyaaaaaaaang |
F |
April 24, 2017, 3:59 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
155 |
15667200 |
|
2900 |
|
26787462 |
rqgao2014 |
F |
May 1, 2017, 2:45 p.m. |
OK |
GNU C++11 |
TESTS |
46 |
155 |
131993600 |
|
2900 |
|
49362490 |
hychyc |
F |
Feb. 2, 2019, 1:31 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
93 |
8704000 |
|
2900 |
|
49362312 |
hychyc |
F |
Feb. 2, 2019, 1:26 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
108 |
8704000 |
|
2900 |
|
26822249 |
NiroBC |
F |
May 3, 2017, 4:37 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
156 |
9113600 |
|
2900 |
|
34502487 |
CQzhangyu |
F |
Jan. 24, 2018, 3:46 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
171 |
13414400 |
|
2900 |
|
26644147 |
Batman |
F |
April 24, 2017, 3:30 p.m. |
OK |
GNU C++14 |
TESTS |
46 |
187 |
9625600 |
|
2900 |
|
26623674 |
Hidden_Glance |
F |
April 23, 2017, 6:36 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
187 |
9625600 |
|
2900 |
|
26697471 |
la1la1la |
F |
April 27, 2017, 7:09 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
187 |
9830400 |
|
2900 |
|
26893242 |
chemthan |
F |
May 6, 2017, 5:07 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
202 |
10342400 |
|
2900 |
|
43717621 |
ZigZagK |
F |
Oct. 3, 2018, 8:12 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
202 |
10444800 |
|
2900 |
|
26696138 |
lys1280023 |
F |
April 27, 2017, 5:01 a.m. |
OK |
GNU C++14 |
TESTS |
46 |
202 |
12288000 |
|
2900 |
|
38587340 |
ddpag |
F |
May 24, 2018, 1:04 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
171 |
8396800 |
|
2900 |
|
42261213 |
Benq |
F |
Aug. 30, 2018, 3:22 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
202 |
7782400 |
|
2900 |
|
62395965 |
AM. |
F |
Oct. 12, 2019, 5:28 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
202 |
9318400 |
|
2900 |
|
52734503 |
Shayan.P |
F |
April 14, 2019, 5:52 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
217 |
9216000 |
|
2900 |
|
50070455 |
Jester |
F |
Feb. 17, 2019, 5:24 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
218 |
9318400 |
|
2900 |
|
56125264 |
Shayan.Kashefi_A |
F |
June 26, 2019, 4:55 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
234 |
9318400 |
|
2900 |
|
37085097 |
q234rty |
F |
April 8, 2018, 1:26 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
249 |
70553600 |
|
2900 |
|
56165999 |
AliHeidary1381 |
F |
June 27, 2019, 2:19 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
514 |
7270400 |
|
2900 |
|
62350579 |
AliShahali1382 |
F |
Oct. 11, 2019, 9:10 a.m. |
OK |
GNU C++17 |
TESTS |
46 |
732 |
10956800 |
|
2900 |
|
65999906 |
Martin53 |
F |
Nov. 29, 2019, 6:44 p.m. |
OK |
GNU C++17 |
TESTS |
46 |
733 |
132096000 |
|
2900 |
|
26867592 |
mmaxio |
F |
May 4, 2017, 8:46 p.m. |
OK |
Java 8 |
TESTS |
46 |
296 |
6451200 |
|
2900 |
|
26709447 |
uwi |
F |
April 27, 2017, 8:41 p.m. |
OK |
Java 8 |
TESTS |
46 |
467 |
41779200 |
|
2900 |
|
26624120 |
qwerty787788 |
F |
April 23, 2017, 6:39 p.m. |
OK |
Java 8 |
TESTS |
45 |
795 |
28467200 |
|
2900 |
|
26671072 |
JShinjuro |
F |
April 25, 2017, 9:26 p.m. |
OK |
Java 8 |
TESTS |
46 |
1278 |
28467200 |
|
2900 |
|
44166584 |
vjudge3 |
F |
Oct. 12, 2018, 2:09 a.m. |
OK |
MS C++ |
TESTS |
46 |
1216 |
525209600 |
|
2900 |
remove filters
Back to search problems