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'Polycarp found on the street an array a of n elements. Polycarp invented his criterion for the beauty of an array. He calls an array a beautiful if at least one of the following conditions must be met for each different pair of indices i ne j : For example, if: Ugly arrays upset Polycarp, so he wants to remove some elements from the array a so that it becomes beautiful. Help Polycarp determine the smallest number of elements to remove to make the array a beautiful. The first line contains one integer t ( 1 <= q t <= q 10 ) -- the number of test cases. Then t test cases follow. The first line of each test case contains one integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n numbers a_1, a_2, ldots, a_n ( 1 <= a_i <= 2 cdot 10^5 ) -- elements of the array a . For each test case output one integer -- the minimum number of elements that must be removed to make the array a beautiful. In the first test case, removing 7 and 14 will make array a beautiful. In the second test case, the array a is already beautiful. In the third test case, removing one of the elements 45 or 18 will make the array a beautiful. In the fourth test case, the array a is beautiful. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
105414098 |
ruban |
G |
Jan. 25, 2021, 7:07 p.m. |
OK |
Delphi |
TESTS |
25 |
873 |
27750400 |
|
|
105414228 |
ruban |
G |
Jan. 25, 2021, 7:09 p.m. |
OK |
FPC |
TESTS |
25 |
826 |
27750400 |
|
|
105426414 |
e_e_thinker |
G |
Jan. 25, 2021, 11:57 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
124 |
1638400 |
|
|
105441395 |
_zwx_syx_ |
G |
Jan. 26, 2021, 5:29 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
139 |
1638400 |
|
|
105435005 |
fallleaves01 |
G |
Jan. 26, 2021, 3:43 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
140 |
1638400 |
|
|
105433905 |
LengYun |
G |
Jan. 26, 2021, 3:21 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
218 |
3174400 |
|
|
105427981 |
jiufeng |
G |
Jan. 26, 2021, 12:54 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
343 |
2457600 |
|
|
105435474 |
Smiekids |
G |
Jan. 26, 2021, 3:53 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
358 |
1638400 |
|
|
105409235 |
HappyNewYear |
G |
Jan. 25, 2021, 6:10 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
358 |
2252800 |
|
|
105429935 |
Dreamfarer |
G |
Jan. 26, 2021, 1:52 a.m. |
OK |
GNU C++11 |
TESTS |
25 |
358 |
2457600 |
|
|
105410892 |
Protagonist |
G |
Jan. 25, 2021, 6:28 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
374 |
1638400 |
|
|
105426110 |
luogu_bot4 |
G |
Jan. 25, 2021, 11:46 p.m. |
OK |
GNU C++11 |
TESTS |
25 |
374 |
6451200 |
|
|
105433740 |
dittoxff |
G |
Jan. 26, 2021, 3:18 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
467 |
2457600 |
|
|
105417181 |
noobiesAG |
G |
Jan. 25, 2021, 7:57 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
467 |
10240000 |
|
|
105434420 |
prateek3110 |
G |
Jan. 26, 2021, 3:31 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
468 |
30720000 |
|
|
105431936 |
GigaM |
G |
Jan. 26, 2021, 2:42 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
483 |
819200 |
|
|
105420175 |
gerard.onats |
G |
Jan. 25, 2021, 8:55 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
483 |
1638400 |
|
|
105421047 |
sadbubbles |
G |
Jan. 25, 2021, 9:15 p.m. |
OK |
GNU C++14 |
TESTS |
25 |
498 |
819200 |
|
|
105436144 |
LcdmDzw |
G |
Jan. 26, 2021, 4:06 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
499 |
1638400 |
|
|
105435170 |
RHliu |
G |
Jan. 26, 2021, 3:46 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
499 |
1638400 |
|
|
105428235 |
huangxiaohua |
G |
Jan. 26, 2021, 1:02 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
514 |
819200 |
|
|
105436229 |
kaiyrkhan7 |
G |
Jan. 26, 2021, 4:07 a.m. |
OK |
GNU C++14 |
TESTS |
25 |
514 |
1638400 |
|
|
105408210 |
MADKIRUS |
G |
Jan. 25, 2021, 6 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
467 |
9216000 |
|
|
105440705 |
mayankroy |
G |
Jan. 26, 2021, 5:20 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
498 |
10137600 |
|
|
105402768 |
swimmerstar |
G |
Jan. 25, 2021, 5:18 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
499 |
1638400 |
|
|
105428000 |
142 |
G |
Jan. 26, 2021, 12:54 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
499 |
2457600 |
|
|
105444274 |
Altair_Vega |
G |
Jan. 26, 2021, 6:04 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
514 |
1638400 |
|
|
105431126 |
takesummer |
G |
Jan. 26, 2021, 2:24 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
514 |
1638400 |
|
|
105424716 |
Naderr |
G |
Jan. 25, 2021, 10:57 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
514 |
1638400 |
|
|
105417562 |
MvKaio |
G |
Jan. 25, 2021, 8:04 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
514 |
2457600 |
|
|
105415910 |
pikel_rik |
G |
Jan. 25, 2021, 7:34 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
514 |
2457600 |
|
|
105412765 |
inzamam_inz |
G |
Jan. 25, 2021, 6:50 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
514 |
2457600 |
|
|
105403474 |
iamnifer |
G |
Jan. 25, 2021, 5:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
108 |
5836800 |
|
|
105403658 |
cjoa |
G |
Jan. 25, 2021, 5:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
311 |
4096000 |
|
|
105425481 |
Juvitus |
G |
Jan. 25, 2021, 11:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
326 |
1638400 |
|
|
105425865 |
fakhoury |
G |
Jan. 25, 2021, 11:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
819200 |
|
|
105419934 |
kaiboy |
G |
Jan. 25, 2021, 8:49 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
1638400 |
|
|
105413024 |
_Bohemian |
G |
Jan. 25, 2021, 6:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
3891200 |
|
|
105442591 |
Soulman |
G |
Jan. 26, 2021, 5:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
327 |
4096000 |
|
|
105439011 |
tushar2805 |
G |
Jan. 26, 2021, 4:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
4096000 |
|
|
105438529 |
Continued_Story |
G |
Jan. 26, 2021, 4:49 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
4096000 |
|
|
105422887 |
sjay05 |
G |
Jan. 25, 2021, 10:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
327 |
4096000 |
|
|
105404159 |
nick_301 |
G |
Jan. 25, 2021, 5:27 p.m. |
OK |
Java 11 |
TESTS |
25 |
592 |
204800 |
|
|
105424122 |
0c00l |
G |
Jan. 25, 2021, 10:39 p.m. |
OK |
Java 11 |
TESTS |
25 |
623 |
1843200 |
|
|
105418141 |
Apass.Jack |
G |
Jan. 25, 2021, 8:14 p.m. |
OK |
Java 11 |
TESTS |
25 |
639 |
204800 |
|
|
105438357 |
Restricted |
G |
Jan. 26, 2021, 4:46 a.m. |
OK |
Java 11 |
TESTS |
25 |
1824 |
40448000 |
|
|
105424930 |
jamesfan961101 |
G |
Jan. 25, 2021, 11:05 p.m. |
OK |
Java 11 |
TESTS |
25 |
2371 |
512000 |
|
|
105402408 |
Apfeloxid |
G |
Jan. 25, 2021, 5:16 p.m. |
OK |
Java 11 |
TESTS |
25 |
2371 |
92160000 |
|
|
105430474 |
anhpp |
G |
Jan. 26, 2021, 2:08 a.m. |
OK |
Java 11 |
TESTS |
25 |
2792 |
2048000 |
|
|
105420640 |
jaynils |
G |
Jan. 25, 2021, 9:05 p.m. |
OK |
Java 11 |
TESTS |
25 |
3415 |
8089600 |
|
|
105420892 |
an09mous |
G |
Jan. 25, 2021, 9:12 p.m. |
OK |
Java 8 |
TESTS |
25 |
842 |
8396800 |
|
|
105428821 |
ReynellQ |
G |
Jan. 26, 2021, 1:19 a.m. |
OK |
Java 8 |
TESTS |
25 |
873 |
20684800 |
|
|
105414041 |
flyman3046 |
G |
Jan. 25, 2021, 7:06 p.m. |
OK |
Java 8 |
TESTS |
25 |
1590 |
87244800 |
|
|
105433790 |
reennn |
G |
Jan. 26, 2021, 3:19 a.m. |
OK |
Java 8 |
TESTS |
25 |
4117 |
6246400 |
|
|
105429338 |
Spheniscine |
G |
Jan. 26, 2021, 1:34 a.m. |
OK |
Kotlin |
TESTS |
25 |
483 |
2150400 |
|
|
105442527 |
Spheniscine |
G |
Jan. 26, 2021, 5:43 a.m. |
OK |
Kotlin |
TESTS |
38 |
608 |
2150400 |
|
|
105429143 |
Spheniscine |
G |
Jan. 26, 2021, 1:27 a.m. |
OK |
Kotlin |
TESTS |
25 |
1185 |
39833600 |
|
|
105428693 |
Spheniscine |
G |
Jan. 26, 2021, 1:15 a.m. |
OK |
Kotlin |
TESTS |
25 |
1419 |
39833600 |
|
|
105405017 |
Scotty_pwnz |
G |
Jan. 25, 2021, 5:33 p.m. |
OK |
Kotlin |
TESTS |
25 |
1684 |
20070400 |
|
|
105428575 |
Spheniscine |
G |
Jan. 26, 2021, 1:12 a.m. |
OK |
Kotlin |
TESTS |
25 |
2839 |
39731200 |
|
|
105428825 |
Spheniscine |
G |
Jan. 26, 2021, 1:19 a.m. |
OK |
Kotlin |
TESTS |
25 |
2932 |
2150400 |
|
|
105413270 |
LeoPro |
G |
Jan. 25, 2021, 6:56 p.m. |
OK |
Kotlin |
TESTS |
25 |
3135 |
23859200 |
|
|
105413210 |
LeoPro |
G |
Jan. 25, 2021, 6:55 p.m. |
OK |
Kotlin |
TESTS |
25 |
3587 |
23859200 |
|
|
105419655 |
Gleb_Dubosarskii |
G |
Jan. 25, 2021, 8:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
1809 |
4812800 |
|
|
105404599 |
Gravekper |
G |
Jan. 25, 2021, 5:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
25 |
4149 |
1638400 |
|
|
105421844 |
beethoven97 |
G |
Jan. 25, 2021, 9:35 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
717 |
28979200 |
|
|
105413135 |
rishabnahar2025 |
G |
Jan. 25, 2021, 6:55 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
1559 |
93286400 |
|
|
105420396 |
beethoven97 |
G |
Jan. 25, 2021, 8:59 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
2527 |
52121600 |
|
|
105421810 |
beethoven97 |
G |
Jan. 25, 2021, 9:34 p.m. |
OK |
PyPy 2 |
TESTS |
25 |
2869 |
63385600 |
|
|
105425360 |
atzhh |
G |
Jan. 25, 2021, 11:19 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
670 |
60211200 |
|
|
105425444 |
atzhh |
G |
Jan. 25, 2021, 11:22 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
686 |
58880000 |
|
|
105416260 |
sh1194 |
G |
Jan. 25, 2021, 7:41 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
686 |
60313600 |
|
|
105425303 |
atzhh |
G |
Jan. 25, 2021, 11:17 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
748 |
59289600 |
|
|
105430150 |
mkawa2 |
G |
Jan. 26, 2021, 1:58 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
748 |
99328000 |
|
|
105441748 |
coder_sounak |
G |
Jan. 26, 2021, 5:33 a.m. |
OK |
PyPy 3 |
TESTS |
25 |
889 |
69734400 |
|
|
105421665 |
ding_don_dino |
G |
Jan. 25, 2021, 9:30 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
998 |
65024000 |
|
|
105425265 |
atzhh |
G |
Jan. 25, 2021, 11:15 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1013 |
59699200 |
|
|
105419849 |
shubh_doshi |
G |
Jan. 25, 2021, 8:47 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1091 |
58572800 |
|
|
105419547 |
WxYzAbCd |
G |
Jan. 25, 2021, 8:41 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1091 |
58572800 |
|
|
105435561 |
satylogin |
G |
Jan. 26, 2021, 3:54 a.m. |
OK |
Rust |
TESTS |
25 |
482 |
24780800 |
|
|
105417243 |
professor-flux |
G |
Jan. 25, 2021, 7:58 p.m. |
OK |
Rust |
TESTS |
25 |
1544 |
76595200 |
|
|
105406957 |
43flyingcar |
G |
Jan. 25, 2021, 5:48 p.m. |
OK |
Rust |
TESTS |
25 |
3540 |
77312000 |
|
|
remove filters
Back to search problems