Pinely Round 5 (Div. 1 + Div. 2)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2161 Pinely Round 5 (Div. 1 + Div. 2) FINISHED False 10800 14563523 Oct. 30, 2025, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2752 ) D Locked Out PROGRAMMING binary search data structures dp graphs greedy implementation two pointers

An array (b) is good if there do not exist indices (1 \leq i < j \leq |b|) such that (b_j - b_i = 1). You are given an integer. array (a_1, a_2, \ldots, a_n). Determine the minimum number of elements that need to be removed from the given array so that it becomes a good array. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 6 \cdot 10^4)). The description of the test cases follows. The first line of each test case contains an integer (n) ((1 \leq n \leq 3 \cdot 10^5)) — the number of elements in the array. The second line of each test case contains (n) integers (a_1), (a_2), (\ldots), (a_n) ((1 \leq a_i \leq n)) — the elements of the array. It is guaranteed that the sum of (n) over all test cases does not exceed (3 \cdot 10^5). For each test case, print a single integer — the minimum number of elements that need to be removed from the array to make it a good array. In the first test case, the array is good from the very beginning, so nothing needs to be removed from it. In the second test case, the optimal solution is to remove the second and fourth elements of the array, which will result in (1), (3), (5) array. In the third test case, the array is good from the very beginning. In the fourth test case, the array is good from the very beginning. In the fifth test case, the optimal solution is to remove the fourth element of the array, which will result in (1), (7), (1), (5), (7), (1) array. In the sixth test case, one of the optimal solutions is to remove the first and fourth elements of the array, which will result in (2), (5), (5), (5) array.

