Educational Codeforces Round 180 (Rated for 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
2112 Educational Codeforces Round 180 (Rated for Div. 2) FINISHED False 7200 25716323 June 23, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20984 ) B Shrinking Array PROGRAMMING brute force greedy

Let's call an array (b) beautiful if it consists of at least two elements and there exists a position (i) such that (|b_i - b_{i + 1}| \le 1) (where (|x|) is the absolute value of (x)). You are given an array (a), and as long as it consists of at least two elements, you can perform the following operation: Choose two adjacent positions (i) and (i + 1) in the array (a). Choose an integer (x) such that (\min(a_i, a_{i + 1}) \le x \le \max(a_i, a_{i + 1})). Remove the numbers (a_i) and (a_{i + 1}) from the array, and insert the number (x) in their place. Obviously, the size of the array will decrease by (1). Calculate the minimum number of operations required to make the array beautiful, or report that it is impossible. The first line contains one integer (t) ((1 \le t \le 200)) — the number of test cases. The first line of each test case contains one integer (n) ((2 \le n \le 1000)) — the size of the array (a). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 10^6)) — the array (a) itself. For each test case, output one integer — the minimum number of operations needed to make the array (a) beautiful, or (-1) if it is impossible to make it beautiful. In the first test case, the given array is already beautiful, as (|a_2 - a_3| = |3 - 3| = 0). In the second test case, it is impossible to make the array beautiful, as applying the operation would reduce its size to less than two. In the third test case, you can, for example, choose (a_1) and (a_2) and replace them with the number (2). The resulting array (2, 3, 7) is beautiful. In the fourth test case, you can, for example, choose (a_2) and (a_3) and replace them with the number (3). The resulting array (1, 3, 2) is beautiful.

Tutorials

