Codeforces Round 945 (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
1973 Codeforces Round 945 (Div. 2) FINISHED False 7200 15866699 May 17, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 14126 ) B Cat, Fox and the Lonely Array PROGRAMMING binary search bitmasks data structures greedy math two pointers 1300

B"Today, Cat and Fox found an array a consisting of n non-negative integers. Define the loneliness of a as the smallest positive integer k ( 1 <= k <= n ) such that for any two positive integers i and j ( 1 <= q i, j <= q n - k +1 ), the following holds: a_i | a_{i+1} | ldots | a_{i+k-1} = a_j | a_{j+1} | ldots | a_{j+k-1}, where x | y denotes the bitwise OR of x and y . In other words, for every k consecutive elements, their bitwise OR should be the same. Note that the loneliness of a is well-defined, because for k = n the condition is satisfied. Cat and Fox want to know how lonely the array a is. Help them calculate the loneliness of the found array. Each test consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains one integer n ( 1 <= q n <= q 10^5 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= q a_i < 2^{20} ) -- the elements of the array. It is guaranteed that the sum of n over all test cases doesn't exceed 10^5 . For each test case, print one integer -- the loneliness of the given array. In the first example, the loneliness of an array with a single element is always 1 , so the answer is 1 . In the second example, the OR of each subarray of length k = 1 is 2 , so the loneliness of the whole array is 1 . In the seventh example, it's true that (0 | 1 | 3) = (1 | 3 | 2) = (3 | 2 | 2) = (2 | 2 | 1) = (2 | 1 | 0) = (1 | 0 | 3) = 3 , so the condition is satisfied for k = 3 . We can verify that the condition is not true for any smaller k , so the answer is indeed 3 . "...

Tutorials

