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'Tenzing has n balls arranged in a line. The color of the i -th ball from the left is a_i . Tenzing can do the following operation any number of times: Tenzing wants to know the maximum number of balls he can remove. Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. The description of test cases follows. The first line contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the number of balls. The second line contains n integers a_1,a_2, ldots,a_n ( 1 <= q a_i <= q n ) -- the color of the balls. It is guaranteed that sum of n of all test cases will not exceed 2 cdot 10^5 . For each test case, output the maximum number of balls Tenzing can remove. In the first example, Tenzing will choose i=2 and j=3 in the first operation so that a=[1,3,3] . Then Tenzing will choose i=2 and j=3 again in the second operation so that a=[1] . So Tenzing can remove 4 balls in total. In the second example, Tenzing will choose i=1 and j=3 in the first and only operation so that a=[2] . So Tenzing can remove 3 balls in total. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
210940538 |
adi854105 |
C |
June 24, 2023, 4:26 p.m. |
OK |
C# 10 |
TESTS |
91 |
342 |
47923200 |
|
|
210978234 |
Sol1 |
C |
June 25, 2023, 12:10 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
31 |
4505600 |
|
|
210938052 |
pengyule |
C |
June 24, 2023, 4:17 p.m. |
OK |
GNU C++14 |
TESTS |
91 |
31 |
7372800 |
|
|
210978593 |
Unari |
C |
June 25, 2023, 12:20 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
61 |
2457600 |
|
|
210947032 |
aps2003 |
C |
June 24, 2023, 4:52 p.m. |
OK |
GNU C++14 |
TESTS |
91 |
62 |
1638400 |
|
|
210990750 |
lbntxdy |
C |
June 25, 2023, 5:17 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
62 |
2457600 |
|
|
210981806 |
Zhddd_ |
C |
June 25, 2023, 1:52 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
62 |
2457600 |
|
|
210980343 |
shao_h_y |
C |
June 25, 2023, 1:11 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
62 |
2457600 |
|
|
210979588 |
sacave |
C |
June 25, 2023, 12:51 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
62 |
2457600 |
|
|
210937607 |
Warinchai_s |
C |
June 24, 2023, 4:16 p.m. |
OK |
GNU C++14 |
TESTS |
91 |
62 |
2457600 |
|
|
210986244 |
guan0923 |
C |
June 25, 2023, 3:44 a.m. |
OK |
GNU C++14 |
TESTS |
95 |
62 |
2560000 |
|
|
210977105 |
Eftekhar_Nahim |
C |
June 24, 2023, 11:37 p.m. |
OK |
GNU C++17 |
TESTS |
95 |
62 |
819200 |
|
|
210959877 |
Pupil_12 |
C |
June 24, 2023, 6:49 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
62 |
921600 |
|
|
210990649 |
Jabed_Iqbal_Joy |
C |
June 25, 2023, 5:15 a.m. |
OK |
GNU C++17 |
TESTS |
95 |
62 |
1740800 |
|
|
210963092 |
shmel1k |
C |
June 24, 2023, 7:26 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
62 |
1740800 |
|
|
210958168 |
vermastra |
C |
June 24, 2023, 6:31 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
62 |
1740800 |
|
|
210955835 |
priyanshu_raj |
C |
June 24, 2023, 6:12 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
62 |
1740800 |
|
|
210957699 |
_SIR_ |
C |
June 24, 2023, 6:27 p.m. |
OK |
GNU C++17 |
TESTS |
93 |
62 |
2355200 |
|
|
210954070 |
Muhammad_Alparslan |
C |
June 24, 2023, 6:01 p.m. |
OK |
GNU C++17 |
TESTS |
91 |
62 |
2355200 |
|
|
210937362 |
oni-chan |
C |
June 24, 2023, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
91 |
62 |
2355200 |
|
|
210988720 |
JellyBoi |
C |
June 25, 2023, 4:38 a.m. |
OK |
GNU C++17 |
TESTS |
95 |
62 |
2457600 |
|
|
210990461 |
The5threich |
C |
June 25, 2023, 5:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210983584 |
Once_I_Liked_AGirl |
C |
June 25, 2023, 2:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210934896 |
BLUE_6 |
C |
June 24, 2023, 4:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
91 |
46 |
1638400 |
|
|
210967142 |
Raven__57 |
C |
June 24, 2023, 8:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
93 |
46 |
2355200 |
|
|
210992288 |
tan1shqc |
C |
June 25, 2023, 5:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
95 |
46 |
2457600 |
|
|
210980637 |
Kinuru |
C |
June 25, 2023, 1:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
95 |
46 |
2457600 |
|
|
210961959 |
YisrT3 |
C |
June 24, 2023, 7:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
93 |
46 |
2457600 |
|
|
210954507 |
yh11 |
C |
June 24, 2023, 6:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
91 |
46 |
2457600 |
|
|
210993108 |
ritik_patel05 |
C |
June 25, 2023, 5:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
95 |
46 |
3174400 |
|
|
210941707 |
Guuber |
C |
June 24, 2023, 4:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
91 |
46 |
4608000 |
|
|
210989538 |
Lushaojie |
C |
June 25, 2023, 4:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210989533 |
register2601 |
C |
June 25, 2023, 4:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210989049 |
Penguin07 |
C |
June 25, 2023, 4:45 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210988039 |
martins |
C |
June 25, 2023, 4:23 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210987626 |
Lazy.JPG |
C |
June 25, 2023, 4:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210987269 |
XiCen |
C |
June 25, 2023, 4:06 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210984059 |
Aicu |
C |
June 25, 2023, 2:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210979818 |
flyfeng |
C |
June 25, 2023, 12:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
95 |
46 |
1638400 |
|
|
210969379 |
mcuadros |
C |
June 24, 2023, 8:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
94 |
46 |
1638400 |
|
|
210969077 |
yangster67 |
C |
June 24, 2023, 8:47 p.m. |
OK |
GNU C++20 (64) |
TESTS |
94 |
46 |
1638400 |
|
|
210989654 |
cill |
C |
June 25, 2023, 4:57 a.m. |
OK |
Go |
TESTS |
95 |
140 |
14438400 |
|
|
210969460 |
venkateshaprabhu |
C |
June 24, 2023, 8:53 p.m. |
OK |
Java 11 |
TESTS |
94 |
234 |
13926400 |
|
|
210972104 |
dualthread |
C |
June 24, 2023, 9:37 p.m. |
OK |
Java 11 |
TESTS |
94 |
326 |
39833600 |
|
|
210956361 |
shojin_pro |
C |
June 24, 2023, 6:16 p.m. |
OK |
Java 11 |
TESTS |
93 |
327 |
17715200 |
|
|
210992246 |
ak363255 |
C |
June 25, 2023, 5:45 a.m. |
OK |
Java 11 |
TESTS |
95 |
343 |
21913600 |
|
|
210960106 |
kasiru_69 |
C |
June 24, 2023, 6:51 p.m. |
OK |
Java 11 |
TESTS |
93 |
343 |
24678400 |
|
|
210950108 |
Krishnan_SK |
C |
June 24, 2023, 5:03 p.m. |
OK |
Java 11 |
TESTS |
91 |
358 |
25497600 |
|
|
210972572 |
-0.1 |
C |
June 24, 2023, 9:47 p.m. |
OK |
Java 11 |
TESTS |
94 |
420 |
0 |
|
|
210946951 |
ttannishh |
C |
June 24, 2023, 4:52 p.m. |
OK |
Java 11 |
TESTS |
91 |
436 |
24985600 |
|
|
210936786 |
ManasR_2003 |
C |
June 24, 2023, 4:13 p.m. |
OK |
Java 17 |
TESTS |
91 |
264 |
42700800 |
|
|
210938845 |
Utsav82 |
C |
June 24, 2023, 4:20 p.m. |
OK |
Java 17 |
TESTS |
91 |
342 |
19148800 |
|
|
210974963 |
Ritik009999 |
C |
June 24, 2023, 10:39 p.m. |
OK |
Java 17 |
TESTS |
95 |
343 |
22118400 |
|
|
210973745 |
LeetCodeforces_Null |
C |
June 24, 2023, 10:12 p.m. |
OK |
Java 17 |
TESTS |
94 |
343 |
22323200 |
|
|
210939957 |
SamyajitDas |
C |
June 24, 2023, 4:24 p.m. |
OK |
Java 17 |
TESTS |
91 |
452 |
41164800 |
|
|
210987144 |
Nanthakumar06 |
C |
June 25, 2023, 4:04 a.m. |
OK |
Java 17 |
TESTS |
95 |
545 |
1024000 |
|
|
210984021 |
abhisamudrala21 |
C |
June 25, 2023, 2:50 a.m. |
OK |
Java 17 |
TESTS |
95 |
561 |
6963200 |
|
|
210956657 |
wizardleen |
C |
June 24, 2023, 6:18 p.m. |
OK |
Java 17 |
TESTS |
93 |
654 |
78848000 |
|
|
210936787 |
Gaurav_Kadian |
C |
June 24, 2023, 4:13 p.m. |
OK |
Java 17 |
TESTS |
91 |
701 |
42803200 |
|
|
210943375 |
Sudhanshu_03 |
C |
June 24, 2023, 4:37 p.m. |
OK |
Java 17 |
TESTS |
91 |
748 |
41164800 |
|
|
210959628 |
Sumitsingh7 |
C |
June 24, 2023, 6:46 p.m. |
OK |
Java 8 |
TESTS |
93 |
155 |
16076800 |
|
|
210947568 |
abhayrajnegi0416 |
C |
June 24, 2023, 4:54 p.m. |
OK |
Java 8 |
TESTS |
91 |
170 |
1843200 |
|
|
210959587 |
Ask3421 |
C |
June 24, 2023, 6:46 p.m. |
OK |
Java 8 |
TESTS |
93 |
170 |
2764800 |
|
|
210959977 |
Ask3421 |
C |
June 24, 2023, 6:50 p.m. |
OK |
Java 8 |
TESTS |
93 |
186 |
1843200 |
|
|
210948248 |
amit_roy |
C |
June 24, 2023, 4:57 p.m. |
OK |
Java 8 |
TESTS |
91 |
187 |
15872000 |
|
|
210949358 |
Ashu2030 |
C |
June 24, 2023, 5:01 p.m. |
OK |
Java 8 |
TESTS |
91 |
233 |
15564800 |
|
|
210949814 |
vatsal_04 |
C |
June 24, 2023, 5:02 p.m. |
OK |
Java 8 |
TESTS |
91 |
343 |
32563200 |
|
|
210953986 |
lj1474 |
C |
June 24, 2023, 5:59 p.m. |
OK |
Java 8 |
TESTS |
91 |
358 |
0 |
|
|
210949045 |
redhair_rs |
C |
June 24, 2023, 5 p.m. |
OK |
Java 8 |
TESTS |
91 |
374 |
30515200 |
|
|
210940096 |
lioeva_niuma |
C |
June 24, 2023, 4:24 p.m. |
OK |
Java 8 |
TESTS |
91 |
451 |
53760000 |
|
|
210938391 |
CMRIT24_20R01A05H3 |
C |
June 24, 2023, 4:18 p.m. |
OK |
MS C++ 2017 |
TESTS |
91 |
202 |
9011200 |
|
|
210942631 |
kl2100030352 |
C |
June 24, 2023, 4:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
91 |
217 |
9011200 |
|
|
210948232 |
CMRIT24_20R01A05E3 |
C |
June 24, 2023, 4:56 p.m. |
OK |
MS C++ 2017 |
TESTS |
91 |
234 |
9011200 |
|
|
210972768 |
elu00 |
C |
June 24, 2023, 9:51 p.m. |
OK |
PyPy 3 |
TESTS |
94 |
264 |
19148800 |
|
|
210949633 |
lol_py |
C |
June 24, 2023, 5:02 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
280 |
17100800 |
|
|
210940400 |
jixingtian |
C |
June 24, 2023, 4:25 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
280 |
23859200 |
|
|
210936564 |
sshs29hanul |
C |
June 24, 2023, 4:12 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
312 |
22732800 |
|
|
210948610 |
PremDeep |
C |
June 24, 2023, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
374 |
30617600 |
|
|
210945300 |
TRAGIC11 |
C |
June 24, 2023, 4:45 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
405 |
21299200 |
|
|
210944235 |
Xiimoon |
C |
June 24, 2023, 4:40 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
405 |
30105600 |
|
|
210946650 |
suvenjagtiani |
C |
June 24, 2023, 4:50 p.m. |
OK |
PyPy 3 |
TESTS |
91 |
420 |
26419200 |
|
|
210966384 |
Kladrr |
C |
June 24, 2023, 8:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
93 |
109 |
18227200 |
|
|
210958926 |
AyuAnchor |
C |
June 24, 2023, 6:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
93 |
124 |
22528000 |
|
|
210953647 |
dipakgupta007 |
C |
June 24, 2023, 5:58 p.m. |
OK |
PyPy 3-64 |
TESTS |
91 |
140 |
22220800 |
|
|
210954558 |
2025 |
C |
June 24, 2023, 6:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
91 |
140 |
23449600 |
|
|
210936232 |
bjy |
C |
June 24, 2023, 4:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
91 |
155 |
22016000 |
|
|
210975079 |
RobinFromTheHood |
C |
June 24, 2023, 10:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
95 |
155 |
25907200 |
|
|
210974651 |
RobinFromTheHood |
C |
June 24, 2023, 10:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
95 |
156 |
25497600 |
|
|
210972954 |
asiad |
C |
June 24, 2023, 9:55 p.m. |
OK |
PyPy 3-64 |
TESTS |
94 |
156 |
26419200 |
|
|
210955477 |
amizhthni |
C |
June 24, 2023, 6:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
91 |
170 |
31129600 |
|
|
210969039 |
Lhohelhohehmm |
C |
June 24, 2023, 8:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
94 |
171 |
25702400 |
|
|
210936470 |
vvrk345 |
C |
June 24, 2023, 4:12 p.m. |
OK |
Python 3 |
TESTS |
91 |
280 |
25088000 |
|
|
210985945 |
jrjay |
C |
June 25, 2023, 3:37 a.m. |
OK |
Python 3 |
TESTS |
95 |
280 |
27852800 |
|
|
210961548 |
shalinimeena465 |
C |
June 24, 2023, 7:07 p.m. |
OK |
Python 3 |
TESTS |
93 |
280 |
28467200 |
|
|
210964494 |
thakur_01 |
C |
June 24, 2023, 7:43 p.m. |
OK |
Python 3 |
TESTS |
93 |
295 |
33689600 |
|
|
210983949 |
DEAD_TCT |
C |
June 25, 2023, 2:48 a.m. |
OK |
Python 3 |
TESTS |
95 |
296 |
27955200 |
|
|
210949736 |
shalinimeena465 |
C |
June 24, 2023, 5:02 p.m. |
OK |
Python 3 |
TESTS |
91 |
312 |
31948800 |
|
|
210992969 |
TruongAnim |
C |
June 25, 2023, 5:57 a.m. |
OK |
Python 3 |
TESTS |
95 |
436 |
49561600 |
|
|
210959774 |
iron_nicko |
C |
June 24, 2023, 6:48 p.m. |
OK |
Python 3 |
TESTS |
93 |
467 |
49664000 |
|
|
210959731 |
NothingButW |
C |
June 24, 2023, 6:47 p.m. |
OK |
Python 3 |
TESTS |
93 |
467 |
49664000 |
|
|
210941067 |
technikhil |
C |
June 24, 2023, 4:28 p.m. |
OK |
Python 3 |
TESTS |
91 |
514 |
59904000 |
|
|
210981792 |
YummyPie |
C |
June 25, 2023, 1:51 a.m. |
OK |
Rust 2021 |
TESTS |
95 |
31 |
7987200 |
|
|
210937597 |
WaterColor2037 |
C |
June 24, 2023, 4:16 p.m. |
OK |
Rust 2021 |
TESTS |
91 |
46 |
6348800 |
|
|
remove filters
Back to search problems