Tutorials

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
346718380 Axoryn D Oct. 30, 2025, 6:32 p.m. OK C# 13 TESTS 30 405 74035200
346741299 MMG101 D Oct. 30, 2025, 9 p.m. OK C++17 (GCC 7-32) TESTS 30 140 3686400
346769963 CerCer D Oct. 31, 2025, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 30 155 6041600
346738070 Kaitokid D Oct. 30, 2025, 8:21 p.m. OK C++17 (GCC 7-32) TESTS 30 155 22528000
346745681 GunDone D Oct. 30, 2025, 10:14 p.m. OK C++17 (GCC 7-32) TESTS 30 156 921600
346732589 Kustov_Vadim_533 D Oct. 30, 2025, 7:29 p.m. OK C++17 (GCC 7-32) TESTS 30 171 5939200
346733885 hpqclab D Oct. 30, 2025, 7:33 p.m. OK C++17 (GCC 7-32) TESTS 30 171 6348800
346766745 szcQAQ D Oct. 31, 2025, 4:43 a.m. OK C++17 (GCC 7-32) TESTS 30 171 7168000
346729477 lfe D Oct. 30, 2025, 7:16 p.m. OK C++17 (GCC 7-32) TESTS 30 171 8499200
346749744 alextigau D Oct. 30, 2025, 11:57 p.m. OK C++17 (GCC 7-32) TESTS 30 186 4812800
346753061 Tianyi_lemon D Oct. 31, 2025, 1:21 a.m. OK C++17 (GCC 7-32) TESTS 30 187 5939200
346737521 ManasaLGM D Oct. 30, 2025, 8:15 p.m. OK C++20 (GCC 13-64) TESTS 30 93 2150400
346728273 MaiDoan D Oct. 30, 2025, 7:11 p.m. OK C++20 (GCC 13-64) TESTS 30 109 1024000
346720421 Mirali777 D Oct. 30, 2025, 6:39 p.m. OK C++20 (GCC 13-64) TESTS 30 140 1024000
346761963 toba D Oct. 31, 2025, 3:49 a.m. OK C++20 (GCC 13-64) TESTS 30 140 9728000
346749574 jackylova_fan_fan_fan D Oct. 30, 2025, 11:51 p.m. OK C++20 (GCC 13-64) TESTS 30 140 10035200
346751028 hhhgjyismine D Oct. 31, 2025, 12:31 a.m. OK C++20 (GCC 13-64) TESTS 30 140 11264000
346747745 jiraiya_chan D Oct. 30, 2025, 11:02 p.m. OK C++20 (GCC 13-64) TESTS 30 140 16076800
346728617 Cyb3rBolt_ D Oct. 30, 2025, 7:12 p.m. OK C++20 (GCC 13-64) TESTS 30 155 3686400
346774157 qiqi_0507sinan D Oct. 31, 2025, 6:06 a.m. OK C++20 (GCC 13-64) TESTS 30 155 8806400
346714564 _01010000_ D Oct. 30, 2025, 6:20 p.m. OK C++20 (GCC 13-64) TESTS 30 155 9932800
346756446 hungchi17 D Oct. 31, 2025, 2:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 2252800
346721802 Richard-Dyinman D Oct. 30, 2025, 6:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 124 1126400
346764752 ananthak D Oct. 31, 2025, 4:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 124 9932800
346745462 waszz123456 D Oct. 30, 2025, 10:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 139 8294400
346735818 Fusion15 D Oct. 30, 2025, 7:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 140 10137600
346755125 Hust0518 D Oct. 31, 2025, 2:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 140 10752000
346765183 -Thispro D Oct. 31, 2025, 4:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 155 8908800
346764952 Animesh15Aug D Oct. 31, 2025, 4:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 155 8908800
346736785 cypher57 D Oct. 30, 2025, 8:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 155 14848000
346736332 z_a_t_c_h D Oct. 30, 2025, 8:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 155 14848000
346724065 hollow_knight_25 D Oct. 30, 2025, 6:53 p.m. OK C# 8 TESTS 30 593 86220800
346719271 toroloco D Oct. 30, 2025, 6:35 p.m. OK D TESTS 30 374 41062400
346733157 pengin_2000 D Oct. 30, 2025, 7:31 p.m. OK GNU C11 TESTS 30 187 9728000
346732508 __gRati__ D Oct. 30, 2025, 7:28 p.m. OK GNU C11 TESTS 30 342 6041600
346720342 arvind_pathak D Oct. 30, 2025, 6:39 p.m. OK GNU C11 TESTS 30 421 46489600
346721832 uffhottie D Oct. 30, 2025, 6:45 p.m. OK Go TESTS 30 171 33996800
346718836 gautam577 D Oct. 30, 2025, 6:34 p.m. OK Go TESTS 30 343 46592000
346716548 ADISH18 D Oct. 30, 2025, 6:26 p.m. OK Java 21 TESTS 30 280 1126400
346752950 kartik__sethi D Oct. 31, 2025, 1:18 a.m. OK Java 21 TESTS 30 577 54784000
346726793 sahasrad D Oct. 30, 2025, 7:05 p.m. OK Java 21 TESTS 30 624 55398400
346728463 lyongwolf D Oct. 30, 2025, 7:12 p.m. OK Java 21 TESTS 30 687 43724800
346714452 AnimeshT1008 D Oct. 30, 2025, 6:20 p.m. OK Java 21 TESTS 30 733 85606400
346724029 nabina1395 D Oct. 30, 2025, 6:53 p.m. OK Java 21 TESTS 30 781 80998400
346715414 MBBN D Oct. 30, 2025, 6:23 p.m. OK Java 21 TESTS 30 827 86016000
346712644 anshwww D Oct. 30, 2025, 6:14 p.m. OK Java 21 TESTS 30 859 132505600
346712768 dhroovs D Oct. 30, 2025, 6:14 p.m. OK Java 21 TESTS 30 889 94720000
346730010 D_Cod3r D Oct. 30, 2025, 7:18 p.m. OK Java 21 TESTS 30 1077 108339200
346739871 Samyajit125 D Oct. 30, 2025, 8:41 p.m. OK Java 8 TESTS 30 203 13516800
346745333 gua069 D Oct. 30, 2025, 10:07 p.m. OK Java 8 TESTS 30 389 40755200
346773209 Naamani D Oct. 31, 2025, 5:56 a.m. OK Java 8 TESTS 30 983 67584000
346715160 Akshatgupta069_069 D Oct. 30, 2025, 6:22 p.m. OK Java 8 TESTS 30 999 163328000
346747915 minuki646 D Oct. 30, 2025, 11:06 p.m. OK PyPy 3-64 TESTS 30 296 51814400
346757915 RobinFromTheHood D Oct. 31, 2025, 2:52 a.m. OK PyPy 3-64 TESTS 30 327 39321600
346747323 DT4V D Oct. 30, 2025, 10:52 p.m. OK PyPy 3-64 TESTS 30 327 55398400
346730111 kazu_tech D Oct. 30, 2025, 7:19 p.m. OK PyPy 3-64 TESTS 30 515 51916800
346756581 stan23456 D Oct. 31, 2025, 2:29 a.m. OK PyPy 3-64 TESTS 30 515 64102400
346729105 law_n_ordnance D Oct. 30, 2025, 7:14 p.m. OK PyPy 3-64 TESTS 30 562 58572800
346715658 JaswanNth7 D Oct. 30, 2025, 6:23 p.m. OK PyPy 3-64 TESTS 30 593 69427200
346736897 Surin D Oct. 30, 2025, 8:09 p.m. OK PyPy 3-64 TESTS 30 593 75366400
346720119 hsankhat099 D Oct. 30, 2025, 6:38 p.m. OK PyPy 3-64 TESTS 30 640 85196800
346732775 zgennn D Oct. 30, 2025, 7:29 p.m. OK PyPy 3-64 TESTS 30 656 94310400
346729280 rashadkerimov2022 D Oct. 30, 2025, 7:15 p.m. OK Python 3 TESTS 30 530 39628800
346726557 wasem15 D Oct. 30, 2025, 7:04 p.m. OK Python 3 TESTS 30 609 73830400
346718282 pkrcode D Oct. 30, 2025, 6:32 p.m. OK Python 3 TESTS 30 1500 166092800
346724648 Dilha_1526 D Oct. 30, 2025, 6:56 p.m. OK Ruby 3 TESTS 30 1109 120115200
346713245 darkkcyan D Oct. 30, 2025, 6:16 p.m. OK Rust 2024 TESTS 30 233 33894400

remove filters

Back to search problems