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"You are given an array of integers a of length n . You can apply the following operation any number of times (maybe, zero): Find the minimum number of coins needed to make a non-decreasing. That is, a_1 <= a_2 <= ldots <= a_n . Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- the elements of the array a . It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output a single integer -- the minimum number of coins needed to make a non-decreasing. In the first test case, a is already sorted, so you don't have to spend any coins. In the second test case, the optimal sequence of operations is: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
268210886 |
YoussefAmr_ |
B |
June 30, 2024, 5:06 p.m. |
OK |
C# 10 |
TESTS |
9 |
140 |
10342400 |
|
|
268231754 |
AhmedMaherAli |
B |
June 30, 2024, 7:48 p.m. |
OK |
C# 10 |
TESTS |
9 |
155 |
13004800 |
|
|
268246252 |
khangday19 |
B |
July 1, 2024, 12:24 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
61 |
819200 |
|
|
268269377 |
Krish_Chothani |
B |
July 1, 2024, 5:56 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
62 |
0 |
|
|
268251418 |
Jeffrin2005 |
B |
July 1, 2024, 2:10 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
62 |
0 |
|
|
268247801 |
elvisjcb |
B |
July 1, 2024, 1 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
62 |
0 |
|
|
268245655 |
Sunnynotsan1 |
B |
July 1, 2024, 12:11 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
62 |
819200 |
|
|
268269931 |
codewithprakhar |
B |
July 1, 2024, 6:01 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
77 |
0 |
|
|
268265303 |
hritz |
B |
July 1, 2024, 5:15 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
77 |
0 |
|
|
268251727 |
Tomato_Family_Bucket |
B |
July 1, 2024, 2:14 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
77 |
0 |
|
|
268239378 |
mss01 |
B |
June 30, 2024, 9:41 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
77 |
0 |
|
|
268227767 |
TroyBurnt |
B |
June 30, 2024, 6:59 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
9 |
77 |
0 |
|
|
268259190 |
asmitdeb |
B |
July 1, 2024, 4 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
61 |
0 |
|
|
268248875 |
Miko35 |
B |
July 1, 2024, 1:21 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
61 |
18124800 |
|
|
268267507 |
Tushal_Mendpara |
B |
July 1, 2024, 5:39 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268267156 |
Bunny_. |
B |
July 1, 2024, 5:35 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268266853 |
rakshith21mohan |
B |
July 1, 2024, 5:32 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268266568 |
DraggerJd03 |
B |
July 1, 2024, 5:30 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268266142 |
solver___ |
B |
July 1, 2024, 5:25 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268265154 |
Tosiqul_Islam |
B |
July 1, 2024, 5:14 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268261834 |
akihayashi |
B |
July 1, 2024, 4:32 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268261768 |
pikaninja123 |
B |
July 1, 2024, 4:31 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
9 |
62 |
0 |
|
|
268249371 |
LNian |
B |
July 1, 2024, 1:31 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
46 |
1638400 |
|
|
268247754 |
lucky_cloud |
B |
July 1, 2024, 12:59 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
46 |
2662400 |
|
|
268264293 |
_GOM3A_ |
B |
July 1, 2024, 5:02 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
0 |
|
|
268251592 |
Satyanshu111 |
B |
July 1, 2024, 2:12 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
0 |
|
|
268244099 |
gustavomattoslopes |
B |
June 30, 2024, 11:31 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
0 |
|
|
268225929 |
pessi_penaldo |
B |
June 30, 2024, 6:40 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
0 |
|
|
268255135 |
SuperJ6 |
B |
July 1, 2024, 3:07 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
409600 |
|
|
268255049 |
ZhaoYuzhe |
B |
July 1, 2024, 3:06 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
819200 |
|
|
268250966 |
zhangxiaogao |
B |
July 1, 2024, 2:02 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
819200 |
|
|
268266607 |
Vionia |
B |
July 1, 2024, 5:30 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
9 |
61 |
16076800 |
|
|
268270434 |
AKOvinno |
B |
July 1, 2024, 6:06 a.m. |
OK |
GNU C11 |
TESTS |
9 |
93 |
819200 |
|
|
268263336 |
atharvatol04 |
B |
July 1, 2024, 4:50 a.m. |
OK |
GNU C11 |
TESTS |
9 |
93 |
921600 |
|
|
268216674 |
jayanth26 |
B |
June 30, 2024, 5:24 p.m. |
OK |
GNU C11 |
TESTS |
9 |
108 |
409600 |
|
|
268209838 |
FredM |
B |
June 30, 2024, 5:03 p.m. |
OK |
GNU C11 |
TESTS |
9 |
108 |
921600 |
|
|
268212943 |
SRINIJA_PULLIPUDI |
B |
June 30, 2024, 5:13 p.m. |
OK |
GNU C11 |
TESTS |
9 |
124 |
819200 |
|
|
268255043 |
Mg718 |
B |
July 1, 2024, 3:06 a.m. |
OK |
Java 21 |
TESTS |
9 |
249 |
819200 |
|
|
268239263 |
e-z |
B |
June 30, 2024, 9:38 p.m. |
OK |
Java 21 |
TESTS |
9 |
280 |
512000 |
|
|
268229063 |
uditanshsrivastava2509 |
B |
June 30, 2024, 7:16 p.m. |
OK |
Java 21 |
TESTS |
9 |
280 |
1843200 |
|
|
268265725 |
krish1832 |
B |
July 1, 2024, 5:20 a.m. |
OK |
Java 21 |
TESTS |
9 |
281 |
614400 |
|
|
268259606 |
ManasM01 |
B |
July 1, 2024, 4:05 a.m. |
OK |
Java 21 |
TESTS |
9 |
296 |
614400 |
|
|
268255867 |
anshpatel2434 |
B |
July 1, 2024, 3:17 a.m. |
OK |
Java 21 |
TESTS |
9 |
296 |
614400 |
|
|
268233206 |
SD125 |
B |
June 30, 2024, 8:06 p.m. |
OK |
Java 21 |
TESTS |
9 |
312 |
0 |
|
|
268241326 |
Mega6776 |
B |
June 30, 2024, 10:22 p.m. |
OK |
Java 21 |
TESTS |
9 |
312 |
614400 |
|
|
268219753 |
ujjwaltwitx |
B |
June 30, 2024, 5:32 p.m. |
OK |
Java 21 |
TESTS |
9 |
328 |
204800 |
|
|
268230479 |
apoorveesinha |
B |
June 30, 2024, 7:33 p.m. |
OK |
Java 21 |
TESTS |
9 |
342 |
2662400 |
|
|
268231074 |
CipherSphinx_Raj |
B |
June 30, 2024, 7:39 p.m. |
OK |
Java 8 |
TESTS |
9 |
187 |
39321600 |
|
|
268217163 |
yrgoudar |
B |
June 30, 2024, 5:26 p.m. |
OK |
Java 8 |
TESTS |
9 |
218 |
0 |
|
|
268255847 |
alllexey |
B |
July 1, 2024, 3:17 a.m. |
OK |
Java 8 |
TESTS |
9 |
249 |
7270400 |
|
|
268265258 |
JBGZ |
B |
July 1, 2024, 5:15 a.m. |
OK |
Java 8 |
TESTS |
9 |
311 |
0 |
|
|
268251139 |
nandeeshkhant3205 |
B |
July 1, 2024, 2:05 a.m. |
OK |
Java 8 |
TESTS |
9 |
343 |
0 |
|
|
268235464 |
mohamedwaleid811 |
B |
June 30, 2024, 8:36 p.m. |
OK |
Java 8 |
TESTS |
9 |
343 |
0 |
|
|
268234328 |
suryatrikal |
B |
June 30, 2024, 8:20 p.m. |
OK |
Java 8 |
TESTS |
9 |
359 |
0 |
|
|
268210819 |
klu_2100031868 |
B |
June 30, 2024, 5:06 p.m. |
OK |
Java 8 |
TESTS |
9 |
405 |
0 |
|
|
268218024 |
shushankbhatia |
B |
June 30, 2024, 5:28 p.m. |
OK |
Java 8 |
TESTS |
9 |
437 |
0 |
|
|
268214981 |
rasputin_87 |
B |
June 30, 2024, 5:19 p.m. |
OK |
Java 8 |
TESTS |
9 |
452 |
0 |
|
|
268246206 |
kbliu |
B |
July 1, 2024, 12:23 a.m. |
OK |
PyPy 3 |
TESTS |
9 |
405 |
10444800 |
|
|
268243077 |
Martinien_ENSAF |
B |
June 30, 2024, 11:04 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
437 |
11468800 |
|
|
268212217 |
rashadalsharpini |
B |
June 30, 2024, 5:11 p.m. |
OK |
PyPy 3 |
TESTS |
9 |
452 |
11571200 |
|
|
268225458 |
TediousR |
B |
June 30, 2024, 6:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
124 |
13004800 |
|
|
268261368 |
focus_2024 |
B |
July 1, 2024, 4:26 a.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
124 |
13107200 |
|
|
268262887 |
NitroSpear |
B |
July 1, 2024, 4:44 a.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
125 |
13312000 |
|
|
268238377 |
gardengnome |
B |
June 30, 2024, 9:21 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
139 |
17100800 |
|
|
268251520 |
mikeac |
B |
July 1, 2024, 2:11 a.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
140 |
13312000 |
|
|
268242495 |
jvatsal0709 |
B |
June 30, 2024, 10:49 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
140 |
15360000 |
|
|
268248172 |
DeadMan69 |
B |
July 1, 2024, 1:08 a.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
156 |
17612800 |
|
|
268244659 |
burnerboy13 |
B |
June 30, 2024, 11:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
156 |
150016000 |
|
|
268265884 |
Bishwanath |
B |
July 1, 2024, 5:22 a.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
171 |
12800000 |
|
|
268241480 |
sutuSevenKamyoncuTeme |
B |
June 30, 2024, 10:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
9 |
171 |
13619200 |
|
|
268211158 |
Pratyush404 |
B |
June 30, 2024, 5:07 p.m. |
OK |
Python 3 |
TESTS |
9 |
140 |
14131200 |
|
|
268215484 |
ps_as_2230 |
B |
June 30, 2024, 5:21 p.m. |
OK |
Python 3 |
TESTS |
9 |
155 |
14028800 |
|
|
268210884 |
sanjanapatel238 |
B |
June 30, 2024, 5:06 p.m. |
OK |
Python 3 |
TESTS |
9 |
155 |
14028800 |
|
|
268214345 |
aryansood12 |
B |
June 30, 2024, 5:17 p.m. |
OK |
Python 3 |
TESTS |
9 |
156 |
14028800 |
|
|
268242720 |
eugalt |
B |
June 30, 2024, 10:55 p.m. |
OK |
Python 3 |
TESTS |
9 |
156 |
15052800 |
|
|
268259364 |
papdichaat |
B |
July 1, 2024, 4:02 a.m. |
OK |
Python 3 |
TESTS |
9 |
171 |
14028800 |
|
|
268228935 |
Virtuoso633 |
B |
June 30, 2024, 7:14 p.m. |
OK |
Python 3 |
TESTS |
9 |
171 |
14028800 |
|
|
268244271 |
Brackets12 |
B |
June 30, 2024, 11:35 p.m. |
OK |
Python 3 |
TESTS |
9 |
186 |
13516800 |
|
|
268238791 |
IRONMAN17 |
B |
June 30, 2024, 9:29 p.m. |
OK |
Python 3 |
TESTS |
9 |
186 |
13619200 |
|
|
268227002 |
codsila |
B |
June 30, 2024, 6:50 p.m. |
OK |
Python 3 |
TESTS |
9 |
187 |
14028800 |
|
|
268261445 |
0x81 |
B |
July 1, 2024, 4:27 a.m. |
OK |
Ruby 3 |
TESTS |
9 |
468 |
18739200 |
|
|
268229455 |
vstiff |
B |
June 30, 2024, 7:21 p.m. |
OK |
Rust 2021 |
TESTS |
9 |
62 |
1024000 |
|
|
remove filters
Back to search problems