Codeforces Round 1080 (Div. 3)

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
2195 Codeforces Round 1080 (Div. 3) FINISHED False 9000 5238923 Feb. 15, 2026, 2:45 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20166 ) C Dice Roll Sequence PROGRAMMING dp greedy

Consider the following cube (D) where numbers (x) and (7-x) lie on opposite sides : A sequence (b) of integers from (1) to (6) is called a dice roll sequence if it satisfies the following condition: All pairs of adjacent elements lie on adjacent(^{\text{∗}}) sides of the cube. For example, (1,4,2) is a dice roll sequence, while (3,4,6,3) is not because (3) and (4) are not on adjacent sides of the dice. Additionally, (2,2,4) is not a dice roll sequence because (2) and (2) are on the same (not adjacent) side of the dice. Given a sequence (a) of (n) integers from (1) to (6), you can perform the following operation any number of times (possibly zero). Select an index (1 \le i \le n) and an integer (1 \le x \le 6). Then, change the value of (a_i) to (x). Please determine the minimum number of operations required to make (a) a dice roll sequence. (^{\text{∗}})Two sides of the cube (S) and (T) are called adjacent if they share exactly one edge of the cube. Do note that this condition implies (S \neq T) as well. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 3 \cdot 10^5)). The second line of each test case contains (n) integers (a_1,a_2,\ldots,a_n) ((1 \le a_i \le 6)). It is guaranteed that the sum of (n) over all test cases does not exceed (3 \cdot 10^5). For each test case, output the minimum number of operations required to make (a) a dice roll sequence. For the first test case, the sequence (a) is (1,4,2). As this is already a dice roll sequence, the answer is (0). For the second test case, the sequence (a) is (3,4,6,3). Changing exactly one element, you can get (3,\color{red}{5},6,3), which is

Tutorials

