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"Gildong has an interesting machine that has an array a with n integers. The machine supports two kinds of operations: A suffix is a subsegment (contiguous elements) of the array that contains a_n . In other words, for all i where a_i is included in the subsegment, all a_j 's where i lt j <= n must also be included in the subsegment. Gildong wants to make all elements of a equal -- he will always do so using the minimum number of operations necessary. To make his life even easier, before Gildong starts using the machine, you have the option of changing one of the integers in the array to any other integer. You are allowed to leave the array unchanged. You want to minimize the number of operations Gildong performs. With your help, what is the minimum number of operations Gildong will perform? Note that even if you change one of the integers in the array, you should not count that as one of the operations because Gildong did not perform it. Each test contains one or more test cases. The first line contains the number of test cases t ( 1 <= t <= 1000 ). Each test case contains two lines. The first line of each test case consists of an integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of elements of the array a . The second line of each test case contains n integers. The i -th integer is a_i ( -5 cdot 10^8 <= a_i <= 5 cdot 10^8 ). It is guaranteed that the sum of n in all test cases does not exceed 2 cdot 10^5 . For each test case, print one integer -- the minimum number of operations Gildong has to perform in order to make all elements of the array equal. In the first case, all elements of the array are already equal. Therefore, we do not change any integer and Gildong will perform zero operations. In the second case, we can set a_3 to be 0 , so that the array becomes [-1,0,0] . Now Gildong can use the 2 -nd operation once "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
100369697 |
Gassa |
B |
Dec. 4, 2020, 2:02 p.m. |
OK |
D |
TESTS |
43 |
93 |
13516800 |
|
|
100377590 |
ddd. |
B |
Dec. 4, 2020, 2:42 p.m. |
OK |
FPC |
TESTS |
43 |
77 |
1740800 |
|
|
100393100 |
babaiserror |
B |
Dec. 4, 2020, 5 p.m. |
OK |
GNU C11 |
TESTS |
43 |
62 |
819200 |
|
|
100395022 |
_Akhil_3366 |
B |
Dec. 4, 2020, 5:31 p.m. |
OK |
GNU C11 |
TESTS |
43 |
62 |
1638400 |
|
|
100395084 |
anvitha678 |
B |
Dec. 4, 2020, 5:32 p.m. |
OK |
GNU C11 |
TESTS |
43 |
62 |
1638400 |
|
|
100374341 |
akash456 |
B |
Dec. 4, 2020, 2:25 p.m. |
OK |
GNU C11 |
TESTS |
43 |
62 |
3174400 |
|
|
100372162 |
aozeritsky |
B |
Dec. 4, 2020, 2:14 p.m. |
OK |
GNU C11 |
TESTS |
43 |
62 |
7168000 |
|
|
100370722 |
Pingnian |
B |
Dec. 4, 2020, 2:07 p.m. |
OK |
GNU C11 |
TESTS |
43 |
77 |
1638400 |
|
|
100383401 |
1435730 |
B |
Dec. 4, 2020, 3:09 p.m. |
OK |
GNU C11 |
TESTS |
43 |
77 |
1638400 |
|
|
100414537 |
hyyyyy |
B |
Dec. 5, 2020, 4:13 a.m. |
OK |
GNU C11 |
TESTS |
43 |
78 |
1638400 |
|
|
100371233 |
buctAI2001lipeifeng |
B |
Dec. 4, 2020, 2:09 p.m. |
OK |
GNU C11 |
TESTS |
43 |
78 |
1638400 |
|
|
100393292 |
_Matrice |
B |
Dec. 4, 2020, 5:03 p.m. |
OK |
GNU C11 |
TESTS |
43 |
78 |
1638400 |
|
|
100368789 |
YjmStr |
B |
Dec. 4, 2020, 1:57 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
31 |
3174400 |
|
|
100409941 |
liangziqi |
B |
Dec. 5, 2020, 1:38 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
819200 |
|
|
100375837 |
Charon_wth |
B |
Dec. 4, 2020, 2:33 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
1638400 |
|
|
100370973 |
BuleVisitor |
B |
Dec. 4, 2020, 2:08 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
2150400 |
|
|
100382852 |
JCJCJCJCJC |
B |
Dec. 4, 2020, 3:06 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
2457600 |
|
|
100371262 |
mrclr |
B |
Dec. 4, 2020, 2:10 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
3174400 |
|
|
100414078 |
wddmahe |
B |
Dec. 5, 2020, 4 a.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
3174400 |
|
|
100378767 |
LengYun |
B |
Dec. 4, 2020, 2:47 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
3174400 |
|
|
100372674 |
AC_Crush |
B |
Dec. 4, 2020, 2:17 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
3174400 |
|
|
100381897 |
HNUST-z3475 |
B |
Dec. 4, 2020, 3:02 p.m. |
OK |
GNU C++11 |
TESTS |
43 |
46 |
5222400 |
|
|
100414500 |
Wayne_nitdgp |
B |
Dec. 5, 2020, 4:12 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100369334 |
Seer_Sayem |
B |
Dec. 4, 2020, 2 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100377928 |
hdilantha |
B |
Dec. 4, 2020, 2:43 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100379842 |
iamrakeshri28 |
B |
Dec. 4, 2020, 2:52 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100391238 |
guestIT |
B |
Dec. 4, 2020, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100389144 |
dhritishman22 |
B |
Dec. 4, 2020, 4:08 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
819200 |
|
|
100419673 |
Coder_Geralt |
B |
Dec. 5, 2020, 5:55 a.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
1638400 |
|
|
100404586 |
eraldo_coil |
B |
Dec. 4, 2020, 8:53 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
1638400 |
|
|
100404004 |
kavya_agarwal |
B |
Dec. 4, 2020, 8:36 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
1638400 |
|
|
100407429 |
cksberry |
B |
Dec. 4, 2020, 11:08 p.m. |
OK |
GNU C++14 |
TESTS |
43 |
77 |
1638400 |
|
|
100369826 |
_Backl1ght |
B |
Dec. 4, 2020, 2:02 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
46 |
1843200 |
|
|
100368949 |
indosm |
B |
Dec. 4, 2020, 1:58 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
62 |
819200 |
|
|
100391589 |
qazjason147 |
B |
Dec. 4, 2020, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
62 |
1536000 |
|
|
100414257 |
chrisG |
B |
Dec. 5, 2020, 4:05 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100414845 |
Ankit_12 |
B |
Dec. 5, 2020, 4:21 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100413094 |
YinLin |
B |
Dec. 5, 2020, 3:30 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100411657 |
mahfuzz |
B |
Dec. 5, 2020, 2:44 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100408600 |
whywyh |
B |
Dec. 5, 2020, 12:31 a.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100407056 |
timf1089 |
B |
Dec. 4, 2020, 10:46 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100404927 |
123sadkek |
B |
Dec. 4, 2020, 9:06 p.m. |
OK |
GNU C++17 |
TESTS |
43 |
77 |
819200 |
|
|
100408057 |
myhs |
B |
Dec. 4, 2020, 11:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
31 |
4198400 |
|
|
100389106 |
june_waves |
B |
Dec. 4, 2020, 4:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
46 |
819200 |
|
|
100399615 |
Dhruv_gheewala |
B |
Dec. 4, 2020, 6:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
46 |
3174400 |
|
|
100408113 |
RunGood |
B |
Dec. 4, 2020, 11:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
46 |
3174400 |
|
|
100391493 |
Thallium_is_Vegetable |
B |
Dec. 4, 2020, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
61 |
819200 |
|
|
100404882 |
over_flow |
B |
Dec. 4, 2020, 9:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
61 |
819200 |
|
|
100380542 |
_mickey_mouse_ |
B |
Dec. 4, 2020, 2:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
61 |
1638400 |
|
|
100412965 |
Emilan |
B |
Dec. 5, 2020, 3:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
61 |
1638400 |
|
|
100391425 |
krishnacharanmrp123 |
B |
Dec. 4, 2020, 4:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
61 |
6451200 |
|
|
100415837 |
hayeke |
B |
Dec. 5, 2020, 4:48 a.m. |
OK |
GNU C++17 (64) |
TESTS |
43 |
62 |
716800 |
|
|
100384828 |
maguroguma |
B |
Dec. 4, 2020, 3:15 p.m. |
OK |
Go |
TESTS |
43 |
124 |
9830400 |
|
|
100377190 |
afrozenman |
B |
Dec. 4, 2020, 2:40 p.m. |
OK |
Go |
TESTS |
43 |
202 |
4608000 |
|
|
100383703 |
remain_calm |
B |
Dec. 4, 2020, 3:10 p.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
0 |
|
|
100377634 |
mr13dynamo |
B |
Dec. 4, 2020, 2:42 p.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
0 |
|
|
100372468 |
DreamInfinite |
B |
Dec. 4, 2020, 2:16 p.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
0 |
|
|
100415577 |
ojhaankesh1975 |
B |
Dec. 5, 2020, 4:41 a.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
0 |
|
|
100404790 |
skittles1412 |
B |
Dec. 4, 2020, 9 p.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
307200 |
|
|
100372457 |
atishay127 |
B |
Dec. 4, 2020, 2:16 p.m. |
OK |
Java 11 |
TESTS |
43 |
202 |
5529600 |
|
|
100370843 |
PratyushS7 |
B |
Dec. 4, 2020, 2:08 p.m. |
OK |
Java 11 |
TESTS |
43 |
218 |
0 |
|
|
100370299 |
akman10 |
B |
Dec. 4, 2020, 2:05 p.m. |
OK |
Java 11 |
TESTS |
43 |
218 |
0 |
|
|
100375040 |
KGECian_23 |
B |
Dec. 4, 2020, 2:29 p.m. |
OK |
Java 11 |
TESTS |
43 |
218 |
0 |
|
|
100403467 |
mphillotry |
B |
Dec. 4, 2020, 8:19 p.m. |
OK |
Java 11 |
TESTS |
43 |
218 |
3686400 |
|
|
100374719 |
ShesMyNerd |
B |
Dec. 4, 2020, 2:27 p.m. |
OK |
Java 8 |
TESTS |
43 |
124 |
0 |
|
|
100406269 |
nandit |
B |
Dec. 4, 2020, 10:07 p.m. |
OK |
Java 8 |
TESTS |
43 |
124 |
0 |
|
|
100391498 |
tirth9960 |
B |
Dec. 4, 2020, 4:37 p.m. |
OK |
Java 8 |
TESTS |
43 |
124 |
0 |
|
|
100378035 |
revanthreddy85 |
B |
Dec. 4, 2020, 2:44 p.m. |
OK |
Java 8 |
TESTS |
43 |
139 |
0 |
|
|
100381714 |
rushilpaul |
B |
Dec. 4, 2020, 3:01 p.m. |
OK |
Java 8 |
TESTS |
43 |
140 |
0 |
|
|
100369567 |
MubtasimShahriar |
B |
Dec. 4, 2020, 2:01 p.m. |
OK |
Java 8 |
TESTS |
43 |
155 |
2662400 |
|
|
100403668 |
Uttam007 |
B |
Dec. 4, 2020, 8:24 p.m. |
OK |
Java 8 |
TESTS |
43 |
155 |
11673600 |
|
|
100370458 |
coolManit |
B |
Dec. 4, 2020, 2:06 p.m. |
OK |
Java 8 |
TESTS |
43 |
156 |
11673600 |
|
|
100396948 |
vaishnav_firebolt |
B |
Dec. 4, 2020, 6:05 p.m. |
OK |
Java 8 |
TESTS |
43 |
156 |
11673600 |
|
|
100371446 |
dab_dav |
B |
Dec. 4, 2020, 2:10 p.m. |
OK |
Java 8 |
TESTS |
43 |
156 |
11878400 |
|
|
100381716 |
sylvyrfysh |
B |
Dec. 4, 2020, 3:01 p.m. |
OK |
Kotlin |
TESTS |
43 |
202 |
16896000 |
|
|
100400277 |
ankushkhanna |
B |
Dec. 4, 2020, 7:09 p.m. |
OK |
Kotlin |
TESTS |
43 |
248 |
19456000 |
|
|
100369437 |
koper |
B |
Dec. 4, 2020, 2 p.m. |
OK |
Kotlin |
TESTS |
43 |
296 |
20275200 |
|
|
100389410 |
Scotty_pwnz |
B |
Dec. 4, 2020, 4:11 p.m. |
OK |
Kotlin |
TESTS |
43 |
296 |
20377600 |
|
|
100373122 |
MartiBook |
B |
Dec. 4, 2020, 2:19 p.m. |
OK |
Kotlin |
TESTS |
43 |
311 |
20275200 |
|
|
100377908 |
vladisov |
B |
Dec. 4, 2020, 2:43 p.m. |
OK |
Kotlin |
TESTS |
43 |
327 |
49049600 |
|
|
100382080 |
tomasz.masternak |
B |
Dec. 4, 2020, 3:03 p.m. |
OK |
Mono C# |
TESTS |
43 |
155 |
26419200 |
|
|
100369843 |
spiros_gal |
B |
Dec. 4, 2020, 2:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
0 |
|
|
100370396 |
dddttdCF |
B |
Dec. 4, 2020, 2:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
1638400 |
|
|
100414947 |
exode4 |
B |
Dec. 5, 2020, 4:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
1638400 |
|
|
100373256 |
alex0211 |
B |
Dec. 4, 2020, 2:20 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
1638400 |
|
|
100379522 |
dingzhao777 |
B |
Dec. 4, 2020, 2:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
3174400 |
|
|
100389856 |
0319 |
B |
Dec. 4, 2020, 4:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
3174400 |
|
|
100374728 |
201903007540 |
B |
Dec. 4, 2020, 2:27 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
93 |
4812800 |
|
|
100373065 |
Nekomanta |
B |
Dec. 4, 2020, 2:19 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
187 |
1638400 |
|
|
100379063 |
jongwook123 |
B |
Dec. 4, 2020, 2:49 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
202 |
2457600 |
|
|
100396814 |
stevancv |
B |
Dec. 4, 2020, 6:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
43 |
217 |
819200 |
|
|
100398445 |
Yupiteru |
B |
Dec. 4, 2020, 6:33 p.m. |
OK |
.NET Core C# |
TESTS |
43 |
124 |
4812800 |
|
|
100398739 |
ravinem1 |
B |
Dec. 4, 2020, 6:38 p.m. |
OK |
.NET Core C# |
TESTS |
43 |
124 |
25497600 |
|
|
100376569 |
tomvai15 |
B |
Dec. 4, 2020, 2:36 p.m. |
OK |
.NET Core C# |
TESTS |
43 |
124 |
26009600 |
|
|
100371930 |
Geo_Chrys |
B |
Dec. 4, 2020, 2:13 p.m. |
OK |
Node.js |
TESTS |
43 |
140 |
27340800 |
|
|
100374095 |
tennisru |
B |
Dec. 4, 2020, 2:24 p.m. |
OK |
Node.js |
TESTS |
43 |
171 |
27545600 |
|
|
100371885 |
watarimaycry2 |
B |
Dec. 4, 2020, 2:13 p.m. |
OK |
Node.js |
TESTS |
43 |
202 |
32256000 |
|
|
100376933 |
hxu10 |
B |
Dec. 4, 2020, 2:38 p.m. |
OK |
PyPy 2 |
TESTS |
43 |
249 |
13926400 |
|
|
100389773 |
bazzyadb |
B |
Dec. 4, 2020, 4:15 p.m. |
OK |
PyPy 2 |
TESTS |
43 |
280 |
18329600 |
|
|
100376193 |
_WhyNotMe_ |
B |
Dec. 4, 2020, 2:34 p.m. |
OK |
PyPy 2 |
TESTS |
43 |
374 |
37990400 |
|
|
100394305 |
ankitjosh78 |
B |
Dec. 4, 2020, 5:19 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
218 |
20787200 |
|
|
100370340 |
cgfs10000 |
B |
Dec. 4, 2020, 2:05 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
233 |
19558400 |
|
|
100402647 |
Anuranjan_Pandey |
B |
Dec. 4, 2020, 7:59 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
233 |
20787200 |
|
|
100415583 |
a0976531005 |
B |
Dec. 5, 2020, 4:41 a.m. |
OK |
PyPy 3 |
TESTS |
43 |
234 |
21606400 |
|
|
100372406 |
2019ucp1350 |
B |
Dec. 4, 2020, 2:16 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
264 |
19353600 |
|
|
100398931 |
FireBird23 |
B |
Dec. 4, 2020, 6:41 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
280 |
19763200 |
|
|
100371796 |
Rajdeep2k |
B |
Dec. 4, 2020, 2:12 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
296 |
19558400 |
|
|
100393613 |
deepanshu_pali |
B |
Dec. 4, 2020, 5:08 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
326 |
20992000 |
|
|
100398975 |
fazle_rabbi_ferdaus |
B |
Dec. 4, 2020, 6:42 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
358 |
18944000 |
|
|
100403262 |
borgib |
B |
Dec. 4, 2020, 8:13 p.m. |
OK |
PyPy 3 |
TESTS |
43 |
358 |
19046400 |
|
|
100411714 |
biltharesatyendra |
B |
Dec. 5, 2020, 2:47 a.m. |
OK |
Python 2 |
TESTS |
43 |
499 |
11366400 |
|
|
100381428 |
thuglife69 |
B |
Dec. 4, 2020, 3 p.m. |
OK |
Python 2 |
TESTS |
43 |
499 |
11468800 |
|
|
100370245 |
thelearner79 |
B |
Dec. 4, 2020, 2:04 p.m. |
OK |
Python 3 |
TESTS |
43 |
404 |
16793600 |
|
|
100370142 |
Angel_Demon |
B |
Dec. 4, 2020, 2:04 p.m. |
OK |
Python 3 |
TESTS |
43 |
421 |
16179200 |
|
|
100413120 |
zetxdivx |
B |
Dec. 5, 2020, 3:31 a.m. |
OK |
Python 3 |
TESTS |
43 |
436 |
16896000 |
|
|
100372938 |
isan_L |
B |
Dec. 4, 2020, 2:18 p.m. |
OK |
Python 3 |
TESTS |
43 |
436 |
16896000 |
|
|
100407662 |
eugalt |
B |
Dec. 4, 2020, 11:22 p.m. |
OK |
Python 3 |
TESTS |
43 |
436 |
24166400 |
|
|
100397634 |
Karthikch_6699 |
B |
Dec. 4, 2020, 6:17 p.m. |
OK |
Python 3 |
TESTS |
43 |
436 |
24166400 |
|
|
100393975 |
avilash111 |
B |
Dec. 4, 2020, 5:14 p.m. |
OK |
Python 3 |
TESTS |
43 |
436 |
24166400 |
|
|
100374240 |
happa |
B |
Dec. 4, 2020, 2:25 p.m. |
OK |
Python 3 |
TESTS |
43 |
451 |
16793600 |
|
|
100406967 |
eugalt |
B |
Dec. 4, 2020, 10:42 p.m. |
OK |
Python 3 |
TESTS |
43 |
451 |
24166400 |
|
|
100370049 |
demony |
B |
Dec. 4, 2020, 2:04 p.m. |
OK |
Python 3 |
TESTS |
43 |
452 |
17203200 |
|
|
100411871 |
MoSooN |
B |
Dec. 5, 2020, 2:53 a.m. |
OK |
Rust |
TESTS |
43 |
77 |
6144000 |
|
|
100369536 |
optozorax |
B |
Dec. 4, 2020, 2:01 p.m. |
OK |
Rust |
TESTS |
43 |
77 |
7065600 |
|
|
remove filters
Back to search problems