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"There are n slimes placed in a line. The slimes are numbered from 1 to n in order from left to right. The size of the i -th slime is a_i . Every second, the following happens: exactly one slime eats one of its neighbors and increases its size by the eaten neighbor's size. A slime can eat its neighbor only if it is strictly bigger than this neighbor. If there is no slime which is strictly bigger than one of its neighbors, the process ends. For example, suppose n = 5 , a = [2, 2, 3, 1, 4] . The process can go as follows: For each slime, calculate the minimum number of seconds it takes for this slime to be eaten by another slime (among all possible ways the process can go), or report that it is impossible. 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 a single integer n ( 1 <= n <= 3 cdot 10^5 ) -- the number of slimes. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^9 ). The sum of n over all test cases doesn't exceed 3 cdot 10^5 . For each test case, print n integers. The i -th integer should be equal to the minimum number of seconds it takes for the i -th slime to be eaten by another slime or -1 if it is impossible. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
247978435 |
Gassa |
D |
Feb. 23, 2024, 4:34 p.m. |
OK |
D |
TESTS |
27 |
312 |
29696000 |
|
|
247978128 |
ruban |
D |
Feb. 23, 2024, 4:34 p.m. |
OK |
Delphi |
TESTS |
27 |
467 |
89292800 |
|
|
248014575 |
NenadDapic |
D |
Feb. 23, 2024, 8:35 p.m. |
OK |
FPC |
TESTS |
27 |
935 |
6144000 |
|
|
247992384 |
rainboy |
D |
Feb. 23, 2024, 5:43 p.m. |
OK |
GNU C11 |
TESTS |
27 |
1341 |
5120000 |
|
|
248002038 |
god-knows-who |
D |
Feb. 23, 2024, 6:49 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
13004800 |
|
|
247984940 |
I_love_Anya_Gorodilova |
D |
Feb. 23, 2024, 4:58 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
140 |
6041600 |
|
|
248042771 |
anuj_singh_thakur |
D |
Feb. 24, 2024, 4:43 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
140 |
6041600 |
|
|
248043202 |
thanhdno |
D |
Feb. 24, 2024, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
140 |
7270400 |
|
|
248032604 |
MaxWelll |
D |
Feb. 24, 2024, 1:53 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
140 |
8396800 |
|
|
248033804 |
liujg |
D |
Feb. 24, 2024, 2:19 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
155 |
4812800 |
|
|
247983833 |
coolreshab |
D |
Feb. 23, 2024, 4:54 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
155 |
6041600 |
|
|
248034200 |
xhgua |
D |
Feb. 24, 2024, 2:27 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
155 |
6041600 |
|
|
248007870 |
theoneyoucrave |
D |
Feb. 23, 2024, 7:33 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
155 |
7168000 |
|
|
248038583 |
Actium |
D |
Feb. 24, 2024, 3:43 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
155 |
7168000 |
|
|
248048424 |
daud04 |
D |
Feb. 24, 2024, 5:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
93 |
6041600 |
|
|
247992777 |
UltramanBlazer |
D |
Feb. 23, 2024, 5:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
7577600 |
|
|
248036786 |
Belief_yfly |
D |
Feb. 24, 2024, 3:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
9625600 |
|
|
247980036 |
shiqiaqiaya |
D |
Feb. 23, 2024, 4:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
9625600 |
|
|
248033409 |
Heshu |
D |
Feb. 24, 2024, 2:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
11059200 |
|
|
247986956 |
040328 |
D |
Feb. 23, 2024, 5:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
11980800 |
|
|
248040407 |
Lemon-Tree |
D |
Feb. 24, 2024, 4:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
108 |
11980800 |
|
|
247984443 |
undercat |
D |
Feb. 23, 2024, 4:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
109 |
6041600 |
|
|
248035506 |
hanime1 |
D |
Feb. 24, 2024, 2:54 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
109 |
6041600 |
|
|
247984366 |
PoCk0Wb |
D |
Feb. 23, 2024, 4:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
109 |
7168000 |
|
|
248033744 |
Kidding__Ma |
D |
Feb. 24, 2024, 2:17 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
6041600 |
|
|
248048322 |
tmpdeatheye |
D |
Feb. 24, 2024, 5:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
6041600 |
|
|
247996796 |
Chelovek9 |
D |
Feb. 23, 2024, 6:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
7168000 |
|
|
247982877 |
DuongForeverAlone |
D |
Feb. 23, 2024, 4:50 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
7270400 |
|
|
248000628 |
find |
D |
Feb. 23, 2024, 6:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
7270400 |
|
|
248016215 |
Peti |
D |
Feb. 23, 2024, 8:53 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
8396800 |
|
|
247988363 |
Neco_arc |
D |
Feb. 23, 2024, 5:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
9625600 |
|
|
248020972 |
abdalrahem.r.dado |
D |
Feb. 23, 2024, 9:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
11980800 |
|
|
248016748 |
porcelain |
D |
Feb. 23, 2024, 8:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
12595200 |
|
|
248019991 |
IcarusII |
D |
Feb. 23, 2024, 9:38 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
78 |
16998400 |
|
|
247977976 |
sugar2023 |
D |
Feb. 23, 2024, 4:34 p.m. |
OK |
Go |
TESTS |
27 |
217 |
20480000 |
|
|
248035404 |
priyaroy3370 |
D |
Feb. 24, 2024, 2:52 a.m. |
OK |
Java 21 |
TESTS |
27 |
405 |
9625600 |
|
|
248038481 |
amit_roy |
D |
Feb. 24, 2024, 3:41 a.m. |
OK |
Java 21 |
TESTS |
27 |
405 |
11468800 |
|
|
247993477 |
priyaroy3370 |
D |
Feb. 23, 2024, 5:51 p.m. |
OK |
Java 21 |
TESTS |
27 |
452 |
9830400 |
|
|
248039680 |
Fareedah |
D |
Feb. 24, 2024, 3:59 a.m. |
OK |
Java 21 |
TESTS |
27 |
514 |
5324800 |
|
|
248012006 |
mohit458 |
D |
Feb. 23, 2024, 8:10 p.m. |
OK |
Java 21 |
TESTS |
27 |
514 |
9420800 |
|
|
247981481 |
Utsav82 |
D |
Feb. 23, 2024, 4:44 p.m. |
OK |
Java 21 |
TESTS |
27 |
607 |
74547200 |
|
|
247980949 |
wait_rain_stops |
D |
Feb. 23, 2024, 4:42 p.m. |
OK |
Java 21 |
TESTS |
27 |
624 |
204800 |
|
|
248009609 |
WORTH |
D |
Feb. 23, 2024, 7:48 p.m. |
OK |
Java 21 |
TESTS |
27 |
779 |
64614400 |
|
|
247980325 |
santanu021 |
D |
Feb. 23, 2024, 4:40 p.m. |
OK |
Java 21 |
TESTS |
27 |
966 |
37785600 |
|
|
248032290 |
powervic08 |
D |
Feb. 24, 2024, 1:46 a.m. |
OK |
Java 21 |
TESTS |
27 |
982 |
60108800 |
|
|
247990240 |
MintCat |
D |
Feb. 23, 2024, 5:29 p.m. |
OK |
Java 8 |
TESTS |
27 |
218 |
0 |
|
|
248047363 |
v3n1v1c11v1c1 |
D |
Feb. 24, 2024, 5:35 a.m. |
OK |
Java 8 |
TESTS |
27 |
280 |
14028800 |
|
|
248038126 |
Xing_ke |
D |
Feb. 24, 2024, 3:35 a.m. |
OK |
Java 8 |
TESTS |
27 |
296 |
22016000 |
|
|
247979312 |
ProjectYoung |
D |
Feb. 23, 2024, 4:37 p.m. |
OK |
Java 8 |
TESTS |
27 |
311 |
14131200 |
|
|
248006605 |
Dhruvin_Savla |
D |
Feb. 23, 2024, 7:23 p.m. |
OK |
Java 8 |
TESTS |
27 |
358 |
35840000 |
|
|
247992548 |
Yousef_Badr |
D |
Feb. 23, 2024, 5:44 p.m. |
OK |
Java 8 |
TESTS |
27 |
389 |
17715200 |
|
|
247978905 |
optimus1369 |
D |
Feb. 23, 2024, 4:36 p.m. |
OK |
Java 8 |
TESTS |
27 |
405 |
14131200 |
|
|
247979796 |
vatsal_04 |
D |
Feb. 23, 2024, 4:38 p.m. |
OK |
Java 8 |
TESTS |
27 |
421 |
17715200 |
|
|
247984941 |
duyipeng |
D |
Feb. 23, 2024, 4:58 p.m. |
OK |
Java 8 |
TESTS |
27 |
514 |
40140800 |
|
|
248000089 |
Yousef_Badr |
D |
Feb. 23, 2024, 6:35 p.m. |
OK |
Java 8 |
TESTS |
27 |
842 |
87142400 |
|
|
248018454 |
Howadji |
D |
Feb. 23, 2024, 9:19 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1450 |
38092800 |
|
|
248018338 |
Howadji |
D |
Feb. 23, 2024, 9:18 p.m. |
OK |
Kotlin 1.9 |
TESTS |
27 |
1575 |
38092800 |
|
|
247979519 |
mircea85 |
D |
Feb. 23, 2024, 4:37 p.m. |
OK |
Mono C# |
TESTS |
27 |
311 |
47411200 |
|
|
247991199 |
OLOGY |
D |
Feb. 23, 2024, 5:36 p.m. |
OK |
PyPy 2 |
TESTS |
27 |
592 |
45772800 |
|
|
248018324 |
OLOGY |
D |
Feb. 23, 2024, 9:17 p.m. |
OK |
PyPy 2 |
TESTS |
27 |
701 |
45772800 |
|
|
248018077 |
OLOGY |
D |
Feb. 23, 2024, 9:14 p.m. |
OK |
PyPy 2 |
TESTS |
27 |
826 |
45772800 |
|
|
248047912 |
StanMarsh-SP |
D |
Feb. 24, 2024, 5:41 a.m. |
OK |
PyPy 3 |
TESTS |
27 |
1403 |
68403200 |
|
|
247986271 |
radhikapillai25 |
D |
Feb. 23, 2024, 5:05 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
1965 |
84992000 |
|
|
248005962 |
gardengnome |
D |
Feb. 23, 2024, 7:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
326 |
44441600 |
|
|
248019800 |
YMSeah |
D |
Feb. 23, 2024, 9:36 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
327 |
41062400 |
|
|
247989320 |
yuki_keshiki |
D |
Feb. 23, 2024, 5:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
342 |
48128000 |
|
|
248022771 |
DarkTemplarDrop |
D |
Feb. 23, 2024, 10:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
358 |
40038400 |
|
|
248041869 |
tlsgusrb314 |
D |
Feb. 24, 2024, 4:30 a.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
358 |
52121600 |
|
|
248032803 |
RobinFromTheHood |
D |
Feb. 24, 2024, 1:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
374 |
49664000 |
|
|
248032264 |
RobinFromTheHood |
D |
Feb. 24, 2024, 1:46 a.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
390 |
49152000 |
|
|
247988722 |
Arpia |
D |
Feb. 23, 2024, 5:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
436 |
46080000 |
|
|
247988031 |
kinglykang |
D |
Feb. 23, 2024, 5:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
436 |
49561600 |
|
|
248007719 |
kinglykang |
D |
Feb. 23, 2024, 7:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
436 |
49664000 |
|
|
248025732 |
OLOGY |
D |
Feb. 23, 2024, 11:14 p.m. |
OK |
Python 2 |
TESTS |
27 |
1107 |
37683200 |
|
|
248025396 |
OLOGY |
D |
Feb. 23, 2024, 11:08 p.m. |
OK |
Python 2 |
TESTS |
27 |
1169 |
37683200 |
|
|
248025439 |
OLOGY |
D |
Feb. 23, 2024, 11:09 p.m. |
OK |
Python 2 |
TESTS |
27 |
1185 |
37683200 |
|
|
248025704 |
OLOGY |
D |
Feb. 23, 2024, 11:14 p.m. |
OK |
Python 2 |
TESTS |
27 |
1216 |
37683200 |
|
|
248025215 |
OLOGY |
D |
Feb. 23, 2024, 11:05 p.m. |
OK |
Python 2 |
TESTS |
27 |
1216 |
37683200 |
|
|
247996198 |
OLOGY |
D |
Feb. 23, 2024, 6:09 p.m. |
OK |
Python 2 |
TESTS |
27 |
1232 |
37683200 |
|
|
247992536 |
OLOGY |
D |
Feb. 23, 2024, 5:44 p.m. |
OK |
Python 2 |
TESTS |
27 |
1263 |
37785600 |
|
|
247991269 |
OLOGY |
D |
Feb. 23, 2024, 5:36 p.m. |
OK |
Python 2 |
TESTS |
27 |
1294 |
37785600 |
|
|
248046326 |
u-day |
D |
Feb. 24, 2024, 5:24 a.m. |
OK |
Python 3 |
TESTS |
27 |
1184 |
46694400 |
|
|
248029686 |
Swordelf |
D |
Feb. 24, 2024, 12:43 a.m. |
OK |
Rust 2021 |
TESTS |
27 |
374 |
36249600 |
|
|
247984151 |
robostac |
D |
Feb. 23, 2024, 4:55 p.m. |
OK |
Rust 2021 |
TESTS |
27 |
967 |
31334400 |
|
|
remove filters
Back to search problems