Codeforces Round 1080 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
363186320 abdo077 C Feb. 15, 2026, 5:03 p.m. OK C# 10 TESTS 6 109 15667200
363218972 _AhmedElshahat_ C Feb. 15, 2026, 9:58 p.m. OK C++17 (GCC 7-32) TESTS 6 46 0
363217224 amankrdk4 C Feb. 15, 2026, 9:24 p.m. OK C++17 (GCC 7-32) TESTS 6 46 0
363205684 blaknoto C Feb. 15, 2026, 7:03 p.m. OK C++17 (GCC 7-32) TESTS 6 46 0
363188489 yournameis... C Feb. 15, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 6 46 0
363184065 sherif25 C Feb. 15, 2026, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 6 46 0
363184474 Gouqi_0613 C Feb. 15, 2026, 4:59 p.m. OK C++17 (GCC 7-32) TESTS 6 46 1228800
363237677 Phi.x C Feb. 16, 2026, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 6 62 0
363234950 Anuragnirmal C Feb. 16, 2026, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 6 62 0
363233420 arjunpundir C Feb. 16, 2026, 4:30 a.m. OK C++17 (GCC 7-32) TESTS 6 62 0
363232534 nitheeshchowdary26 C Feb. 16, 2026, 4:15 a.m. OK C++17 (GCC 7-32) TESTS 6 62 0
363209516 KrishxKK C Feb. 15, 2026, 7:47 p.m. OK C++20 (GCC 13-64) TESTS 6 46 0
363205754 fregi5 C Feb. 15, 2026, 7:03 p.m. OK C++20 (GCC 13-64) TESTS 6 46 0
363201019 kartiksingh3285 C Feb. 15, 2026, 6:20 p.m. OK C++20 (GCC 13-64) TESTS 6 46 0
363197237 _hskad_ C Feb. 15, 2026, 5:52 p.m. OK C++20 (GCC 13-64) TESTS 6 46 0
363190663 embeddedcoder C Feb. 15, 2026, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 6 46 0
363226824 porzlck C Feb. 16, 2026, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 6 46 1228800
363227623 Socialfox123 C Feb. 16, 2026, 2:29 a.m. OK C++20 (GCC 13-64) TESTS 6 46 2457600
363237175 Mahesh_Pareta C Feb. 16, 2026, 5:24 a.m. OK C++20 (GCC 13-64) TESTS 6 62 0
363235771 Pratap_Dev C Feb. 16, 2026, 5:03 a.m. OK C++20 (GCC 13-64) TESTS 6 62 0
363232945 sunil_patel C Feb. 16, 2026, 4:21 a.m. OK C++20 (GCC 13-64) TESTS 6 62 0
363202858 avakanksh1 C Feb. 15, 2026, 6:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 307200
363235002 George_Rubio C Feb. 16, 2026, 4:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363212111 Blinov_Artemii C Feb. 15, 2026, 8:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363208159 MEDAAA C Feb. 15, 2026, 7:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363203248 Mysteries C Feb. 15, 2026, 6:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363202228 rich_codr C Feb. 15, 2026, 6:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363200615 pranav57 C Feb. 15, 2026, 6:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363199824 ayoooy C Feb. 15, 2026, 6:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363196830 Dark_Wizard_ C Feb. 15, 2026, 5:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363195609 prannvs C Feb. 15, 2026, 5:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 46 0
363193602 harsh_44 C Feb. 15, 2026, 5:28 p.m. OK GNU C11 TESTS 6 46 1228800
363194490 shorna_sage C Feb. 15, 2026, 5:33 p.m. OK GNU C11 TESTS 6 62 1126400
363192931 vaibhavshewale C Feb. 15, 2026, 5:24 p.m. OK GNU C11 TESTS 6 62 1126400
363189813 MaddedekindSig7 C Feb. 15, 2026, 5:11 p.m. OK GNU C11 TESTS 6 62 1228800
363189428 sathvik_reddy_30 C Feb. 15, 2026, 5:11 p.m. OK GNU C11 TESTS 6 78 1126400
363189118 prashant0087 C Feb. 15, 2026, 5:10 p.m. OK GNU C11 TESTS 6 78 1126400
363185706 shswt_cs C Feb. 15, 2026, 5:02 p.m. OK GNU C11 TESTS 6 78 1126400
363184406 divyanshisahu841 C Feb. 15, 2026, 4:59 p.m. OK GNU C11 TESTS 6 78 1126400
363203212 adithivarda_17 C Feb. 15, 2026, 6:38 p.m. OK GNU C11 TESTS 6 93 1126400
363189881 crazy_xt C Feb. 15, 2026, 5:12 p.m. OK GNU C11 TESTS 6 109 1126400
363233157 Kagarii22 C Feb. 16, 2026, 4:26 a.m. OK Go TESTS 6 31 6041600
363197444 BytWizard C Feb. 15, 2026, 5:53 p.m. OK Java 21 TESTS 6 171 512000
363237902 saanikaa C Feb. 16, 2026, 5:34 a.m. OK Java 21 TESTS 6 187 819200
363185109 Anmol_ZEZX C Feb. 15, 2026, 5 p.m. OK Java 21 TESTS 6 203 102400
363201099 raghu2011 C Feb. 15, 2026, 6:21 p.m. OK Java 21 TESTS 6 218 512000
363225842 Tirth_Shresth_ C Feb. 16, 2026, 1:34 a.m. OK Java 21 TESTS 6 218 614400
363225659 Shresth_Tirth C Feb. 16, 2026, 1:27 a.m. OK Java 21 TESTS 6 218 614400
363208785 Kh0909 C Feb. 15, 2026, 7:38 p.m. OK Java 21 TESTS 6 218 614400
363184858 nikogg C Feb. 15, 2026, 5 p.m. OK Java 21 TESTS 6 234 0
363193969 WrongAnswerOnTestCase2 C Feb. 15, 2026, 5:30 p.m. OK Java 21 TESTS 6 234 409600
363187918 PecManO2 C Feb. 15, 2026, 5:07 p.m. OK Java 21 TESTS 6 234 716800
363212082 BINAYAK_HAZRA C Feb. 15, 2026, 8:16 p.m. OK Java 8 TESTS 6 109 0
363227889 ZhangQingze C Feb. 16, 2026, 2:35 a.m. OK Java 8 TESTS 6 140 0
363226684 NeelmaniPandey09 C Feb. 16, 2026, 2:03 a.m. OK Java 8 TESTS 6 328 0
363201599 stavan_d C Feb. 15, 2026, 6:25 p.m. OK Java 8 TESTS 6 359 0
363190686 jayasrishanmathi C Feb. 15, 2026, 5:13 p.m. OK Java 8 TESTS 6 375 0
363187089 kirenvision28 C Feb. 15, 2026, 5:05 p.m. OK Java 8 TESTS 6 375 0
363232581 ashishprajapat C Feb. 16, 2026, 4:15 a.m. OK Java 8 TESTS 6 390 0
363188670 pradyumnchavan9 C Feb. 15, 2026, 5:09 p.m. OK Java 8 TESTS 6 390 0
363185643 MridulRakhecha C Feb. 15, 2026, 5:01 p.m. OK Java 8 TESTS 6 390 0
363185021 jainnishan C Feb. 15, 2026, 5 p.m. OK Java 8 TESTS 6 437 0
363210536 Bulo4kaa C Feb. 15, 2026, 7:59 p.m. OK PyPy 3 TESTS 6 265 17715200
363191377 Daksh_Bole C Feb. 15, 2026, 5:14 p.m. OK PyPy 3 TESTS 6 265 19046400
363212900 ThirdAttempt C Feb. 15, 2026, 8:26 p.m. OK PyPy 3 TESTS 6 265 23756800
363184257 ujjwaladitya01 C Feb. 15, 2026, 4:58 p.m. OK PyPy 3 TESTS 6 328 18944000
363189158 qs3f C Feb. 15, 2026, 5:10 p.m. OK PyPy 3 TESTS 6 484 19046400
363233537 shreyas2837 C Feb. 16, 2026, 4:32 a.m. OK PyPy 3-64 TESTS 6 93 31232000
363219542 weii2000 C Feb. 15, 2026, 10:10 p.m. OK PyPy 3-64 TESTS 6 93 31232000
363211725 Anirban2046 C Feb. 15, 2026, 8:11 p.m. OK PyPy 3-64 TESTS 6 93 31539200
363206451 gardengnome C Feb. 15, 2026, 7:10 p.m. OK PyPy 3-64 TESTS 6 93 37683200
363188290 Avinash_Babu C Feb. 15, 2026, 5:08 p.m. OK PyPy 3-64 TESTS 6 109 22732800
363188122 Annannan C Feb. 15, 2026, 5:07 p.m. OK PyPy 3-64 TESTS 6 109 31027200
363226285 Sheikah C Feb. 16, 2026, 1:49 a.m. OK PyPy 3-64 TESTS 6 109 31232000
363215733 Meek_12 C Feb. 15, 2026, 9:01 p.m. OK PyPy 3-64 TESTS 6 109 38297600
363209862 Bulo4kaa C Feb. 15, 2026, 7:51 p.m. OK PyPy 3-64 TESTS 6 125 24678400
363187095 prasadparth C Feb. 15, 2026, 5:05 p.m. OK PyPy 3-64 TESTS 6 125 33177600
363220387 Abhinandan_7777 C Feb. 15, 2026, 10:35 p.m. OK Python 3 TESTS 6 93 9216000
363237785 aryanrajwork47 C Feb. 16, 2026, 5:32 a.m. OK Python 3 TESTS 6 125 8192000
363201364 eugalt C Feb. 15, 2026, 6:23 p.m. OK Python 3 TESTS 6 125 14745600
363198461 NS3081992 C Feb. 15, 2026, 6 p.m. OK Python 3 TESTS 6 140 10854400
363197774 NS3081992 C Feb. 15, 2026, 5:55 p.m. OK Python 3 TESTS 6 140 10854400
363209214 Bulo4kaa C Feb. 15, 2026, 7:43 p.m. OK Python 3 TESTS 6 156 8089600
363237865 Amritansu C Feb. 16, 2026, 5:33 a.m. OK Python 3 TESTS 6 156 8192000
363232066 dhruva_056 C Feb. 16, 2026, 4:05 a.m. OK Python 3 TESTS 6 156 8192000
363203190 amod_24 C Feb. 15, 2026, 6:38 p.m. OK Python 3 TESTS 6 171 8192000
363230716 sujeethreddy00077 C Feb. 16, 2026, 3:38 a.m. OK Python 3 TESTS 6 171 9216000
363188039 srllamadev C Feb. 15, 2026, 5:07 p.m. OK Rust 2024 TESTS 6 31 3891200
363236196 vanshit C Feb. 16, 2026, 5:10 a.m. OK Rust 2024 TESTS 6 46 512000
363198216 patacca C Feb. 15, 2026, 5:58 p.m. OK Rust 2024 TESTS 6 46 512000
363218238 emoreira C Feb. 15, 2026, 9:43 p.m. OK Rust 2024 TESTS 6 46 819200
363186768 Tantellam C Feb. 15, 2026, 5:04 p.m. OK Rust 2024 TESTS 6 46 3891200
363231501 StarGazing C Feb. 16, 2026, 3:54 a.m. OK Rust 2024 TESTS 6 62 716800

remove filters

Back to search problems