Educational Codeforces Round 180 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
325911426 remantadin B June 24, 2025, 5:32 p.m. OK C# 13 TESTS 24 171 5222400
325962375 og.kostya B June 25, 2025, 5:55 a.m. OK C# 13 TESTS 24 515 819200
325850041 qianxinyu B June 24, 2025, 12:49 a.m. OK C++17 (GCC 7-32) TESTS 24 62 1126400
325858141 hACkeR__999 B June 24, 2025, 10:49 a.m. OK C++17 (GCC 7-32) TESTS 24 77 0
325844094 ITE-fawzy B June 23, 2025, 9:33 p.m. OK C++17 (GCC 7-32) TESTS 24 77 0
325852070 Nani0583 B June 24, 2025, 9:27 a.m. OK C++17 (GCC 7-32) TESTS 24 77 102400
325957308 nzhou123123 B June 25, 2025, 4:58 a.m. OK C++17 (GCC 7-32) TESTS 24 78 0
325948581 s1mply B June 25, 2025, 2:47 a.m. OK C++17 (GCC 7-32) TESTS 24 78 0
325928865 BackTrackBeast B June 24, 2025, 8:27 p.m. OK C++17 (GCC 7-32) TESTS 24 78 0
325951104 _yjhhh B June 25, 2025, 3:24 a.m. OK C++17 (GCC 7-32) TESTS 24 78 102400
325948075 wujijlc B June 25, 2025, 2:40 a.m. OK C++17 (GCC 7-32) TESTS 24 78 102400
325944361 vivekshamraofalke19 B June 25, 2025, 1:20 a.m. OK C++17 (GCC 7-32) TESTS 24 78 102400
325937219 Sekharr B June 24, 2025, 9:38 p.m. OK C++20 (GCC 13-64) TESTS 24 62 0
325858782 kusacster B June 24, 2025, 10:54 a.m. OK C++20 (GCC 13-64) TESTS 24 62 2662400
325960604 N1664 B June 25, 2025, 5:36 a.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325946114 Andyqian7 B June 25, 2025, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325939626 NILIKONIKOM B June 24, 2025, 10:44 p.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325926398 Prashant_Tak B June 24, 2025, 7:52 p.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325915329 Jameel_l B June 24, 2025, 6 p.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325907293 RohanCP B June 24, 2025, 4:59 p.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325860807 miyan1221 B June 24, 2025, 11:11 a.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325852651 thesahilkr B June 24, 2025, 9:36 a.m. OK C++20 (GCC 13-64) TESTS 24 77 0
325956992 Mindoongie B June 25, 2025, 4:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 62 102400
325937848 BorisAssassin007 B June 24, 2025, 9:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 62 102400
325898889 C550 B June 24, 2025, 4:01 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 62 307200
325939728 akramzaabi7 B June 24, 2025, 10:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 0
325939225 -Kaizer- B June 24, 2025, 10:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 0
325925437 farhan_s_a B June 24, 2025, 7:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 0
325915620 factozpedia B June 24, 2025, 6:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 0
325962593 useyourbrain B June 25, 2025, 5:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 102400
325962107 silk_road B June 25, 2025, 5:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 102400
325958183 LAKSHIT_LAVANYA_KUMAR B June 25, 2025, 5:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 77 102400
325903989 NenadDapic B June 24, 2025, 4:36 p.m. OK FPC TESTS 24 109 4096000
325945274 IseriNina27 B June 25, 2025, 1:43 a.m. OK GNU C11 TESTS 24 77 102400
325915233 monish1406 B June 24, 2025, 5:59 p.m. OK GNU C11 TESTS 24 77 102400
325892178 legacy45 B June 24, 2025, 3:16 p.m. OK GNU C11 TESTS 24 92 102400
325912584 sad10001 B June 24, 2025, 5:40 p.m. OK GNU C11 TESTS 24 312 921600
325857738 IseriNina27 B June 24, 2025, 10:45 a.m. OK GNU C11 TESTS 24 342 102400
325858938 triperci B June 24, 2025, 10:55 a.m. OK Go TESTS 24 124 3481600
325955679 ArcaStellar B June 25, 2025, 4:35 a.m. OK Haskell TESTS 24 671 204800
325907801 hemant B June 24, 2025, 5:03 p.m. OK Java 21 TESTS 24 249 614400
325831682 akshat.codes B June 23, 2025, 6:26 p.m. OK Java 21 TESTS 24 296 1536000
325891299 venkatesh7779 B June 24, 2025, 3:10 p.m. OK Java 21 TESTS 24 296 1843200
325915964 Harshu_001 B June 24, 2025, 6:05 p.m. OK Java 21 TESTS 24 312 819200
325903776 Kakarot_DB B June 24, 2025, 4:35 p.m. OK Java 21 TESTS 24 312 819200
325953950 Imposter__S B June 25, 2025, 4:08 a.m. OK Java 21 TESTS 24 312 921600
325836550 oberoiansh899 B June 23, 2025, 7:17 p.m. OK Java 21 TESTS 24 327 1638400
325891450 __Aviral__ B June 24, 2025, 3:11 p.m. OK Java 21 TESTS 24 343 614400
325905143 vinay_panwar B June 24, 2025, 4:44 p.m. OK Java 21 TESTS 24 343 921600
325831449 rakshitsingh333 B June 23, 2025, 6:24 p.m. OK Java 21 TESTS 24 343 1126400
325845247 adibhai0845R B June 23, 2025, 10:01 p.m. OK Java 8 TESTS 24 186 0
325830524 navin.ganji B June 23, 2025, 6:17 p.m. OK Java 8 TESTS 24 187 0
325920857 aryangupta1604 B June 24, 2025, 6:46 p.m. OK Java 8 TESTS 24 202 0
325842742 Sumitsingh7 B June 23, 2025, 9:03 p.m. OK Java 8 TESTS 24 296 6963200
325952834 ..pk B June 25, 2025, 3:50 a.m. OK Java 8 TESTS 24 405 0
325952991 yashbansal99 B June 25, 2025, 3:53 a.m. OK Java 8 TESTS 24 406 0
325825446 yaswanth_coder B June 23, 2025, 5:37 p.m. OK Java 8 TESTS 24 421 0
325891159 naman_9045 B June 24, 2025, 3:09 p.m. OK Java 8 TESTS 24 437 0
325839218 Divyanshu_Lila B June 23, 2025, 7:59 p.m. OK Java 8 TESTS 24 437 0
325837732 ABHIRAM2005 B June 23, 2025, 7:35 p.m. OK Java 8 TESTS 24 437 0
325826474 jagbarrameda B June 23, 2025, 5:45 p.m. OK Kotlin 1.9 TESTS 24 249 409600
325897961 L-S-S B June 24, 2025, 3:54 p.m. OK Kotlin 1.9 TESTS 24 265 307200
325820505 _Zuno_ B June 23, 2025, 5:03 p.m. OK Node.js TESTS 24 171 6451200
325912756 jvhaa B June 24, 2025, 5:42 p.m. OK PyPy 3 TESTS 24 265 8192000
325842618 QBit_Enigma B June 23, 2025, 9 p.m. OK PyPy 3 TESTS 24 280 7987200
325836621 gopikrishna9968 B June 23, 2025, 7:18 p.m. OK PyPy 3 TESTS 24 280 8192000
325894300 kevin_kaslanna B June 24, 2025, 3:30 p.m. OK PyPy 3 TESTS 24 281 7884800
325929798 Raffas B June 24, 2025, 8:41 p.m. OK PyPy 3 TESTS 24 281 8089600
325910170 ArtistByDay_LokiByNight B June 24, 2025, 5:22 p.m. OK PyPy 3 TESTS 24 296 8294400
325928967 SilentRegime B June 24, 2025, 8:28 p.m. OK PyPy 3-64 TESTS 24 109 5734400
325840565 lp__ B June 23, 2025, 8:23 p.m. OK PyPy 3-64 TESTS 24 109 5939200
325963352 maharaja B June 25, 2025, 6:05 a.m. OK PyPy 3-64 TESTS 24 109 6246400
325894611 shubham6105 B June 24, 2025, 3:32 p.m. OK PyPy 3-64 TESTS 24 109 6246400
325844479 samchen123 B June 23, 2025, 9:42 p.m. OK PyPy 3-64 TESTS 24 109 6553600
325825201 MathPerson12321 B June 23, 2025, 5:35 p.m. OK PyPy 3-64 TESTS 24 124 4915200
325921481 anton57 B June 24, 2025, 6:53 p.m. OK PyPy 3-64 TESTS 24 124 5222400
325896481 minuki646 B June 24, 2025, 3:45 p.m. OK PyPy 3-64 TESTS 24 124 5529600
325955722 imprayas12 B June 25, 2025, 4:36 a.m. OK PyPy 3-64 TESTS 24 124 5734400
325844663 Bibek_06 B June 23, 2025, 9:47 p.m. OK PyPy 3-64 TESTS 24 124 5734400
325898914 raspavel B June 24, 2025, 4:01 p.m. OK Python 3 TESTS 24 124 1433600
325833825 soundarzozm B June 23, 2025, 6:46 p.m. OK Python 3 TESTS 24 140 1126400
325923804 Jfry03 B June 24, 2025, 7:20 p.m. OK Python 3 TESTS 24 140 1331200
325859008 Hemanth_Bommadi B June 24, 2025, 10:56 a.m. OK Python 3 TESTS 24 140 1331200
325837490 Shivani_02_01 B June 23, 2025, 7:32 p.m. OK Python 3 TESTS 24 156 1228800
325959549 Aashish_Jha B June 25, 2025, 5:24 a.m. OK Python 3 TESTS 24 171 1126400
325925378 V1_Forces7Y7 B June 24, 2025, 7:40 p.m. OK Python 3 TESTS 24 171 1126400
325837669 Dylanzhou B June 23, 2025, 7:34 p.m. OK Python 3 TESTS 24 171 1126400
325826953 sKyUser0 B June 23, 2025, 5:49 p.m. OK Python 3 TESTS 24 171 1126400
325838641 Emikooh B June 23, 2025, 7:49 p.m. OK Python 3 TESTS 24 171 1228800
325852648 DanielAnker B June 24, 2025, 9:36 a.m. OK Rust 2021 TESTS 24 62 102400
325846826 DeanMenezes3 B June 23, 2025, 10:54 p.m. OK Rust 2021 TESTS 24 62 102400
325945482 qqqqc B June 25, 2025, 1:50 a.m. OK Rust 2021 TESTS 24 78 0

remove filters

Back to search problems