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 an array of integers [a_1, a_2, ... , a_n] , let's call the value |a_1-a_2|+|a_2-a_3|+ cdots+|a_{n-1}-a_n| the contrast of the array. Note that the contrast of an array of size 1 is equal to 0 . You are given an array of integers a . Your task is to build an array of b in such a way that all the following conditions are met: What is the minimum possible size of the array b ? 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 size of the array a . The second line contains n integers a_1, a_2, cdot, a_n ( 0 <= a_i <= 10^9 ) -- elements of the array itself. The sum of n over all test cases doesn't exceed 3 cdot 10^5 . For each test case, print a single integer -- the minimum possible size of the array b . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
206159692 |
bluemegane |
C |
May 16, 2023, 10:49 p.m. |
OK |
C# 8 |
TESTS |
11 |
186 |
37478400 |
|
1200 |
205810106 |
sofiazy |
C |
May 14, 2023, 9:01 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
1466 |
2662400 |
|
1200 |
206372103 |
shubham_4541 |
C |
May 18, 2023, 5:41 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
1497 |
22118400 |
|
1200 |
205956942 |
hemanth746 |
C |
May 15, 2023, 8:25 a.m. |
OK |
Clang++20 Diagnostics |
TESTS |
11 |
156 |
3686400 |
|
1200 |
206452953 |
Agin |
C |
May 19, 2023, 1:43 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
11 |
1419 |
15769600 |
|
1200 |
206101022 |
chenTAT |
C |
May 16, 2023, 2:41 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
11 |
1450 |
1433600 |
|
1200 |
205933179 |
xuanhuiyisheng |
C |
May 15, 2023, 2:03 a.m. |
OK |
GNU C11 |
TESTS |
11 |
78 |
1228800 |
|
1200 |
205797875 |
Sowhardo22 |
C |
May 14, 2023, 7:19 a.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
2355200 |
|
1200 |
205827169 |
HQLF |
C |
May 14, 2023, 11:43 a.m. |
OK |
GNU C11 |
TESTS |
11 |
607 |
1945600 |
|
1200 |
205779516 |
Kyzer1de |
C |
May 14, 2023, 3:31 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206212171 |
WEXI7111 |
C |
May 17, 2023, 12:51 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206313776 |
sizihan |
C |
May 18, 2023, 8:25 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206456418 |
Abd_Mamun |
C |
May 19, 2023, 2:19 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206188678 |
cy543212007 |
C |
May 17, 2023, 9:02 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
2457600 |
|
1200 |
205973695 |
snowca |
C |
May 15, 2023, 11:29 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
62 |
3993600 |
|
1200 |
206176905 |
wangxs |
C |
May 17, 2023, 6:46 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
77 |
1228800 |
|
1200 |
206243986 |
goal_icpc_in_shaa_ALLAH |
C |
May 17, 2023, 4:01 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
77 |
1228800 |
|
1200 |
206209691 |
flowdude |
C |
May 17, 2023, 12:29 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
77 |
1228800 |
|
1200 |
206334163 |
gotitup |
C |
May 18, 2023, 11:43 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
77 |
1228800 |
|
1200 |
206404161 |
ultrakirb |
C |
May 19, 2023, 4:51 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1024000 |
|
1200 |
205952349 |
cuican123 |
C |
May 15, 2023, 7:28 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
205903757 |
MyVegetableHasExploded |
C |
May 14, 2023, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
205843243 |
hyyw051228 |
C |
May 14, 2023, 2:36 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
205824672 |
.DJ. |
C |
May 14, 2023, 11:12 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206025056 |
KenZu |
C |
May 15, 2023, 7:38 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206352621 |
msk132 |
C |
May 18, 2023, 2:31 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206180884 |
ParsaAp |
C |
May 17, 2023, 7:35 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
1228800 |
|
1200 |
206367841 |
Adnan_md |
C |
May 18, 2023, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
2457600 |
|
1200 |
206083134 |
dlwc |
C |
May 16, 2023, 12:01 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
62 |
3993600 |
|
1200 |
205783786 |
MarkIII |
C |
May 14, 2023, 4:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206376706 |
ykodwani01 |
C |
May 18, 2023, 6:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206326254 |
Turtle1108 |
C |
May 18, 2023, 10:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206201150 |
vjudge2 |
C |
May 17, 2023, 11:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206160370 |
Hytidel |
C |
May 16, 2023, 11:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206038580 |
TheLanternInEarlySummer |
C |
May 16, 2023, 1:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206007309 |
lcpt |
C |
May 15, 2023, 4:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
205999066 |
KivenKill |
C |
May 15, 2023, 2:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
205937879 |
bkifhr6 |
C |
May 15, 2023, 3:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
205819305 |
Ceased.xp |
C |
May 14, 2023, 10:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
46 |
1228800 |
|
1200 |
206211190 |
MIG29 |
C |
May 17, 2023, 12:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206154125 |
Sputnik1234 |
C |
May 16, 2023, 8:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206090452 |
lulalalulalalulalulalei |
C |
May 16, 2023, 1:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206088208 |
tempo221 |
C |
May 16, 2023, 12:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206006117 |
nurbek-nurbagi-003-26 |
C |
May 15, 2023, 4:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
205994808 |
zyoobn |
C |
May 15, 2023, 2:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
205948152 |
WantToHide |
C |
May 15, 2023, 6:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206292477 |
Sing |
C |
May 18, 2023, 3:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206333675 |
peikez |
C |
May 18, 2023, 11:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
206358204 |
kitsunehivern |
C |
May 18, 2023, 3:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
11 |
31 |
1228800 |
|
1200 |
205789039 |
gaju_01 |
C |
May 14, 2023, 5:59 a.m. |
OK |
Java 11 |
TESTS |
11 |
155 |
0 |
|
1200 |
206143175 |
jxin31415 |
C |
May 16, 2023, 6:04 p.m. |
OK |
Java 11 |
TESTS |
11 |
217 |
4198400 |
|
1200 |
206040909 |
djrfrn |
C |
May 16, 2023, 2:52 a.m. |
OK |
Java 11 |
TESTS |
11 |
233 |
3891200 |
|
1200 |
205793729 |
deepakanto |
C |
May 14, 2023, 6:41 a.m. |
OK |
Java 11 |
TESTS |
11 |
249 |
4198400 |
|
1200 |
206190731 |
FirstException |
C |
May 17, 2023, 9:22 a.m. |
OK |
Java 11 |
TESTS |
11 |
249 |
69324800 |
|
1200 |
206086732 |
Panther369 |
C |
May 16, 2023, 12:32 p.m. |
OK |
Java 11 |
TESTS |
11 |
265 |
7168000 |
|
1200 |
205782512 |
kasiru_69 |
C |
May 14, 2023, 4:29 a.m. |
OK |
Java 11 |
TESTS |
11 |
342 |
17100800 |
|
1200 |
205957765 |
vaibhav20257 |
C |
May 15, 2023, 8:35 a.m. |
OK |
Java 11 |
TESTS |
11 |
529 |
0 |
|
1200 |
205785758 |
cvs01 |
C |
May 14, 2023, 5:19 a.m. |
OK |
Java 11 |
TESTS |
11 |
530 |
0 |
|
1200 |
206223800 |
SadFriedRice |
C |
May 17, 2023, 2:38 p.m. |
OK |
Java 11 |
TESTS |
11 |
592 |
3584000 |
|
1200 |
206019958 |
Vrutik_2809 |
C |
May 15, 2023, 6:31 p.m. |
OK |
Java 17 |
TESTS |
11 |
186 |
614400 |
|
1200 |
206252734 |
Atuer |
C |
May 17, 2023, 4:52 p.m. |
OK |
Java 17 |
TESTS |
11 |
202 |
102400 |
|
1200 |
206020785 |
Vrutik_2809 |
C |
May 15, 2023, 6:41 p.m. |
OK |
Java 17 |
TESTS |
11 |
202 |
4403200 |
|
1200 |
206293332 |
ajxu2 |
C |
May 18, 2023, 3:26 a.m. |
OK |
Java 17 |
TESTS |
11 |
217 |
819200 |
|
1200 |
205974771 |
TCchen |
C |
May 15, 2023, 11:37 a.m. |
OK |
Java 17 |
TESTS |
11 |
233 |
3891200 |
|
1200 |
206198877 |
Suraj1607 |
C |
May 17, 2023, 10:51 a.m. |
OK |
Java 17 |
TESTS |
11 |
234 |
4300800 |
|
1200 |
205933522 |
jport Aemon |
C |
May 15, 2023, 2:12 a.m. |
OK |
Java 17 |
TESTS |
11 |
249 |
11161600 |
|
1200 |
205944021 |
dracarys_1105 |
C |
May 15, 2023, 5:32 a.m. |
OK |
Java 17 |
TESTS |
11 |
264 |
6758400 |
|
1200 |
206165177 |
optimus1369 |
C |
May 17, 2023, 2:13 a.m. |
OK |
Java 17 |
TESTS |
11 |
296 |
6348800 |
|
1200 |
206054119 |
this.is.shivamsingh |
C |
May 16, 2023, 6:39 a.m. |
OK |
Java 17 |
TESTS |
11 |
311 |
7372800 |
|
1200 |
205933197 |
KKKZOZ |
C |
May 15, 2023, 2:04 a.m. |
OK |
Java 8 |
TESTS |
11 |
155 |
0 |
|
1200 |
205952746 |
OldBlack |
C |
May 15, 2023, 7:33 a.m. |
OK |
Java 8 |
TESTS |
11 |
155 |
2867200 |
|
1200 |
206051601 |
ZXF_521mua |
C |
May 16, 2023, 6:05 a.m. |
OK |
Java 8 |
TESTS |
11 |
171 |
0 |
|
1200 |
205933175 |
KKKZOZ |
C |
May 15, 2023, 2:03 a.m. |
OK |
Java 8 |
TESTS |
11 |
171 |
0 |
|
1200 |
206040544 |
Tim2004 |
C |
May 16, 2023, 2:43 a.m. |
OK |
Java 8 |
TESTS |
11 |
187 |
14643200 |
|
1200 |
205834489 |
madhav2800 |
C |
May 14, 2023, 1 p.m. |
OK |
Java 8 |
TESTS |
11 |
202 |
14643200 |
|
1200 |
206213194 |
aniket27 |
C |
May 17, 2023, 1 p.m. |
OK |
Java 8 |
TESTS |
11 |
217 |
14336000 |
|
1200 |
205806962 |
Asnkkzk |
C |
May 14, 2023, 8:35 a.m. |
OK |
Java 8 |
TESTS |
11 |
218 |
0 |
|
1200 |
206408094 |
amit_roy |
C |
May 19, 2023, 5:53 a.m. |
OK |
Java 8 |
TESTS |
11 |
467 |
0 |
|
1200 |
206401997 |
priyaroy3370 |
C |
May 19, 2023, 4:10 a.m. |
OK |
Java 8 |
TESTS |
11 |
467 |
0 |
|
1200 |
205809389 |
arkzuse |
C |
May 14, 2023, 8:55 a.m. |
OK |
Kotlin 1.7 |
TESTS |
11 |
717 |
139776000 |
|
1200 |
206077137 |
MortezaGhandchi |
C |
May 16, 2023, 11:03 a.m. |
OK |
Mono C# |
TESTS |
11 |
140 |
32972800 |
|
1200 |
206076563 |
MortezaGhandchi |
C |
May 16, 2023, 10:56 a.m. |
OK |
Mono C# |
TESTS |
11 |
202 |
45875200 |
|
1200 |
205962057 |
sqrt81 |
C |
May 15, 2023, 9:22 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
93 |
5427200 |
|
1200 |
206324427 |
breatre |
C |
May 18, 2023, 10:12 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
109 |
1536000 |
|
1200 |
206283220 |
Gadi |
C |
May 17, 2023, 10:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
249 |
1228800 |
|
1200 |
206305519 |
harsh2004sinha |
C |
May 18, 2023, 6:49 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
280 |
8396800 |
|
1200 |
205791759 |
kikcer |
C |
May 14, 2023, 6:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
312 |
2457600 |
|
1200 |
206280638 |
ipip |
C |
May 17, 2023, 8:49 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
389 |
32870400 |
|
1200 |
206245766 |
sky_coder_ |
C |
May 17, 2023, 4:18 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
405 |
26521600 |
|
1200 |
205944723 |
maxliang |
C |
May 15, 2023, 5:43 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
421 |
28160000 |
|
1200 |
205819269 |
shikamarubyte |
C |
May 14, 2023, 10:20 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
421 |
32768000 |
|
1200 |
205950309 |
kernelpopped |
C |
May 15, 2023, 7:04 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
436 |
27955200 |
|
1200 |
205939082 |
neerajam |
C |
May 15, 2023, 4:08 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
483 |
29900800 |
|
1200 |
206355792 |
tomasnyberg |
C |
May 18, 2023, 3 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
124 |
36454400 |
|
1200 |
206299471 |
nealzane |
C |
May 18, 2023, 5:26 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
139 |
36147200 |
|
1200 |
206317839 |
2000031264 |
C |
May 18, 2023, 9:06 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
140 |
40652800 |
|
1200 |
206315645 |
soudhamini_2000031088 |
C |
May 18, 2023, 8:43 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
140 |
40652800 |
|
1200 |
206146498 |
2000030958 |
C |
May 16, 2023, 6:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
140 |
40652800 |
|
1200 |
205817922 |
poornaTheja |
C |
May 14, 2023, 10:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
155 |
41062400 |
|
1200 |
206085261 |
waki_ |
C |
May 16, 2023, 12:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
156 |
43724800 |
|
1200 |
206011078 |
Marco_Lau |
C |
May 15, 2023, 4:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
156 |
47104000 |
|
1200 |
206402068 |
VNThanhNT |
C |
May 19, 2023, 4:11 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
171 |
33075200 |
|
1200 |
206081060 |
ItsNotJasper |
C |
May 16, 2023, 11:42 a.m. |
OK |
PyPy 3-64 |
TESTS |
11 |
171 |
37888000 |
|
1200 |
206297939 |
Manikya_0309 |
C |
May 18, 2023, 5:01 a.m. |
OK |
Python 3 |
TESTS |
11 |
187 |
42188800 |
|
1200 |
205799855 |
jwalapc |
C |
May 14, 2023, 7:35 a.m. |
OK |
Python 3 |
TESTS |
11 |
187 |
42188800 |
|
1200 |
205928028 |
sullar |
C |
May 14, 2023, 11:03 p.m. |
OK |
Python 3 |
TESTS |
11 |
202 |
42188800 |
|
1200 |
205902700 |
sridharsiddi |
C |
May 14, 2023, 4:48 p.m. |
OK |
Python 3 |
TESTS |
11 |
202 |
42188800 |
|
1200 |
206442634 |
2100030666.cseh |
C |
May 19, 2023, 12:01 p.m. |
OK |
Python 3 |
TESTS |
11 |
218 |
42188800 |
|
1200 |
205902727 |
sridharsiddi |
C |
May 14, 2023, 4:49 p.m. |
OK |
Python 3 |
TESTS |
11 |
218 |
42188800 |
|
1200 |
206067492 |
2000030996-akanksha |
C |
May 16, 2023, 9:23 a.m. |
OK |
Python 3 |
TESTS |
11 |
233 |
38400000 |
|
1200 |
205778370 |
pennymagic156 |
C |
May 14, 2023, 3:05 a.m. |
OK |
Python 3 |
TESTS |
11 |
249 |
38707200 |
|
1200 |
206217221 |
stephen30curry |
C |
May 17, 2023, 1:35 p.m. |
OK |
Python 3 |
TESTS |
11 |
249 |
40038400 |
|
1200 |
206048327 |
saurabh_kadian |
C |
May 16, 2023, 5:16 a.m. |
OK |
Python 3 |
TESTS |
11 |
249 |
40550400 |
|
1200 |
205892594 |
Lukiko |
C |
May 14, 2023, 4:04 p.m. |
OK |
Rust 2021 |
TESTS |
11 |
139 |
10854400 |
|
1200 |
remove filters
Back to search problems