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"For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and long movements between locations. Max is a young biologist. For n days he watched a specific shark, and now he knows the distance the shark traveled in each of the days. All the distances are distinct. Max wants to know now how many locations the shark visited. He assumed there is such an integer k that if the shark in some day traveled the distance strictly less than k , then it didn't change the location; otherwise, if in one day the shark traveled the distance greater than or equal to k ; then it was changing a location in that day. Note that it is possible that the shark changed a location for several consecutive days, in each of them the shark traveled the distance at least k . The shark never returned to the same location after it has moved from it. Thus, in the sequence of n days we can find consecutive nonempty segments when the shark traveled the distance less than k in each of the days: each such segment corresponds to one location. Max wants to choose such k that the lengths of all such segments are equal. Find such integer k , that the number of locations is as large as possible. If there are several such k , print the smallest one. The first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the number of days. The second line contains n distinct positive integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the distance traveled in each of the day. Print a single integer k , such that In the first example the shark travels inside a location on days 1 and 2 (first location), then on 4 -th and 5 -th days (second location), then on 7 -th and 8 -th days (third location). There are three locations in total. In the second example the shark only moves inside a location on the 2$$"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
38372271 |
fluffyowl |
D |
May 17, 2018, 5:37 p.m. |
OK |
D |
TESTS |
50 |
78 |
11571200 |
|
1900 |
38389733 |
xsc |
D |
May 18, 2018, 5:23 a.m. |
OK |
GNU C++ |
TESTS |
50 |
31 |
1945600 |
|
1900 |
38387157 |
HugeGun |
D |
May 18, 2018, 2:57 a.m. |
OK |
GNU C++ |
TESTS |
50 |
31 |
2662400 |
|
1900 |
38958665 |
L__A |
D |
June 5, 2018, 3:44 a.m. |
OK |
GNU C++ |
TESTS |
50 |
31 |
5734400 |
|
1900 |
38400232 |
Tgotp |
D |
May 18, 2018, 11:55 a.m. |
OK |
GNU C++ |
TESTS |
50 |
31 |
5939200 |
|
1900 |
38485139 |
L2K2 |
D |
May 21, 2018, 1:53 p.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
1740800 |
|
1900 |
38474889 |
psc233 |
D |
May 21, 2018, 5:50 a.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
1945600 |
|
1900 |
38477759 |
lzfff |
D |
May 21, 2018, 8:32 a.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38375799 |
VampireWeekend |
D |
May 17, 2018, 6:05 p.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38591788 |
luogu_bot3 |
D |
May 24, 2018, 4:12 p.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
2150400 |
|
1900 |
38485486 |
zgyw |
D |
May 21, 2018, 2:09 p.m. |
OK |
GNU C++ |
TESTS |
50 |
46 |
2150400 |
|
1900 |
40248239 |
llgyc |
D |
July 13, 2018, 3:32 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
1638400 |
|
1900 |
58419155 |
luogu_bot2 |
D |
Aug. 7, 2019, 6:54 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
2457600 |
|
1900 |
47168947 |
zhou2003 |
D |
Dec. 17, 2018, 1:56 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
2457600 |
|
1900 |
38434884 |
XHRlyb_2001 |
D |
May 19, 2018, 3:08 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
2457600 |
|
1900 |
38373767 |
Doppio |
D |
May 17, 2018, 5:48 p.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
2457600 |
|
1900 |
40402521 |
C76 |
D |
July 16, 2018, 8:16 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
3276800 |
|
1900 |
38394516 |
karin0 |
D |
May 18, 2018, 8:22 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
4812800 |
|
1900 |
43162209 |
luogu_bot4 |
D |
Sept. 21, 2018, 2:16 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
7270400 |
|
1900 |
43099706 |
VincentLx |
D |
Sept. 20, 2018, 4:05 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
31 |
9625600 |
|
1900 |
38645417 |
porgyturtle |
D |
May 27, 2018, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
50 |
46 |
1433600 |
|
1900 |
39237258 |
israttarin |
D |
June 14, 2018, 9:04 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1638400 |
|
1900 |
42298659 |
kiimak |
D |
Aug. 31, 2018, 5:58 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1740800 |
|
1900 |
39729662 |
MovingForward |
D |
June 28, 2018, 12:13 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1740800 |
|
1900 |
38703982 |
pariz0 |
D |
May 28, 2018, 8:29 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1843200 |
|
1900 |
38470128 |
Shaad7 |
D |
May 20, 2018, 9:52 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1843200 |
|
1900 |
38546133 |
mathtrauma |
D |
May 22, 2018, 8:31 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
1945600 |
|
1900 |
38569549 |
MB1151 |
D |
May 23, 2018, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38416475 |
Billyshuai |
D |
May 19, 2018, 4:22 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38389090 |
waynetuinfor |
D |
May 18, 2018, 4:52 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38372991 |
bunoi |
D |
May 17, 2018, 5:42 p.m. |
OK |
GNU C++14 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
46015161 |
InFiNiTeemo |
D |
Nov. 21, 2018, 2:14 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
1843200 |
|
1900 |
40485395 |
TobyCF |
D |
July 17, 2018, 4:20 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
1945600 |
|
1900 |
38553097 |
rzwei |
D |
May 23, 2018, 6:35 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
1945600 |
|
1900 |
38414087 |
whquddn55 |
D |
May 19, 2018, 1:47 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
1945600 |
|
1900 |
54403680 |
ZhihuiLiu |
D |
May 20, 2019, 3:59 a.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
47178743 |
lXTobiXl |
D |
Dec. 17, 2018, 7:06 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2048000 |
|
1900 |
38640380 |
nbsjy |
D |
May 26, 2018, 5:09 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2150400 |
|
1900 |
38373417 |
LesterScratch |
D |
May 17, 2018, 5:45 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2150400 |
|
1900 |
38376358 |
ty1234257 |
D |
May 17, 2018, 6:10 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2355200 |
|
1900 |
65305465 |
vjudge2 |
D |
Nov. 18, 2019, 2:43 p.m. |
OK |
GNU C++17 |
TESTS |
50 |
46 |
2457600 |
|
1900 |
38549993 |
stczhc |
D |
May 23, 2018, 3:09 a.m. |
OK |
Haskell |
TESTS |
50 |
904 |
35942400 |
|
1900 |
38549948 |
stczhc |
D |
May 23, 2018, 3:07 a.m. |
OK |
Haskell |
TESTS |
50 |
904 |
35942400 |
|
1900 |
61315749 |
chojh1222 |
D |
Sept. 26, 2019, 11 a.m. |
OK |
Java 8 |
TESTS |
50 |
140 |
0 |
|
1900 |
38816033 |
Sharon |
D |
June 1, 2018, 1:49 a.m. |
OK |
Java 8 |
TESTS |
50 |
170 |
20582400 |
|
1900 |
39865408 |
aya_cool |
D |
July 2, 2018, 10:50 a.m. |
OK |
Java 8 |
TESTS |
50 |
171 |
0 |
|
1900 |
38686420 |
dipankar12 |
D |
May 28, 2018, 6:47 a.m. |
OK |
Java 8 |
TESTS |
50 |
171 |
0 |
|
1900 |
38875463 |
15ucs145 |
D |
June 2, 2018, 6:14 a.m. |
OK |
Java 8 |
TESTS |
50 |
171 |
21299200 |
|
1900 |
38375775 |
xodiac |
D |
May 17, 2018, 6:05 p.m. |
OK |
Java 8 |
TESTS |
50 |
186 |
0 |
|
1900 |
41306412 |
parth_15 |
D |
Aug. 7, 2018, 1:19 p.m. |
OK |
Java 8 |
TESTS |
50 |
187 |
0 |
|
1900 |
38430924 |
hulk_man |
D |
May 19, 2018, 12:38 p.m. |
OK |
Java 8 |
TESTS |
50 |
202 |
0 |
|
1900 |
38543586 |
Hoda_Hisham |
D |
May 22, 2018, 6 p.m. |
OK |
Java 8 |
TESTS |
50 |
217 |
0 |
|
1900 |
38382720 |
kamranm |
D |
May 17, 2018, 9:02 p.m. |
OK |
Java 8 |
TESTS |
50 |
217 |
0 |
|
1900 |
38455979 |
0442A403 |
D |
May 20, 2018, 10:43 a.m. |
OK |
Kotlin |
TESTS |
50 |
218 |
2252800 |
|
1900 |
38455204 |
0442A403 |
D |
May 20, 2018, 10:14 a.m. |
OK |
Kotlin |
TESTS |
50 |
233 |
2048000 |
|
1900 |
38751412 |
yodhacs |
D |
May 29, 2018, 9:22 p.m. |
OK |
Kotlin |
TESTS |
50 |
280 |
28774400 |
|
1900 |
38405330 |
nixmulta |
D |
May 18, 2018, 4 p.m. |
OK |
Mono C# |
TESTS |
50 |
124 |
91545600 |
|
1900 |
38389685 |
xsc |
D |
May 18, 2018, 5:21 a.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2150400 |
|
1900 |
57966217 |
vjudge4 |
D |
July 30, 2019, 2:54 a.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2457600 |
|
1900 |
56873361 |
vjudge1 |
D |
July 12, 2019, 7:21 a.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2457600 |
|
1900 |
56517317 |
vjudge1 |
D |
July 4, 2019, 1:19 p.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2457600 |
|
1900 |
56518143 |
vjudge2 |
D |
July 4, 2019, 1:42 p.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2662400 |
|
1900 |
38375178 |
kukul |
D |
May 17, 2018, 5:59 p.m. |
OK |
MS C++ |
TESTS |
50 |
46 |
2764800 |
|
1900 |
38389726 |
xsc |
D |
May 18, 2018, 5:23 a.m. |
OK |
MS C++ |
TESTS |
50 |
62 |
2150400 |
|
1900 |
58420620 |
vjudge3 |
D |
Aug. 7, 2019, 7:34 a.m. |
OK |
MS C++ |
TESTS |
50 |
78 |
4505600 |
|
1900 |
38548344 |
olpetOdessaONU |
D |
May 23, 2018, 12:17 a.m. |
OK |
MS C++ |
TESTS |
50 |
109 |
3379200 |
|
1900 |
38377185 |
achudov89 |
D |
May 17, 2018, 6:17 p.m. |
OK |
MS C++ |
TESTS |
50 |
124 |
2150400 |
|
1900 |
38375253 |
pajenegod |
D |
May 17, 2018, 6 p.m. |
OK |
PyPy 2 |
TESTS |
50 |
514 |
23142400 |
|
1900 |
42287915 |
nns2009 |
D |
Aug. 30, 2018, 6:30 p.m. |
OK |
PyPy 3 |
TESTS |
50 |
623 |
13414400 |
|
1900 |
39226851 |
Ali_Pi |
D |
June 13, 2018, 9:02 p.m. |
OK |
Python 2 |
TESTS |
50 |
421 |
25497600 |
|
1900 |
38642240 |
MartiBook |
D |
May 26, 2018, 7:28 p.m. |
OK |
Python 3 |
TESTS |
50 |
529 |
23244800 |
|
1900 |
38654008 |
Savit_Gupta |
D |
May 27, 2018, 11:22 a.m. |
OK |
Python 3 |
TESTS |
50 |
872 |
11264000 |
|
1900 |
38441961 |
Korrah |
D |
May 19, 2018, 8:13 p.m. |
OK |
Python 3 |
TESTS |
50 |
889 |
10956800 |
|
1900 |
58106062 |
NocturneBflat |
D |
Aug. 1, 2019, 4:22 a.m. |
OK |
Python 3 |
TESTS |
50 |
889 |
21094400 |
|
1900 |
38703528 |
Hillmouse |
D |
May 28, 2018, 7:55 p.m. |
OK |
Rust |
TESTS |
50 |
46 |
3174400 |
|
1900 |
remove filters
Back to search problems