Editorial for Codeforces Round #945 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
262916325 masaftic B May 27, 2024, 5:30 p.m. OK C# 10 TESTS 13 108 9216000 1300
262841489 AhmedMaherAli B May 27, 2024, 7:16 a.m. OK C# 10 TESTS 13 531 9216000 1300
263678406 rithvick_2004 B June 1, 2024, 8:17 p.m. OK C++14 (GCC 6-32) TESTS 13 61 0 1300
263702570 rithvick_2004 B June 2, 2024, 5:27 a.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
263702518 rithvick_2004 B June 2, 2024, 5:26 a.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
263702428 rithvick_2004 B June 2, 2024, 5:25 a.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
262509003 sojaljain02 B May 25, 2024, 12:27 p.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
262169882 YJWYYDS B May 22, 2024, 4:31 p.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
261972789 wzx_ssl B May 21, 2024, 6:56 a.m. OK C++14 (GCC 6-32) TESTS 13 62 0 1300
262346232 KalznAsawind B May 24, 2024, 7:03 a.m. OK C++14 (GCC 6-32) TESTS 13 62 409600 1300
261948404 newfiles-codeforces B May 21, 2024, 1:31 a.m. OK C++14 (GCC 6-32) TESTS 13 62 2150400 1300
261944948 Grammar_hbw B May 21, 2024, 12:21 a.m. OK C++14 (GCC 6-32) TESTS 13 62 6860800 1300
262838447 OTTFF B May 27, 2024, 6:54 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262833452 ashutosh__018 B May 27, 2024, 6:08 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262646593 OrionJaman B May 26, 2024, 4:18 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262645796 cs142857 B May 26, 2024, 4:07 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262629348 EldoSantos B May 25, 2024, 10:25 p.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262240072 Tirth11 B May 23, 2024, 10:22 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262199179 farmpiggie B May 22, 2024, 10:26 p.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262181115 Mai404 B May 22, 2024, 6:10 p.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262141908 kokoue B May 22, 2024, 12:08 p.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262139325 demoralizer B May 22, 2024, 11:50 a.m. OK C++17 (GCC 7-32) TESTS 13 62 0 1300
262477256 vjudge5 B May 25, 2024, 7:44 a.m. OK C++20 (GCC 13-64) TESTS 13 61 0 1300
262311616 ian2anean B May 23, 2024, 8:46 p.m. OK C++20 (GCC 13-64) TESTS 13 61 0 1300
262149154 guangyangbest123 B May 22, 2024, 12:59 p.m. OK C++20 (GCC 13-64) TESTS 13 61 0 1300
262147473 N_z__ B May 22, 2024, 12:47 p.m. OK C++20 (GCC 13-64) TESTS 13 61 204800 1300
261764064 Ackerlanna B May 20, 2024, 10:34 a.m. OK C++20 (GCC 13-64) TESTS 13 61 409600 1300
263623531 Schoolbag B June 1, 2024, 11:45 a.m. OK C++20 (GCC 13-64) TESTS 13 62 0 1300
263617557 chappy1 B June 1, 2024, 11:01 a.m. OK C++20 (GCC 13-64) TESTS 13 62 0 1300
263553808 gustavocruz B May 31, 2024, 10:12 p.m. OK C++20 (GCC 13-64) TESTS 13 62 0 1300
263193093 perrrC B May 30, 2024, 12:39 a.m. OK C++20 (GCC 13-64) TESTS 13 62 0 1300
263162942 MisterGir B May 29, 2024, 3:32 p.m. OK C++20 (GCC 13-64) TESTS 13 62 0 1300
262299200 YangYeh B May 23, 2024, 6:11 p.m. OK GNU C11 TESTS 13 77 512000 1300
261794218 bitcoder_74 B May 20, 2024, 2:31 p.m. OK GNU C11 TESTS 13 139 921600 1300
262084185 light616 B May 22, 2024, 4:07 a.m. OK GNU C11 TESTS 13 233 16793600 1300
262851656 nguyenquocthao00 B May 27, 2024, 8:38 a.m. OK Go TESTS 13 62 3993600 1300
263032799 parth_7042 B May 28, 2024, 3:30 p.m. OK Go TESTS 13 592 4608000 1300
261705911 october_rain B May 19, 2024, 10:05 p.m. OK Haskell TESTS 13 389 8396800 1300
261705886 october_rain B May 19, 2024, 10:04 p.m. OK Haskell TESTS 13 390 9420800 1300
262442490 powervic08 B May 24, 2024, 10:51 p.m. OK Java 21 TESTS 13 264 409600 1300
261720830 GoldenShadow B May 20, 2024, 4:27 a.m. OK Java 21 TESTS 13 265 11673600 1300
262107754 Omar_Morsi B May 22, 2024, 7:43 a.m. OK Java 21 TESTS 13 280 819200 1300
262184930 stolis B May 22, 2024, 6:47 p.m. OK Java 21 TESTS 13 296 512000 1300
262920827 sudhanshu64 B May 27, 2024, 6:12 p.m. OK Java 21 TESTS 13 311 4812800 1300
262042843 lapsha B May 21, 2024, 3:38 p.m. OK Java 21 TESTS 13 312 18022400 1300
262760520 Bat454 B May 26, 2024, 3:38 p.m. OK Java 21 TESTS 13 452 1228800 1300
262359209 divyalaldinani B May 24, 2024, 9:02 a.m. OK Java 21 TESTS 13 468 921600 1300
262151604 rdhakar246 B May 22, 2024, 1:17 p.m. OK Java 21 TESTS 13 561 409600 1300
262424713 palak_05 B May 24, 2024, 6:17 p.m. OK Java 21 TESTS 13 577 1126400 1300
262341040 dogfootone B May 24, 2024, 6:12 a.m. OK Java 8 TESTS 13 187 0 1300
262492935 y_a_s B May 25, 2024, 10:01 a.m. OK Java 8 TESTS 13 249 13107200 1300
263246899 Burhan_Akkus B May 30, 2024, 12:25 p.m. OK Java 8 TESTS 13 249 18124800 1300
262660175 arkapravaghorai052 B May 26, 2024, 6:42 a.m. OK Java 8 TESTS 13 296 0 1300
262260619 RahulAhuja2901 B May 23, 2024, 12:55 p.m. OK Java 8 TESTS 13 296 0 1300
262256100 Baidiki B May 23, 2024, 12:23 p.m. OK Java 8 TESTS 13 296 0 1300
262144177 Saurabh124 B May 22, 2024, 12:24 p.m. OK Java 8 TESTS 13 374 7065600 1300
262070502 nithin_bharathi B May 22, 2024, 12:51 a.m. OK Java 8 TESTS 13 374 33484800 1300
261754379 singhharman B May 20, 2024, 9:25 a.m. OK Java 8 TESTS 13 406 1843200 1300
262248370 ne_prajwal B May 23, 2024, 11:28 a.m. OK Java 8 TESTS 13 483 18432000 1300
262355488 linxiaotian B May 24, 2024, 8:31 a.m. OK Kotlin 1.9 TESTS 13 483 9318400 1300
262047548 filliones B May 21, 2024, 4:15 p.m. OK Kotlin 1.9 TESTS 13 625 5529600 1300
262437353 rashadalsharpini B May 24, 2024, 8:52 p.m. OK PyPy 3 TESTS 13 233 12492800 1300
262526253 rashadalsharpini B May 25, 2024, 2:43 p.m. OK PyPy 3 TESTS 13 280 12595200 1300
261926264 Soshka B May 20, 2024, 6:52 p.m. OK PyPy 3 TESTS 13 359 12697600 1300
262437567 mortezamalekey B May 24, 2024, 8:57 p.m. OK PyPy 3 TESTS 13 374 23859200 1300
261710829 nealzane B May 20, 2024, 12:39 a.m. OK PyPy 3 TESTS 13 530 18227200 1300
262488959 klu-2100030642 B May 25, 2024, 9:30 a.m. OK PyPy 3 TESTS 13 655 46899200 1300
261751233 7JJJXFV9_XC B May 20, 2024, 8:55 a.m. OK PyPy 3 TESTS 13 764 13721600 1300
261690052 anirudhan_here B May 19, 2024, 6:13 p.m. OK PyPy 3 TESTS 13 1687 10444800 1300
261952358 _twi_nami B May 21, 2024, 2:34 a.m. OK PyPy 3-64 TESTS 13 109 11161600 1300
263430403 toam B May 31, 2024, 7:37 a.m. OK PyPy 3-64 TESTS 13 124 13414400 1300
261779447 s2003 B May 20, 2024, 12:37 p.m. OK PyPy 3-64 TESTS 13 124 13824000 1300
263542518 barvay B May 31, 2024, 7:02 p.m. OK PyPy 3-64 TESTS 13 140 13414400 1300
262247250 ad_left B May 23, 2024, 11:20 a.m. OK PyPy 3-64 TESTS 13 140 13414400 1300
262306898 swapnil.2003 B May 23, 2024, 7:35 p.m. OK PyPy 3-64 TESTS 13 155 13209600 1300
263227516 muhammadhamid B May 30, 2024, 11:10 a.m. OK PyPy 3-64 TESTS 13 156 13312000 1300
262191655 arpan.parikh B May 22, 2024, 8:08 p.m. OK PyPy 3-64 TESTS 13 156 145408000 1300
262287581 Nikita_Malykh B May 23, 2024, 4:36 p.m. OK PyPy 3-64 TESTS 13 171 13414400 1300
262005752 strashila B May 21, 2024, 11:22 a.m. OK PyPy 3-64 TESTS 13 171 14233600 1300
263409472 klu2100031976 B May 31, 2024, 4:36 a.m. OK Python 3 TESTS 13 405 19148800 1300
261701557 Ahmed20Amir24 B May 19, 2024, 8:42 p.m. OK Python 3 TESTS 13 405 19148800 1300
262957086 hanamoin0909 B May 28, 2024, 4:46 a.m. OK Python 3 TESTS 13 406 19148800 1300
262697495 kl_2200031074 B May 26, 2024, 11:40 a.m. OK Python 3 TESTS 13 406 19148800 1300
262375151 Bokhoo_105 B May 24, 2024, 11:14 a.m. OK Python 3 TESTS 13 437 19148800 1300
262611314 CodeArmy B May 25, 2024, 5:28 p.m. OK Python 3 TESTS 13 453 19148800 1300
262492488 2210080018 B May 25, 2024, 9:57 a.m. OK Python 3 TESTS 13 453 19148800 1300
262380704 MKoding B May 24, 2024, noon OK Python 3 TESTS 13 484 13209600 1300
262686495 MinakoKojima B May 26, 2024, 10:09 a.m. OK Python 3 TESTS 13 546 13209600 1300
262899159 mrrai B May 27, 2024, 3:02 p.m. OK Python 3 TESTS 13 686 13004800 1300
262821990 DarkSky_0xFF B May 27, 2024, 4:24 a.m. OK Rust 2021 TESTS 13 62 0 1300
263160053 bqn B May 29, 2024, 3:04 p.m. OK Rust 2021 TESTS 13 77 409600 1300
262625204 rkmelody B May 25, 2024, 8:57 p.m. OK Rust 2021 TESTS 13 93 15155200 1300
262973261 BetterThanNobita B May 28, 2024, 7:19 a.m. OK Rust 2021 TESTS 13 140 102400 1300
262069863 oreokaparatha B May 22, 2024, 12:31 a.m. OK Rust 2021 TESTS 13 281 1024000 1300

remove filters

Back to search problems