Codeforces Round 946 (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
1974 Codeforces Round 946 (Div. 3) FINISHED False 8100 20964263 May 20, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 16300 ) C Beautiful Triple Pairs PROGRAMMING combinatorics data structures 1400

B'Polycarp was given an array a of n integers. He really likes triples of numbers, so for each j ( 1 <= j <= n - 2 ) he wrote down a triple of elements [a_j, a_{j + 1}, a_{j + 2}] . Polycarp considers a pair of triples b and c beautiful if they differ in exactly one position, that is, one of the following conditions is satisfied: Find the number of beautiful pairs of triples among the written triples [a_j, a_{j + 1}, a_{j + 2}] . The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 3 <= n <= 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^6 ) -- the elements of the array. It is guaranteed that the sum of the values of n for all test cases in the test does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the number of beautiful pairs of triples among the pairs of the form [a_j, a_{j + 1}, a_{j + 2}] . Note that the answer may not fit into 32-bit data types. In the first example, a = [3, 2, 2, 2, 3] , Polycarp will write the following triples: In the third example, a = [1, 2, 3, 2, 2, 3, 4, 2] , Polycarp will write the following triples: '...

Tutorials

Codeforces Round #946 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
262618598 bati06 C May 25, 2024, 7:32 p.m. OK C# 10 TESTS 21 374 82329600 1400
263208991 mban259 C May 30, 2024, 7:31 a.m. OK C# 10 TESTS 21 389 111104000 1400
262920444 adarshnim30 C May 27, 2024, 6:08 p.m. OK C++14 (GCC 6-32) TESTS 21 140 8192000 1400
263567917 whale142857 C June 1, 2024, 3:24 a.m. OK C++14 (GCC 6-32) TESTS 21 156 5632000 1400
263401958 WH-ASDFZ-CYF C May 31, 2024, 2:59 a.m. OK C++14 (GCC 6-32) TESTS 21 171 3276800 1400
263050399 iit2022213 C May 28, 2024, 6:02 p.m. OK C++14 (GCC 6-32) TESTS 21 186 7372800 1400
262851739 cylife C May 27, 2024, 8:39 a.m. OK C++14 (GCC 6-32) TESTS 21 390 28774400 1400
263404963 CNH_EzGame C May 31, 2024, 3:41 a.m. OK C++14 (GCC 6-32) TESTS 21 437 28979200 1400
262851638 cylife C May 27, 2024, 8:38 a.m. OK C++14 (GCC 6-32) TESTS 21 468 28876800 1400
263043725 Soumik_M C May 28, 2024, 5:01 p.m. OK C++14 (GCC 6-32) TESTS 21 468 41472000 1400
262812644 ASPDK C May 27, 2024, 1:37 a.m. OK C++14 (GCC 6-32) TESTS 21 515 10649600 1400
262871849 luogu_bot4 C May 27, 2024, 11:32 a.m. OK C++14 (GCC 6-32) TESTS 21 531 9932800 1400
262879522 fuyiming09 C May 27, 2024, 12:29 p.m. OK C++17 (GCC 7-32) TESTS 21 140 54579200 1400
263380152 skmprohunt C May 30, 2024, 7:19 p.m. OK C++17 (GCC 7-32) TESTS 21 171 20070400 1400
262877960 xingchen0v0 C May 27, 2024, 12:17 p.m. OK C++17 (GCC 7-32) TESTS 21 187 1638400 1400
263007065 tnakao C May 28, 2024, 12:06 p.m. OK C++17 (GCC 7-32) TESTS 21 187 7987200 1400
263047193 Zack C May 28, 2024, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 21 202 18944000 1400
263624272 bkifhr9 C June 1, 2024, 11:51 a.m. OK C++17 (GCC 7-32) TESTS 21 249 7372800 1400
263623894 vjudge.8 C June 1, 2024, 11:48 a.m. OK C++17 (GCC 7-32) TESTS 21 281 7372800 1400
263131055 Jalilvand.mJ C May 29, 2024, 11:12 a.m. OK C++17 (GCC 7-32) TESTS 21 296 6860800 1400
262662374 ClayJensen C May 26, 2024, 6:59 a.m. OK C++17 (GCC 7-32) TESTS 21 328 8192000 1400
262668726 eastnman C May 26, 2024, 7:48 a.m. OK C++17 (GCC 7-32) TESTS 21 358 10035200 1400
262960584 PDXCFer C May 28, 2024, 5:21 a.m. OK C++20 (GCC 13-64) TESTS 21 77 307200 1400
262959872 PDXCFer C May 28, 2024, 5:14 a.m. OK C++20 (GCC 13-64) TESTS 21 78 102400 1400
262957312 PDXCFer C May 28, 2024, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 21 93 0 1400
262956995 PDXCFer C May 28, 2024, 4:45 a.m. OK C++20 (GCC 13-64) TESTS 21 93 0 1400
263053178 Himanshujoy C May 28, 2024, 6:28 p.m. OK C++20 (GCC 13-64) TESTS 21 140 25907200 1400
262562837 Hafiz_Sakib C May 25, 2024, 3:22 p.m. OK C++20 (GCC 13-64) TESTS 21 156 9830400 1400
262684182 whitelistedguy C May 26, 2024, 9:50 a.m. OK C++20 (GCC 13-64) TESTS 21 171 9011200 1400
262590017 amihn C May 25, 2024, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 21 171 32051200 1400
262995006 _Danial_ C May 28, 2024, 10:27 a.m. OK C++20 (GCC 13-64) TESTS 21 186 21708800 1400
263210869 hocky C May 30, 2024, 8:04 a.m. OK C++20 (GCC 13-64) TESTS 21 218 9625600 1400
263519535 PURE2024 C May 31, 2024, 3:30 p.m. OK Go TESTS 21 1327 44748800 1400
263252044 loverr C May 30, 2024, 1:01 p.m. OK Java 21 TESTS 21 921 27136000 1400
263648453 anshs10 C June 1, 2024, 3:20 p.m. OK Java 21 TESTS 21 968 26931200 1400
263403439 nirav96 C May 31, 2024, 3:21 a.m. OK Java 21 TESTS 21 1124 88268800 1400
263673006 mohit1510 C June 1, 2024, 7 p.m. OK Java 21 TESTS 21 1187 47104000 1400
263659995 stolis C June 1, 2024, 4:55 p.m. OK Java 21 TESTS 21 1265 99123200 1400
263157030 mpanyavin C May 29, 2024, 2:37 p.m. OK Java 21 TESTS 21 1359 157388800 1400
263032766 bhavesh_codes_11 C May 28, 2024, 3:30 p.m. OK Java 21 TESTS 21 1390 156979200 1400
263417257 adi3008 C May 31, 2024, 5:52 a.m. OK Java 21 TESTS 21 1483 97689600 1400
262513237 supriya__9184 C May 25, 2024, 1:16 p.m. OK Java 21 TESTS 21 1530 139980800 1400
263044309 daksh_02 C May 28, 2024, 5:07 p.m. OK Java 21 TESTS 21 1530 157286400 1400
262504990 PravinGlitch_12 C May 25, 2024, 11:48 a.m. OK Java 8 TESTS 21 1078 63897600 1400
262511133 cu.17bcs1685 C May 25, 2024, 12:50 p.m. OK Java 8 TESTS 21 1171 70348800 1400
262622096 .shinchan_ C May 25, 2024, 8:11 p.m. OK Java 8 TESTS 21 1234 112742400 1400
262616386 .shinchan_ C May 25, 2024, 6:31 p.m. OK Java 8 TESTS 21 1359 112640000 1400
262708454 HardikG12 C May 26, 2024, 1:13 p.m. OK Java 8 TESTS 21 1530 127078400 1400
263363122 arkapravaghorai052 C May 30, 2024, 4:50 p.m. OK Java 8 TESTS 21 1702 127078400 1400
262846182 seyjs C May 27, 2024, 7:51 a.m. OK Java 8 TESTS 21 1811 112332800 1400
263418263 iam_ljk C May 31, 2024, 6:01 a.m. OK Java 8 TESTS 21 1983 134656000 1400
262706561 Daksh_Sahani C May 26, 2024, 12:57 p.m. OK Java 8 TESTS 21 2046 85913600 1400
262822243 Mr_A C May 27, 2024, 4:28 a.m. OK Java 8 TESTS 21 2468 237772800 1400
263386787 RatanPrakash C May 30, 2024, 9:01 p.m. OK PyPy 3 TESTS 21 734 72601600 1400
263414034 arnav_satwik C May 31, 2024, 5:22 a.m. OK PyPy 3 TESTS 21 843 87449600 1400
262614573 sanjay.garg2072 C May 25, 2024, 5:56 p.m. OK PyPy 3 TESTS 21 921 109568000 1400
262686248 Team2_HieuGM C May 26, 2024, 10:07 a.m. OK PyPy 3 TESTS 21 952 109465600 1400
263083437 vainilla C May 29, 2024, 3:58 a.m. OK PyPy 3 TESTS 21 968 88883200 1400
263072212 ahmed-farid C May 29, 2024, 12:04 a.m. OK PyPy 3 TESTS 21 984 109158400 1400
262822975 imkindabad C May 27, 2024, 4:39 a.m. OK PyPy 3 TESTS 21 1030 119091200 1400
262710085 vovesi4341 C May 26, 2024, 1:27 p.m. OK PyPy 3 TESTS 21 1031 109772800 1400
263545292 gerogeVT C May 31, 2024, 7:37 p.m. OK PyPy 3 TESTS 21 1155 153088000 1400
263531981 gerogeVT C May 31, 2024, 5:19 p.m. OK PyPy 3 TESTS 21 1343 141209600 1400
263035264 Mr_Surfer C May 28, 2024, 3:50 p.m. OK PyPy 3-64 TESTS 21 593 103014400 1400
263188692 singhkhuranatanish C May 29, 2024, 10:20 p.m. OK PyPy 3-64 TESTS 21 625 140083200 1400
263532027 14Sarthak C May 31, 2024, 5:20 p.m. OK PyPy 3-64 TESTS 21 655 82841600 1400
263386809 RatanPrakash C May 30, 2024, 9:02 p.m. OK PyPy 3-64 TESTS 21 718 119603200 1400
263622901 kinglykang C June 1, 2024, 11:39 a.m. OK PyPy 3-64 TESTS 21 734 126156800 1400
262532250 Copper_Stairs C May 25, 2024, 2:49 p.m. OK PyPy 3-64 TESTS 21 780 145817600 1400
263070983 Anley C May 28, 2024, 11:29 p.m. OK PyPy 3-64 TESTS 21 780 149094400 1400
262641347 ksehgal.0809 C May 26, 2024, 3:21 a.m. OK PyPy 3-64 TESTS 21 781 176128000 1400
262826605 Taymyr C May 27, 2024, 5:25 a.m. OK PyPy 3-64 TESTS 21 811 111308800 1400
262834105 okinch C May 27, 2024, 6:15 a.m. OK PyPy 3-64 TESTS 21 812 158412800 1400
262625563 awesomep C May 25, 2024, 9:02 p.m. OK Python 3 TESTS 21 592 118067200 1400
262637126 heber.alturria C May 26, 2024, 2:08 a.m. OK Python 3 TESTS 21 608 118476800 1400
262967687 Shaurya_Anant C May 28, 2024, 6:31 a.m. OK Python 3 TESTS 21 624 117964800 1400
262923960 honzov C May 27, 2024, 6:45 p.m. OK Python 3 TESTS 21 640 118476800 1400
263051994 Vedant_Borkar C May 28, 2024, 6:17 p.m. OK Python 3 TESTS 21 640 118579200 1400
263048785 vivek_vatsalya C May 28, 2024, 5:48 p.m. OK Python 3 TESTS 21 640 118579200 1400
262954538 lam017 C May 28, 2024, 4:20 a.m. OK Python 3 TESTS 21 640 118579200 1400
262924840 khanwalker C May 27, 2024, 6:55 p.m. OK Python 3 TESTS 21 655 117964800 1400
262912156 Mazen_mohamed222 C May 27, 2024, 4:50 p.m. OK Python 3 TESTS 21 655 117964800 1400
262877399 Sujalmanpara C May 27, 2024, 12:13 p.m. OK Python 3 TESTS 21 655 117964800 1400
262791267 DarkSky_0xFF C May 26, 2024, 6:35 p.m. OK Rust 2021 TESTS 21 77 2560000 1400
263672751 snamy520 C June 1, 2024, 6:57 p.m. OK Rust 2021 TESTS 21 140 26726400 1400
263079351 BetterThanNobita C May 29, 2024, 2:52 a.m. OK Rust 2021 TESTS 21 312 116121600 1400

remove filters

Back to search problems