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"Qpwoeirut has taken up architecture and ambitiously decided to remodel his city. Qpwoeirut's city can be described as a row of n buildings, the i -th ( 1 <= i <= n ) of which is h_i floors high. You can assume that the height of every floor in this problem is equal. Therefore, building i is taller than the building j if and only if the number of floors h_i in building i is larger than the number of floors h_j in building j . Building i is cool if it is taller than both building i-1 and building i+1 (and both of them exist). Note that neither the 1 -st nor the n -th building can be cool. To remodel the city, Qpwoeirut needs to maximize the number of cool buildings. To do this, Qpwoeirut can build additional floors on top of any of the buildings to make them taller. Note that he cannot remove already existing floors. Since building new floors is expensive, Qpwoeirut wants to minimize the number of floors he builds. Find the minimum number of floors Qpwoeirut needs to build in order to maximize the number of cool buildings. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains the single integer n ( 3 <= n <= 10^5 ) -- the number of buildings in Qpwoeirut's city. The second line of each test case contains n integers h_1, h_2, ldots, h_n ( 1 <= h_i <= 10^9 ) -- the number of floors in each of the buildings of the city. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single integer -- the minimum number of additional floors Qpwoeirut needs to build in order to maximize the number of cool buildings. In the first test case, it is optimal for Qpwoeirut to make the second building cool by building 2 additional floors on top of it, making it taller than both of its adjacen"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
164806657 |
mban259 |
C |
July 18, 2022, 6:35 p.m. |
OK |
C# 10 |
TESTS |
12 |
77 |
20172800 |
|
|
164835572 |
xiao_ai |
C |
July 19, 2022, 2:21 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
12 |
966 |
6041600 |
|
|
164835040 |
xiao_ai |
C |
July 19, 2022, 2:14 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
12 |
997 |
6041600 |
|
|
164802593 |
cheese-cracker |
C |
July 18, 2022, 5:58 p.m. |
OK |
D |
TESTS |
12 |
93 |
23961600 |
|
|
164821024 |
zzlzzlzzl |
C |
July 18, 2022, 9:38 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
15 |
2662400 |
|
|
164828584 |
zhuimengsuiyuan |
C |
July 19, 2022, 12:37 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
819200 |
|
|
164841119 |
magiccat |
C |
July 19, 2022, 3:31 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
2048000 |
|
|
164839586 |
Jack00 |
C |
July 19, 2022, 3:12 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
2048000 |
|
|
164836730 |
peterpi23 |
C |
July 19, 2022, 2:35 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
2048000 |
|
|
164816219 |
Naman_Agarwal_03 |
C |
July 18, 2022, 8:22 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
2150400 |
|
|
164801666 |
xXProKodarXx |
C |
July 18, 2022, 5:50 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
2560000 |
|
|
164803826 |
T--o_o--T |
C |
July 18, 2022, 6:09 p.m. |
OK |
GNU C++14 |
TESTS |
12 |
46 |
4198400 |
|
|
164851051 |
Essa2006 |
C |
July 19, 2022, 5:54 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
61 |
409600 |
|
|
164846993 |
anishjain2812 |
C |
July 19, 2022, 5 a.m. |
OK |
GNU C++14 |
TESTS |
12 |
61 |
2355200 |
|
|
164849704 |
sidharthkumar2k19 |
C |
July 19, 2022, 5:37 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
409600 |
|
|
164836078 |
rajan_r21 |
C |
July 19, 2022, 2:27 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
1228800 |
|
|
164790594 |
hupeiyuan |
C |
July 18, 2022, 4:28 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
2355200 |
|
|
164788051 |
MXR612 |
C |
July 18, 2022, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
2355200 |
|
|
164823722 |
dnk1234567 |
C |
July 18, 2022, 10:33 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
3174400 |
|
|
164798550 |
BUD-CJJ |
C |
July 18, 2022, 5:29 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
6041600 |
|
|
164797349 |
BUD-CJJ |
C |
July 18, 2022, 5:25 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
46 |
8396800 |
|
|
164839766 |
AYAHfitness. |
C |
July 19, 2022, 3:13 a.m. |
OK |
GNU C++17 |
TESTS |
12 |
61 |
409600 |
|
|
164792882 |
johnny8337 |
C |
July 18, 2022, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
61 |
409600 |
|
|
164790317 |
MrStark14 |
C |
July 18, 2022, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
12 |
61 |
819200 |
|
|
164806379 |
tonkitude |
C |
July 18, 2022, 6:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164829925 |
DjTang |
C |
July 19, 2022, 1:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
31 |
2457600 |
|
|
164793591 |
Tang132520 |
C |
July 18, 2022, 4:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
31 |
2457600 |
|
|
164801464 |
shivansh_jaiswal |
C |
July 18, 2022, 5:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
31 |
3993600 |
|
|
164838769 |
RetsaZC19 |
C |
July 19, 2022, 3:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
409600 |
|
|
164823416 |
Franchesco_virgoliniiii |
C |
July 18, 2022, 10:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
409600 |
|
|
164846239 |
errorgorn |
C |
July 19, 2022, 4:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
819200 |
|
|
164845009 |
startrek4 |
C |
July 19, 2022, 4:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
819200 |
|
|
164802171 |
noob-_- |
C |
July 18, 2022, 5:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
819200 |
|
|
164798817 |
BucketPotato |
C |
July 18, 2022, 5:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
12 |
46 |
819200 |
|
|
164847637 |
s_jaskaran_s |
C |
July 19, 2022, 5:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
409600 |
|
|
164835333 |
ftiasch |
C |
July 19, 2022, 2:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
409600 |
|
|
164823916 |
de_santa |
C |
July 18, 2022, 10:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
409600 |
|
|
164848579 |
WillSee |
C |
July 19, 2022, 5:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164845326 |
ankithello20 |
C |
July 19, 2022, 4:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164844537 |
OnionEgg |
C |
July 19, 2022, 4:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164834292 |
catch22 |
C |
July 19, 2022, 2:04 a.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164809317 |
KWAMP |
C |
July 18, 2022, 7:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164805953 |
sumitvivek_001 |
C |
July 18, 2022, 6:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164803307 |
bzdhxs |
C |
July 18, 2022, 6:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
12 |
31 |
819200 |
|
|
164788088 |
protogrammer |
C |
July 18, 2022, 4:22 p.m. |
OK |
Go |
TESTS |
12 |
62 |
17305600 |
|
|
164849454 |
manchik |
C |
July 19, 2022, 5:34 a.m. |
OK |
Go |
TESTS |
12 |
155 |
4608000 |
|
|
164793784 |
O_Vladimir |
C |
July 18, 2022, 4:34 p.m. |
OK |
Go |
TESTS |
12 |
156 |
4608000 |
|
|
164820042 |
shiro |
C |
July 18, 2022, 9:20 p.m. |
OK |
Go |
TESTS |
12 |
156 |
4915200 |
|
|
164824616 |
glebsamsonov |
C |
July 18, 2022, 10:54 p.m. |
OK |
Go |
TESTS |
12 |
171 |
4505600 |
|
|
164787881 |
mirai.hanabi.dev |
C |
July 18, 2022, 4:21 p.m. |
OK |
Go |
TESTS |
12 |
202 |
10240000 |
|
|
164799917 |
koqo |
C |
July 18, 2022, 5:37 p.m. |
OK |
Go |
TESTS |
12 |
248 |
4608000 |
|
|
164848711 |
demon200slayer |
C |
July 19, 2022, 5:24 a.m. |
OK |
Java 11 |
TESTS |
12 |
171 |
0 |
|
|
164848585 |
KarMa_ |
C |
July 19, 2022, 5:22 a.m. |
OK |
Java 11 |
TESTS |
12 |
171 |
0 |
|
|
164850428 |
Heni_2021 |
C |
July 19, 2022, 5:46 a.m. |
OK |
Java 11 |
TESTS |
12 |
218 |
0 |
|
|
164840282 |
KarMa_ |
C |
July 19, 2022, 3:20 a.m. |
OK |
Java 11 |
TESTS |
12 |
218 |
0 |
|
|
164806448 |
IanISam |
C |
July 18, 2022, 6:33 p.m. |
OK |
Java 11 |
TESTS |
12 |
218 |
0 |
|
|
164813684 |
singhshivsm20001 |
C |
July 18, 2022, 7:52 p.m. |
OK |
Java 11 |
TESTS |
12 |
233 |
0 |
|
|
164799145 |
tushar19280 |
C |
July 18, 2022, 5:32 p.m. |
OK |
Java 11 |
TESTS |
12 |
233 |
0 |
|
|
164798719 |
SAMAD_ |
C |
July 18, 2022, 5:30 p.m. |
OK |
Java 11 |
TESTS |
12 |
233 |
6041600 |
|
|
164833708 |
aditya2024 |
C |
July 19, 2022, 1:56 a.m. |
OK |
Java 11 |
TESTS |
12 |
234 |
0 |
|
|
164810899 |
Hsharma |
C |
July 18, 2022, 7:22 p.m. |
OK |
Java 11 |
TESTS |
12 |
249 |
76697600 |
|
|
164832181 |
pili |
C |
July 19, 2022, 1:36 a.m. |
OK |
Java 17 |
TESTS |
12 |
202 |
9113600 |
|
|
164812914 |
imvivekthakur |
C |
July 18, 2022, 7:43 p.m. |
OK |
Java 17 |
TESTS |
12 |
264 |
716800 |
|
|
164792355 |
MarkMKM |
C |
July 18, 2022, 4:31 p.m. |
OK |
Java 17 |
TESTS |
12 |
280 |
409600 |
|
|
164811071 |
Eslam_Ahmed |
C |
July 18, 2022, 7:24 p.m. |
OK |
Java 17 |
TESTS |
12 |
311 |
19763200 |
|
|
164806548 |
Dukkha |
C |
July 18, 2022, 6:34 p.m. |
OK |
Java 17 |
TESTS |
12 |
498 |
819200 |
|
|
164792957 |
Ghost_Fox_Sledgehammer |
C |
July 18, 2022, 4:32 p.m. |
OK |
Java 8 |
TESTS |
12 |
93 |
0 |
|
|
164806339 |
Mohamed308 |
C |
July 18, 2022, 6:32 p.m. |
OK |
Java 8 |
TESTS |
12 |
139 |
6451200 |
|
|
164823640 |
Sussykin |
C |
July 18, 2022, 10:31 p.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
|
164804427 |
Mohamed308 |
C |
July 18, 2022, 6:14 p.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
|
164804011 |
BhargavModha |
C |
July 18, 2022, 6:10 p.m. |
OK |
Java 8 |
TESTS |
12 |
140 |
0 |
|
|
164810107 |
Mohamed_A7med |
C |
July 18, 2022, 7:13 p.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
0 |
|
|
164799168 |
amit_roy |
C |
July 18, 2022, 5:32 p.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
2457600 |
|
|
164849864 |
kishan963 |
C |
July 19, 2022, 5:39 a.m. |
OK |
Java 8 |
TESTS |
12 |
155 |
15564800 |
|
|
164801264 |
Mohamed_A7med |
C |
July 18, 2022, 5:47 p.m. |
OK |
Java 8 |
TESTS |
12 |
156 |
6860800 |
|
|
164812161 |
AFouad204 |
C |
July 18, 2022, 7:35 p.m. |
OK |
Java 8 |
TESTS |
12 |
171 |
0 |
|
|
164838456 |
daozhang |
C |
July 19, 2022, 2:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
202 |
1638400 |
|
|
164813094 |
Tor_250 |
C |
July 18, 2022, 7:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
218 |
819200 |
|
|
164791683 |
kaikko |
C |
July 18, 2022, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
218 |
1638400 |
|
|
164819152 |
hHap |
C |
July 18, 2022, 9:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
218 |
2457600 |
|
|
164798301 |
KKastaneda |
C |
July 18, 2022, 5:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
233 |
1638400 |
|
|
164799811 |
misaka12435 |
C |
July 18, 2022, 5:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
233 |
2457600 |
|
|
164790769 |
FishAndCat |
C |
July 18, 2022, 4:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
234 |
2457600 |
|
|
164837197 |
M_zhi |
C |
July 19, 2022, 2:41 a.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
312 |
2867200 |
|
|
164832793 |
adfadsfsff |
C |
July 19, 2022, 1:44 a.m. |
OK |
MS C++ 2017 |
TESTS |
12 |
577 |
3174400 |
|
|
164834360 |
XYShaoKang |
C |
July 19, 2022, 2:05 a.m. |
OK |
Node.js |
TESTS |
12 |
186 |
28876800 |
|
|
164826879 |
raushnn |
C |
July 18, 2022, 11:54 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
373 |
19763200 |
|
|
164797325 |
vadlamani19100 |
C |
July 18, 2022, 5:25 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
421 |
17100800 |
|
|
164789931 |
hsh8086 |
C |
July 18, 2022, 4:26 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
498 |
22118400 |
|
|
164800576 |
neel0086 |
C |
July 18, 2022, 5:42 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
670 |
32256000 |
|
|
164791133 |
redheadphone |
C |
July 18, 2022, 4:29 p.m. |
OK |
PyPy 3 |
TESTS |
12 |
811 |
30310400 |
|
|
164838668 |
Turtleeee |
C |
July 19, 2022, 2:59 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
155 |
20172800 |
|
|
164825952 |
wanglijie |
C |
July 18, 2022, 11:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
171 |
20684800 |
|
|
164791358 |
vipul_mehra |
C |
July 18, 2022, 4:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
202 |
18944000 |
|
|
164797939 |
Leocosmos |
C |
July 18, 2022, 5:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
202 |
19968000 |
|
|
164797942 |
biglunchdude |
C |
July 18, 2022, 5:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
202 |
20377600 |
|
|
164829211 |
harshk_52 |
C |
July 19, 2022, 12:49 a.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
202 |
20582400 |
|
|
164807756 |
SophieHatter |
C |
July 18, 2022, 6:47 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
202 |
27852800 |
|
|
164798766 |
SangeetaSingh |
C |
July 18, 2022, 5:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
233 |
24883200 |
|
|
164817547 |
Ayushman_123 |
C |
July 18, 2022, 8:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
233 |
25600000 |
|
|
164803455 |
Rikudo_6 |
C |
July 18, 2022, 6:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
12 |
249 |
31948800 |
|
|
164803004 |
20020meb1331 |
C |
July 18, 2022, 6:02 p.m. |
OK |
Python 3 |
TESTS |
12 |
280 |
9932800 |
|
|
164807686 |
20020meb1331 |
C |
July 18, 2022, 6:46 p.m. |
OK |
Python 3 |
TESTS |
12 |
280 |
10342400 |
|
|
164835263 |
sayedElgholy |
C |
July 19, 2022, 2:17 a.m. |
OK |
Python 3 |
TESTS |
12 |
311 |
9625600 |
|
|
164832265 |
kirillbk |
C |
July 19, 2022, 1:37 a.m. |
OK |
Python 3 |
TESTS |
12 |
326 |
8908800 |
|
|
164803767 |
hes4rn |
C |
July 18, 2022, 6:08 p.m. |
OK |
Python 3 |
TESTS |
12 |
327 |
9932800 |
|
|
164841643 |
AndrescuIII |
C |
July 19, 2022, 3:38 a.m. |
OK |
Python 3 |
TESTS |
12 |
327 |
12288000 |
|
|
164833611 |
yylele |
C |
July 19, 2022, 1:55 a.m. |
OK |
Python 3 |
TESTS |
12 |
327 |
12288000 |
|
|
164803753 |
carlfre |
C |
July 18, 2022, 6:08 p.m. |
OK |
Python 3 |
TESTS |
12 |
327 |
12800000 |
|
|
164793180 |
CODEBREAKER_Reii |
C |
July 18, 2022, 4:33 p.m. |
OK |
Python 3 |
TESTS |
12 |
343 |
12185600 |
|
|
164845657 |
odinluca |
C |
July 19, 2022, 4:39 a.m. |
OK |
Python 3 |
TESTS |
12 |
358 |
11980800 |
|
|
164814092 |
Hyrulia |
C |
July 18, 2022, 7:57 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
31 |
11878400 |
|
|
164790843 |
kena0ki |
C |
July 18, 2022, 4:28 p.m. |
OK |
Rust 2021 |
TESTS |
12 |
62 |
4198400 |
|
|
164787975 |
wow_lifecoach |
C |
July 18, 2022, 4:21 p.m. |
OK |
Scala |
TESTS |
12 |
608 |
1740800 |
|
|
remove filters
Back to search problems