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'Call an array a of length n sorted if a_1 <= q a_2 <= q ldots <= q a_{n-1} <= q a_n . Ntarsis has an array a of length n . He is allowed to perform one type of operation on it (zero or more times): The values of a can be negative after an operation. Determine the minimum operations needed to make a not sorted. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 100 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= q n <= q 500 ) -- the length of the array a . The next line contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the values of array a . It is guaranteed that the sum of n across all test cases does not exceed 500 . Output the minimum number of operations needed to make the array not sorted. In the first case, we can perform 1 operation to make the array not sorted: In the second case, we can perform 2 operations to make the array not sorted: It can be proven that 1 and 2 operations are the minimal numbers of operations in the first and second test cases, respectively. In the third case, the array is already not sorted, so we perform 0 operations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
215242028 |
Shiref_Mohammed |
A |
July 23, 2023, 4:29 p.m. |
OK |
C# 10 |
TESTS |
10 |
62 |
512000 |
|
|
215276693 |
bluemegane |
A |
July 23, 2023, 10:10 p.m. |
OK |
C# 8 |
TESTS |
10 |
124 |
204800 |
|
|
215256840 |
Aniket54 |
A |
July 23, 2023, 6 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
10 |
46 |
6348800 |
|
|
215259153 |
NenadDapic |
A |
July 23, 2023, 6:18 p.m. |
OK |
FPC |
TESTS |
10 |
15 |
102400 |
|
|
215296199 |
himanshu2004 |
A |
July 24, 2023, 3:43 a.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215296248 |
himanshu10092004 |
A |
July 24, 2023, 3:44 a.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215234288 |
chicken_65 |
A |
July 23, 2023, 4:01 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215238076 |
Cadsjyhgb |
A |
July 23, 2023, 4:14 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215241768 |
supto07 |
A |
July 23, 2023, 4:28 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215249504 |
enn072 |
A |
July 23, 2023, 4:58 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215255912 |
jmawa1163 |
A |
July 23, 2023, 5:53 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215259593 |
DHRUBA276 |
A |
July 23, 2023, 6:22 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215267204 |
c0derro |
A |
July 23, 2023, 7:46 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
0 |
|
|
215258167 |
soumyadebs22 |
A |
July 23, 2023, 6:10 p.m. |
OK |
GNU C11 |
TESTS |
10 |
15 |
102400 |
|
|
215285554 |
wywldmfs |
A |
July 24, 2023, 1:23 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215285304 |
chengengcheng |
A |
July 24, 2023, 1:19 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215282436 |
ybaggio |
A |
July 24, 2023, 12:27 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215280471 |
mukari |
A |
July 23, 2023, 11:38 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215268469 |
B2Tyson |
A |
July 23, 2023, 8:01 p.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215304374 |
MrPython |
A |
July 24, 2023, 5:31 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215303111 |
szhangwei |
A |
July 24, 2023, 5:16 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215300674 |
TurnToLeave |
A |
July 24, 2023, 4:47 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215296511 |
noobfromeast |
A |
July 24, 2023, 3:47 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215289282 |
szhangwei |
A |
July 24, 2023, 2:18 a.m. |
OK |
GNU C++14 |
TESTS |
10 |
0 |
0 |
|
|
215304336 |
sif_69 |
A |
July 24, 2023, 5:31 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215305399 |
mustard_with_fries69420 |
A |
July 24, 2023, 5:42 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215305622 |
KunalKg3723 |
A |
July 24, 2023, 5:44 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215305765 |
Sanjida_Riti |
A |
July 24, 2023, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215305861 |
siamjotry |
A |
July 24, 2023, 5:47 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215302810 |
yong0315 |
A |
July 24, 2023, 5:12 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215302082 |
JAdogzz |
A |
July 24, 2023, 5:03 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215301234 |
parth190804 |
A |
July 24, 2023, 4:53 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215299874 |
Nekotizimo |
A |
July 24, 2023, 4:36 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215299098 |
Afridisid0208 |
A |
July 24, 2023, 4:25 a.m. |
OK |
GNU C++17 |
TESTS |
10 |
0 |
0 |
|
|
215305862 |
Subham_Dey_ |
A |
July 24, 2023, 5:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215304661 |
AhsanulHoqueAbir |
A |
July 24, 2023, 5:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215304363 |
newbie333 |
A |
July 24, 2023, 5:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215303622 |
roccoon23 |
A |
July 24, 2023, 5:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215303465 |
gopi554 |
A |
July 24, 2023, 5:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215302493 |
Jihadd_d |
A |
July 24, 2023, 5:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215296696 |
cjk041212 |
A |
July 24, 2023, 3:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215295758 |
NIckyNIck |
A |
July 24, 2023, 3:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215294877 |
FurryDragon |
A |
July 24, 2023, 3:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215291332 |
Kapil4457 |
A |
July 24, 2023, 2:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
10 |
0 |
0 |
|
|
215304884 |
codevc_04 |
A |
July 24, 2023, 5:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305367 |
_Rishav_Singh_ |
A |
July 24, 2023, 5:42 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305675 |
DEBRAJ_KARMAKAR |
A |
July 24, 2023, 5:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305850 |
__shikhar_007 |
A |
July 24, 2023, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305879 |
Murnomous24 |
A |
July 24, 2023, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305935 |
Redfoot |
A |
July 24, 2023, 5:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215305945 |
Murnomous24 |
A |
July 24, 2023, 5:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215306135 |
gaut_2003 |
A |
July 24, 2023, 5:50 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215306288 |
bitcoder510 |
A |
July 24, 2023, 5:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215307088 |
sanhayu546 |
A |
July 24, 2023, 6:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
10 |
0 |
0 |
|
|
215299354 |
ayane |
A |
July 24, 2023, 4:29 a.m. |
OK |
Go |
TESTS |
10 |
15 |
0 |
|
|
215300537 |
mihassan |
A |
July 24, 2023, 4:45 a.m. |
OK |
Haskell |
TESTS |
10 |
15 |
0 |
|
|
215276419 |
ujjwal_a0001 |
A |
July 23, 2023, 10:04 p.m. |
OK |
Java 11 |
TESTS |
10 |
155 |
0 |
|
|
215287204 |
global_optimum |
A |
July 24, 2023, 1:49 a.m. |
OK |
Java 11 |
TESTS |
10 |
156 |
0 |
|
|
215288306 |
Nanthakumar06 |
A |
July 24, 2023, 2:04 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
215288118 |
Nanthakumar06 |
A |
July 24, 2023, 2:01 a.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
215278509 |
yousef03 |
A |
July 23, 2023, 10:53 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
215247438 |
brainlame |
A |
July 23, 2023, 4:51 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
215243997 |
faresbadr316 |
A |
July 23, 2023, 4:37 p.m. |
OK |
Java 11 |
TESTS |
10 |
171 |
0 |
|
|
215267247 |
vishesh9096 |
A |
July 23, 2023, 7:46 p.m. |
OK |
Java 11 |
TESTS |
10 |
187 |
0 |
|
|
215283942 |
lihanyu |
A |
July 24, 2023, 12:57 a.m. |
OK |
Java 11 |
TESTS |
10 |
187 |
0 |
|
|
215275867 |
h_s_jaiswal |
A |
July 23, 2023, 9:52 p.m. |
OK |
Java 11 |
TESTS |
10 |
202 |
0 |
|
|
215257942 |
Vrutik_2809 |
A |
July 23, 2023, 6:08 p.m. |
OK |
Java 17 |
TESTS |
10 |
171 |
409600 |
|
|
215256966 |
Nagendravarma |
A |
July 23, 2023, 6:01 p.m. |
OK |
Java 17 |
TESTS |
10 |
171 |
512000 |
|
|
215301954 |
rbaliwal00 |
A |
July 24, 2023, 5:02 a.m. |
OK |
Java 17 |
TESTS |
10 |
171 |
716800 |
|
|
215258834 |
Akash_Sardar |
A |
July 23, 2023, 6:15 p.m. |
OK |
Java 17 |
TESTS |
10 |
186 |
307200 |
|
|
215277584 |
imvivekthakur |
A |
July 23, 2023, 10:30 p.m. |
OK |
Java 17 |
TESTS |
10 |
186 |
716800 |
|
|
215296356 |
Online_Engineer |
A |
July 24, 2023, 3:45 a.m. |
OK |
Java 17 |
TESTS |
10 |
186 |
819200 |
|
|
215264346 |
Danger_Don |
A |
July 23, 2023, 7:12 p.m. |
OK |
Java 17 |
TESTS |
10 |
186 |
921600 |
|
|
215284167 |
Asnkkzk |
A |
July 24, 2023, 1:01 a.m. |
OK |
Java 17 |
TESTS |
10 |
187 |
409600 |
|
|
215276038 |
woodyiiiiiii |
A |
July 23, 2023, 9:56 p.m. |
OK |
Java 17 |
TESTS |
10 |
187 |
409600 |
|
|
215233981 |
utawasthi |
A |
July 23, 2023, 4 p.m. |
OK |
Java 17 |
TESTS |
10 |
187 |
409600 |
|
|
215291009 |
Y_T |
A |
July 24, 2023, 2:39 a.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
215279964 |
tukiTuki011 |
A |
July 23, 2023, 11:28 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
215274513 |
qlf9 |
A |
July 23, 2023, 9:27 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
215274225 |
Yousef_Badr |
A |
July 23, 2023, 9:21 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
215271723 |
abdallahsameh |
A |
July 23, 2023, 8:44 p.m. |
OK |
Java 8 |
TESTS |
10 |
93 |
0 |
|
|
215300432 |
chuquwan9964 |
A |
July 24, 2023, 4:44 a.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
215287808 |
ankit_0207 |
A |
July 24, 2023, 1:57 a.m. |
OK |
Java 8 |
TESTS |
10 |
108 |
0 |
|
|
215306833 |
ritik2002 |
A |
July 24, 2023, 5:58 a.m. |
OK |
Java 8 |
TESTS |
10 |
124 |
0 |
|
|
215299281 |
amit_roy |
A |
July 24, 2023, 4:28 a.m. |
OK |
Java 8 |
TESTS |
10 |
124 |
0 |
|
|
215291844 |
nidhisheel |
A |
July 24, 2023, 2:50 a.m. |
OK |
Java 8 |
TESTS |
10 |
124 |
0 |
|
|
215266274 |
StealthNinja |
A |
July 23, 2023, 7:35 p.m. |
OK |
Kotlin 1.7 |
TESTS |
10 |
249 |
1638400 |
|
|
215260953 |
belief_010 |
A |
July 23, 2023, 6:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
0 |
0 |
|
|
215293336 |
guojunze |
A |
July 24, 2023, 3:09 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215290237 |
18385895814 |
A |
July 24, 2023, 2:30 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215282816 |
soapedya |
A |
July 24, 2023, 12:36 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215282356 |
soapedya |
A |
July 24, 2023, 12:26 a.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215271154 |
Mohamed_Ragab123321 |
A |
July 23, 2023, 8:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215261398 |
narwalabhinav |
A |
July 23, 2023, 6:39 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215260256 |
diall_38 |
A |
July 23, 2023, 6:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215257793 |
HarmeetSingh |
A |
July 23, 2023, 6:07 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215237579 |
NotShrey |
A |
July 23, 2023, 4:13 p.m. |
OK |
MS C++ 2017 |
TESTS |
10 |
15 |
0 |
|
|
215284938 |
whoami096 |
A |
July 24, 2023, 1:13 a.m. |
OK |
PyPy 3 |
TESTS |
10 |
77 |
0 |
|
|
215282042 |
zainijunaid8228 |
A |
July 24, 2023, 12:19 a.m. |
OK |
PyPy 3 |
TESTS |
10 |
77 |
0 |
|
|
215255257 |
johnseven6942 |
A |
July 23, 2023, 5:50 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
77 |
0 |
|
|
215260694 |
Asadbek06 |
A |
July 23, 2023, 6:32 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
92 |
0 |
|
|
215260577 |
Grimm1234 |
A |
July 23, 2023, 6:31 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
93 |
0 |
|
|
215254912 |
jvatsal0709 |
A |
July 23, 2023, 5:48 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
93 |
0 |
|
|
215262369 |
ikhare |
A |
July 23, 2023, 6:49 p.m. |
OK |
PyPy 3 |
TESTS |
10 |
171 |
4608000 |
|
|
215302917 |
andy0liang |
A |
July 24, 2023, 5:13 a.m. |
OK |
PyPy 3 |
TESTS |
10 |
186 |
4710400 |
|
|
215303343 |
drgrd |
A |
July 24, 2023, 5:19 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215290287 |
gardengnome |
A |
July 24, 2023, 2:30 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215279376 |
Noone7766 |
A |
July 23, 2023, 11:14 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215275103 |
elmklod |
A |
July 23, 2023, 9:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215271559 |
denilb |
A |
July 23, 2023, 8:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215265401 |
person_exe |
A |
July 23, 2023, 7:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215255573 |
nabovtl |
A |
July 23, 2023, 5:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
46 |
0 |
|
|
215303757 |
I_Am_That |
A |
July 24, 2023, 5:24 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
61 |
0 |
|
|
215302833 |
edgerunner |
A |
July 24, 2023, 5:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
61 |
0 |
|
|
215291677 |
hukevraainy |
A |
July 24, 2023, 2:47 a.m. |
OK |
PyPy 3-64 |
TESTS |
10 |
61 |
0 |
|
|
215257520 |
MShah2003 |
A |
July 23, 2023, 6:05 p.m. |
OK |
Python 3 |
TESTS |
10 |
30 |
0 |
|
|
215302554 |
Alexrider726 |
A |
July 24, 2023, 5:09 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215302538 |
o170321 |
A |
July 24, 2023, 5:09 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215301259 |
mihassan |
A |
July 24, 2023, 4:54 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215300628 |
abdulhasib |
A |
July 24, 2023, 4:46 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215294506 |
VilGaXx |
A |
July 24, 2023, 3:21 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215287915 |
sarath_gandla |
A |
July 24, 2023, 1:59 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215287061 |
NoLongerHuman |
A |
July 24, 2023, 1:46 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215284009 |
abhijit07cf |
A |
July 24, 2023, 12:58 a.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215280616 |
arnob2806 |
A |
July 23, 2023, 11:42 p.m. |
OK |
Python 3 |
TESTS |
10 |
31 |
0 |
|
|
215272381 |
cptahahab |
A |
July 23, 2023, 8:52 p.m. |
OK |
Rust 2021 |
TESTS |
10 |
15 |
0 |
|
|
215239561 |
rusty_ferris |
A |
July 23, 2023, 4:20 p.m. |
OK |
Rust 2021 |
TESTS |
10 |
15 |
0 |
|
|
215239126 |
50re |
A |
July 23, 2023, 4:18 p.m. |
OK |
Scala |
TESTS |
10 |
514 |
0 |
|
|
remove filters
Back to search problems