Codeforces Round 912 (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
1903 Codeforces Round 912 (Div. 2) FINISHED False 8100 30461099 Nov. 30, 2023, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 791 ) D2 Maximum And Queries (hard version) PROGRAMMING bitmasks divide and conquer dp

B'This is the hard version of the problem. The only difference between the two versions is the constraint on n and q , the memory and time limits. You can make hacks only if all versions of the problem are solved. Theofanis really likes to play with the bits of numbers. He has an array a of size n and an integer k . He can make at most k operations in the array. In each operation, he picks a single element and increases it by 1 . He found the maximum bitwise AND that array a can have after at most k operations. Theofanis has put a lot of work into finding this value and was very happy with his result. Unfortunately, Ada xc5 x9b, being the evil person that he is, decided to bully him by repeatedly changing the value of k . Help Theofanis by calculating the maximum possible bitwise AND for q different values of k . Note that queries are independent. The first line contains two integers n and q ( 1 <= n, q <= 10^6 ) -- the size of the array and the number of queries. The second line contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^6 ) -- the elements of the array. Next q lines describe the queries. The i -th line contains one integer k_i ( 0 <= k_i <= 10^{18} ) -- the number of operations that can be done in the i -th query. For each query, print one integer -- the maximum bitwise AND that array a can have after at most k_i operations. In the first test case, in the first query, we add 1 in the first and last elements of the array. Thus, the array becomes [2,3,7,6] with bitwise AND equal to 2 . In the second test case, in the first query, we add 1 in the first element, 5 in the second, and 3 in the third and now all the elements are equal to 5 . '...

Tutorials

Codeforces Round #912 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
235170462 Worma D2 Dec. 1, 2023, 5:32 a.m. OK GNU C++14 TESTS 44 1715 488960000
235154726 Sparkle_Twilight D2 Dec. 1, 2023, 1:26 a.m. OK GNU C++14 TESTS 44 1855 16384000
235145014 eren__ D2 Nov. 30, 2023, 9:33 p.m. OK GNU C++14 TESTS 44 2027 360755200
235166228 liuyz11 D2 Dec. 1, 2023, 4:41 a.m. OK GNU C++14 TESTS 44 2636 176332800
235165652 liuyz11 D2 Dec. 1, 2023, 4:32 a.m. OK GNU C++14 TESTS 44 2807 184524800
235154953 QQH D2 Dec. 1, 2023, 1:31 a.m. OK GNU C++14 TESTS 44 2886 176537600
235154707 QQH D2 Dec. 1, 2023, 1:25 a.m. OK GNU C++14 TESTS 44 2979 176537600
235141317 TrendBattles D2 Nov. 30, 2023, 8:40 p.m. OK GNU C++14 TESTS 44 3837 369459200
235141462 TrendBattles D2 Nov. 30, 2023, 8:42 p.m. OK GNU C++14 TESTS 44 3946 369766400
235138775 TrendBattles D2 Nov. 30, 2023, 8:12 p.m. OK GNU C++14 TESTS 44 4055 369459200
235120565 foammm D2 Nov. 30, 2023, 6:12 p.m. OK GNU C++17 TESTS 44 1981 191078400
235155189 thunopro D2 Dec. 1, 2023, 1:36 a.m. OK GNU C++17 TESTS 44 2854 176332800
235159918 lenhanboofficial D2 Dec. 1, 2023, 3:06 a.m. OK GNU C++17 TESTS 44 2900 192512000
235133839 pi_3.1416 D2 Nov. 30, 2023, 7:32 p.m. OK GNU C++17 TESTS 44 3369 201728000
235125424 El3ageed_Abu_Shehab D2 Nov. 30, 2023, 6:31 p.m. OK GNU C++17 TESTS 44 3478 172339200
235124188 Danilo21 D2 Nov. 30, 2023, 6:26 p.m. OK GNU C++17 TESTS 44 3634 368844800
235130609 fahimcp495 D2 Nov. 30, 2023, 6:49 p.m. OK GNU C++17 TESTS 44 3930 192512000
235124775 peti1234 D2 Nov. 30, 2023, 6:28 p.m. OK GNU C++17 TESTS 44 3977 25190400
235153285 Badint D2 Dec. 1, 2023, 12:55 a.m. OK GNU C++17 TESTS 44 5038 41267200
235123293 berr D2 Nov. 30, 2023, 6:23 p.m. OK GNU C++17 TESTS 44 5163 352665600
235155333 N_z__ D2 Dec. 1, 2023, 1:38 a.m. OK GNU C++17 (64) TESTS 44 483 16588800
235155589 N_z__ D2 Dec. 1, 2023, 1:43 a.m. OK GNU C++17 (64) TESTS 44 514 12595200
235156446 edisnimorF D2 Dec. 1, 2023, 2:03 a.m. OK GNU C++17 (64) TESTS 44 1606 49766400
235118011 kotatsugame D2 Nov. 30, 2023, 6:03 p.m. OK GNU C++17 (64) TESTS 44 1622 36352000
235155164 User_Carrot D2 Dec. 1, 2023, 1:35 a.m. OK GNU C++17 (64) TESTS 44 2510 184729600
235151296 sak_kn D2 Dec. 1, 2023, 12:05 a.m. OK GNU C++17 (64) TESTS 44 2667 374988800
235151531 MarcosK D2 Dec. 1, 2023, 12:11 a.m. OK GNU C++17 (64) TESTS 44 2932 180326400
235120631 Rubikun D2 Nov. 30, 2023, 6:13 p.m. OK GNU C++17 (64) TESTS 44 3182 184934400
235168628 bujudao D2 Dec. 1, 2023, 5:12 a.m. OK GNU C++17 (64) TESTS 44 3727 361472000
235152986 enslaved D2 Dec. 1, 2023, 12:47 a.m. OK GNU C++17 (64) TESTS 44 3743 66969600
235147687 magnus.hegdahl D2 Nov. 30, 2023, 10:29 p.m. OK GNU C++20 (64) TESTS 44 436 20070400
235148090 magnus.hegdahl D2 Nov. 30, 2023, 10:38 p.m. OK GNU C++20 (64) TESTS 44 451 20070400
235147390 magnus.hegdahl D2 Nov. 30, 2023, 10:23 p.m. OK GNU C++20 (64) TESTS 44 467 20070400
235148845 magnus.hegdahl D2 Nov. 30, 2023, 10:57 p.m. OK GNU C++20 (64) TESTS 44 483 20070400
235151654 magnus.hegdahl D2 Dec. 1, 2023, 12:15 a.m. OK GNU C++20 (64) TESTS 44 514 24064000
235147741 magnus.hegdahl D2 Nov. 30, 2023, 10:30 p.m. OK GNU C++20 (64) TESTS 44 529 20070400
235147043 magnus.hegdahl D2 Nov. 30, 2023, 10:15 p.m. OK GNU C++20 (64) TESTS 44 545 20070400
235153635 magnus.hegdahl D2 Dec. 1, 2023, 1:03 a.m. OK GNU C++20 (64) TESTS 44 560 19046400
235153439 magnus.hegdahl D2 Dec. 1, 2023, 12:58 a.m. OK GNU C++20 (64) TESTS 44 576 23040000
235147886 magnus.hegdahl D2 Nov. 30, 2023, 10:33 p.m. OK GNU C++20 (64) TESTS 44 592 20070400
235123215 arvindf232 D2 Nov. 30, 2023, 6:22 p.m. OK Kotlin 1.6 TESTS 44 3322 289484800

remove filters

Back to search problems