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
B'Polycarp is designing a level for a game. The level consists of n segments on the number line, where the i -th segment starts at the point with coordinate l_i and ends at the point with coordinate r_i . The player starts the level at the point with coordinate 0 . In one move, they can move to any point that is within a distance of no more than k . After their i -th move, the player must land within the i -th segment, that is, at a coordinate x such that l_i <= x <= r_i . This means: The level is considered completed if the player reaches the n -th segment, following the rules described above. After some thought, Polycarp realized that it is impossible to complete the level with some values of k . Polycarp does not want the level to be too easy, so he asks you to determine the minimum integer k with which it is possible to complete the level. The first line contains a single integer t ( 1 <= t <= 10^4 ) --the number of test cases. Descriptions of the test cases follow. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) --the number of segments in the level. The following n lines. The i -th line contain two integers l_i and r_i ( 0 <= l_i <= r_i <= 10^9 ) --the boundaries of the i -th segment. Segments may intersect. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer --the minimum value of k with which it is possible to complete the level. In the third example, the player can make the following moves: Note that for the last move, the player could have chosen not to move and still complete the level. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
235993106 |
sh_arman |
D |
Dec. 6, 2023, 4:04 a.m. |
OK |
C# 10 |
TESTS |
12 |
156 |
15052800 |
|
|
235993889 |
Tech44 |
D |
Dec. 6, 2023, 4:17 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
12 |
2011 |
3481600 |
|
|
235993352 |
Tech44 |
D |
Dec. 6, 2023, 4:09 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
12 |
2136 |
3481600 |
|
|
235968684 |
dio_2 |
D |
Dec. 5, 2023, 7:35 p.m. |
OK |
GNU C11 |
TESTS |
11 |
109 |
1638400 |
|
|
235947829 |
1435730 |
D |
Dec. 5, 2023, 4:55 p.m. |
OK |
GNU C11 |
TESTS |
11 |
124 |
1638400 |
|
|
235968748 |
Maoluda_64 |
D |
Dec. 5, 2023, 7:36 p.m. |
OK |
GNU C11 |
TESTS |
11 |
140 |
3174400 |
|
|
235949647 |
Luxinze |
D |
Dec. 5, 2023, 4:58 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
93 |
1638400 |
|
|
235945081 |
huanyizhiyuan |
D |
Dec. 5, 2023, 4:49 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
93 |
2457600 |
|
|
235979266 |
DeeGeeDow |
D |
Dec. 5, 2023, 10:44 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
93 |
3174400 |
|
|
235951713 |
marcus06 |
D |
Dec. 5, 2023, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
108 |
1638400 |
|
|
235946359 |
Gold_Dragon |
D |
Dec. 5, 2023, 4:52 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
109 |
1638400 |
|
|
235947947 |
Misha100896 |
D |
Dec. 5, 2023, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
1638400 |
|
|
235946746 |
akhil.arza |
D |
Dec. 5, 2023, 4:53 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
1638400 |
|
|
235952902 |
stunareeb_09 |
D |
Dec. 5, 2023, 5:12 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
1638400 |
|
|
235962910 |
l_returns |
D |
Dec. 5, 2023, 6:31 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
124 |
1638400 |
|
|
235988701 |
000ywq |
D |
Dec. 6, 2023, 2:49 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
124 |
1638400 |
|
|
235970334 |
__AhmedSamir__ |
D |
Dec. 5, 2023, 7:56 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
93 |
3174400 |
|
|
235949098 |
zhengjie0311 |
D |
Dec. 5, 2023, 4:58 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
109 |
1638400 |
|
|
235994364 |
9-9 |
D |
Dec. 6, 2023, 4:25 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
109 |
1638400 |
|
|
235959246 |
Yashvardhan07 |
D |
Dec. 5, 2023, 5:56 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
109 |
1638400 |
|
|
235989258 |
_37_ |
D |
Dec. 6, 2023, 2:57 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235989093 |
_37_ |
D |
Dec. 6, 2023, 2:54 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235987499 |
4627488 |
D |
Dec. 6, 2023, 2:30 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235997781 |
.qiti |
D |
Dec. 6, 2023, 5:13 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235994370 |
Nisikto |
D |
Dec. 6, 2023, 4:25 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235993317 |
junimo |
D |
Dec. 6, 2023, 4:08 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
124 |
1638400 |
|
|
235950271 |
construction |
D |
Dec. 5, 2023, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
31 |
1638400 |
|
|
235981561 |
FlowRays |
D |
Dec. 6, 2023, midnight |
OK |
GNU C++17 (64) |
TESTS |
12 |
31 |
3686400 |
|
|
235952271 |
New.lothbrok |
D |
Dec. 5, 2023, 5:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
77 |
1638400 |
|
|
235992524 |
remain11 |
D |
Dec. 6, 2023, 3:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
77 |
1638400 |
|
|
235992688 |
rn201 |
D |
Dec. 6, 2023, 3:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
77 |
3174400 |
|
|
235989040 |
xiangji |
D |
Dec. 6, 2023, 2:54 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
77 |
3174400 |
|
|
235950864 |
15H |
D |
Dec. 5, 2023, 5:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
77 |
3174400 |
|
|
235955409 |
hchchc |
D |
Dec. 5, 2023, 5:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
77 |
4812800 |
|
|
235944475 |
yueyuey |
D |
Dec. 5, 2023, 4:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
77 |
16076800 |
|
|
235992488 |
5720227842 |
D |
Dec. 6, 2023, 3:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
77 |
16076800 |
|
|
235987464 |
cmk666 |
D |
Dec. 6, 2023, 2:29 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
2150400 |
|
|
235982168 |
emo_male_god |
D |
Dec. 6, 2023, 12:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
2560000 |
|
|
235975605 |
KenZu |
D |
Dec. 5, 2023, 9:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
61 |
1638400 |
|
|
235965369 |
Yugen_ |
D |
Dec. 5, 2023, 6:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
61 |
3174400 |
|
|
235987647 |
UraykevoliQwQ |
D |
Dec. 6, 2023, 2:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
61 |
4198400 |
|
|
235952143 |
tranxuantruong |
D |
Dec. 5, 2023, 5:08 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
61 |
6451200 |
|
|
235974211 |
Rising-coder |
D |
Dec. 5, 2023, 8:50 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
61 |
16076800 |
|
|
236000971 |
K-423 |
D |
Dec. 6, 2023, 5:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
62 |
1638400 |
|
|
236000799 |
xorzj |
D |
Dec. 6, 2023, 5:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
62 |
1638400 |
|
|
236001070 |
Dorayakiee_Fan |
D |
Dec. 6, 2023, 5:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
62 |
1638400 |
|
|
235998035 |
123_wby |
D |
Dec. 6, 2023, 5:17 a.m. |
OK |
Go |
TESTS |
12 |
202 |
7884800 |
|
|
235984875 |
drdilyor |
D |
Dec. 6, 2023, 1:35 a.m. |
OK |
Haskell |
TESTS |
12 |
296 |
71475200 |
|
|
235948043 |
shivam29702 |
D |
Dec. 5, 2023, 4:55 p.m. |
OK |
Java 11 |
TESTS |
11 |
389 |
27340800 |
|
|
235978638 |
Yousef_Badr |
D |
Dec. 5, 2023, 10:25 p.m. |
OK |
Java 11 |
TESTS |
12 |
436 |
4915200 |
|
|
235978629 |
faresbadr316 |
D |
Dec. 5, 2023, 10:24 p.m. |
OK |
Java 11 |
TESTS |
12 |
436 |
4915200 |
|
|
235958930 |
druti6 |
D |
Dec. 5, 2023, 5:54 p.m. |
OK |
Java 11 |
TESTS |
11 |
795 |
0 |
|
|
235944675 |
sayaknandy |
D |
Dec. 5, 2023, 4:48 p.m. |
OK |
Java 11 |
TESTS |
11 |
935 |
3584000 |
|
|
235945447 |
tiger3768 |
D |
Dec. 5, 2023, 4:50 p.m. |
OK |
Java 17 |
TESTS |
11 |
343 |
3788800 |
|
|
235983676 |
mapleKing |
D |
Dec. 6, 2023, 1:05 a.m. |
OK |
Java 17 |
TESTS |
12 |
358 |
409600 |
|
|
235973411 |
Jagnath_Reddy |
D |
Dec. 5, 2023, 8:38 p.m. |
OK |
Java 17 |
TESTS |
12 |
358 |
409600 |
|
|
235985535 |
dilshar23 |
D |
Dec. 6, 2023, 1:50 a.m. |
OK |
Java 17 |
TESTS |
12 |
358 |
5017600 |
|
|
235954503 |
nazzy_ |
D |
Dec. 5, 2023, 5:21 p.m. |
OK |
Java 17 |
TESTS |
11 |
389 |
614400 |
|
|
235991927 |
XIN |
D |
Dec. 6, 2023, 3:42 a.m. |
OK |
Java 17 |
TESTS |
12 |
857 |
819200 |
|
|
235992411 |
AyushVardhan |
D |
Dec. 6, 2023, 3:51 a.m. |
OK |
Java 17 |
TESTS |
12 |
857 |
7782400 |
|
|
235949467 |
shingua77 |
D |
Dec. 5, 2023, 4:58 p.m. |
OK |
Java 17 |
TESTS |
11 |
872 |
8089600 |
|
|
235954576 |
saiAbhinav2003 |
D |
Dec. 5, 2023, 5:21 p.m. |
OK |
Java 17 |
TESTS |
11 |
873 |
614400 |
|
|
235948616 |
QianCCC |
D |
Dec. 5, 2023, 4:57 p.m. |
OK |
Java 17 |
TESTS |
11 |
888 |
512000 |
|
|
235949651 |
Samyajit125 |
D |
Dec. 5, 2023, 4:58 p.m. |
OK |
Java 21 |
TESTS |
11 |
436 |
4300800 |
|
|
235961617 |
java_noob69 |
D |
Dec. 5, 2023, 6:18 p.m. |
OK |
Java 21 |
TESTS |
11 |
467 |
37785600 |
|
|
235947195 |
Akash_Sardar |
D |
Dec. 5, 2023, 4:54 p.m. |
OK |
Java 21 |
TESTS |
11 |
529 |
10342400 |
|
|
235997108 |
cnzh |
D |
Dec. 6, 2023, 5:05 a.m. |
OK |
Java 21 |
TESTS |
12 |
967 |
716800 |
|
|
235954430 |
MintCat |
D |
Dec. 5, 2023, 5:20 p.m. |
OK |
Java 8 |
TESTS |
11 |
187 |
0 |
|
|
235953913 |
priyaroy3370 |
D |
Dec. 5, 2023, 5:17 p.m. |
OK |
Java 8 |
TESTS |
11 |
187 |
0 |
|
|
235945392 |
igor_kz |
D |
Dec. 5, 2023, 4:49 p.m. |
OK |
Java 8 |
TESTS |
11 |
187 |
0 |
|
|
235966291 |
Sumitsingh7 |
D |
Dec. 5, 2023, 7:07 p.m. |
OK |
Java 8 |
TESTS |
11 |
202 |
5939200 |
|
|
235948609 |
PassedPawn |
D |
Dec. 5, 2023, 4:57 p.m. |
OK |
Java 8 |
TESTS |
11 |
218 |
0 |
|
|
235991219 |
arpita010 |
D |
Dec. 6, 2023, 3:29 a.m. |
OK |
Java 8 |
TESTS |
12 |
248 |
0 |
|
|
235998788 |
1091857051 |
D |
Dec. 6, 2023, 5:27 a.m. |
OK |
Java 8 |
TESTS |
12 |
264 |
0 |
|
|
236000461 |
Nanthakumar06 |
D |
Dec. 6, 2023, 5:49 a.m. |
OK |
Java 8 |
TESTS |
12 |
265 |
1638400 |
|
|
235989848 |
ashraybharambe |
D |
Dec. 6, 2023, 3:06 a.m. |
OK |
Java 8 |
TESTS |
12 |
717 |
0 |
|
|
235965787 |
_a253 |
D |
Dec. 5, 2023, 7:01 p.m. |
OK |
Kotlin 1.7 |
TESTS |
11 |
733 |
87756800 |
|
|
235945622 |
Sardor_08 |
D |
Dec. 5, 2023, 4:50 p.m. |
OK |
Kotlin 1.7 |
TESTS |
11 |
1185 |
189132800 |
|
|
235947407 |
poojachinta |
D |
Dec. 5, 2023, 4:54 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
420 |
1638400 |
|
|
235989167 |
WXL. |
D |
Dec. 6, 2023, 2:54 a.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
421 |
3276800 |
|
|
235992930 |
mr_dramm |
D |
Dec. 6, 2023, 4:01 a.m. |
OK |
Node.js |
TESTS |
12 |
733 |
55398400 |
|
|
235957941 |
Mashul |
D |
Dec. 5, 2023, 5:46 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
1949 |
12697600 |
|
|
235947108 |
Jimmily |
D |
Dec. 5, 2023, 4:53 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
1996 |
20480000 |
|
|
235956776 |
baozhiyuan |
D |
Dec. 5, 2023, 5:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
264 |
16179200 |
|
|
235953147 |
iN_siDious |
D |
Dec. 5, 2023, 5:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
264 |
16691200 |
|
|
235972857 |
gardengnome |
D |
Dec. 5, 2023, 8:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
280 |
22732800 |
|
|
235945925 |
linhua |
D |
Dec. 5, 2023, 4:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
280 |
150118400 |
|
|
235954968 |
bjy |
D |
Dec. 5, 2023, 5:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
296 |
21401600 |
|
|
235945336 |
rope_and_snake |
D |
Dec. 5, 2023, 4:49 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
296 |
22732800 |
|
|
235990758 |
Drunkula |
D |
Dec. 6, 2023, 3:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
311 |
26931200 |
|
|
235962456 |
DP_FORMULA |
D |
Dec. 5, 2023, 6:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
311 |
31334400 |
|
|
235952473 |
peb |
D |
Dec. 5, 2023, 5:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
327 |
31027200 |
|
|
235947541 |
cholebhature |
D |
Dec. 5, 2023, 4:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
327 |
31539200 |
|
|
235944025 |
TheAbysswalker |
D |
Dec. 5, 2023, 4:46 p.m. |
OK |
Python 3 |
TESTS |
11 |
2074 |
28364800 |
|
|
235954770 |
dewansh461 |
D |
Dec. 5, 2023, 5:23 p.m. |
OK |
Python 3 |
TESTS |
11 |
2667 |
31232000 |
|
|
235987269 |
abdulmoomin007 |
D |
Dec. 6, 2023, 2:25 a.m. |
OK |
Python 3 |
TESTS |
12 |
2713 |
16179200 |
|
|
235963849 |
monkey_d_viper |
D |
Dec. 5, 2023, 6:40 p.m. |
OK |
Python 3 |
TESTS |
11 |
3057 |
31846400 |
|
|
235945427 |
thr_Bro |
D |
Dec. 5, 2023, 4:49 p.m. |
OK |
Python 3 |
TESTS |
11 |
3119 |
28467200 |
|
|
235953646 |
aureliony |
D |
Dec. 5, 2023, 5:15 p.m. |
OK |
Python 3 |
TESTS |
11 |
3462 |
45158400 |
|
|
236000379 |
psj_nju |
D |
Dec. 6, 2023, 5:48 a.m. |
OK |
Python 3 |
TESTS |
12 |
3681 |
28467200 |
|
|
235947375 |
tan36 |
D |
Dec. 5, 2023, 4:54 p.m. |
OK |
Python 3 |
TESTS |
11 |
3758 |
31232000 |
|
|
235946356 |
tan36 |
D |
Dec. 5, 2023, 4:52 p.m. |
OK |
Python 3 |
TESTS |
11 |
3868 |
31232000 |
|
|
235949880 |
samyaksrivastava9 |
D |
Dec. 5, 2023, 4:59 p.m. |
OK |
Python 3 |
TESTS |
11 |
3993 |
37888000 |
|
|
235983400 |
0x81 |
D |
Dec. 6, 2023, 12:58 a.m. |
OK |
Ruby 3 |
TESTS |
12 |
1482 |
7884800 |
|
|
235980608 |
0x81 |
D |
Dec. 5, 2023, 11:28 p.m. |
OK |
Ruby 3 |
TESTS |
12 |
2792 |
32256000 |
|
|
235980210 |
matheusdacach |
D |
Dec. 5, 2023, 11:15 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
46 |
7372800 |
|
|
235962669 |
Rajveer_100 |
D |
Dec. 5, 2023, 6:28 p.m. |
OK |
Rust 2021 |
TESTS |
11 |
77 |
1638400 |
|
|
235952725 |
points_engineering |
D |
Dec. 5, 2023, 5:11 p.m. |
OK |
Rust 2021 |
TESTS |
11 |
109 |
3174400 |
|
|
235960077 |
vstiff |
D |
Dec. 5, 2023, 6:04 p.m. |
OK |
Rust 2021 |
TESTS |
11 |
124 |
7372800 |
|
|
remove filters
Back to search problems