Codeforces Round 843 (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
1775 Codeforces Round 843 (Div. 2) FINISHED False 9000 63830663 Jan. 10, 2023, 11:15 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10953 ) C Interesting Sequence PROGRAMMING binary search bitmasks math

B"Petya and his friend, robot Petya++, like to solve exciting math problems. One day Petya++ came up with the numbers n and x and wrote the following equality on the board: n & (n+1) & ... & m = x, where & denotes the bitwise AND operation. Then he suggested his friend Petya find such a minimal m ( m ge n ) that the equality on the board holds. Unfortunately, Petya couldn't solve this problem in his head and decided to ask for computer help. He quickly wrote a program and found the answer. Can you solve this difficult problem? Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 2000 ). The description of the test cases follows. The only line of each test case contains two integers n , x ( 0 <= n, x <= 10^{18} ). For every test case, output the smallest possible value of m such that equality holds. If the equality does not hold for any m , print -1 instead. We can show that if the required m exists, it does not exceed 5 cdot 10^{18} . In the first example, 10 & 11 = 10 , but 10 & 11 & 12 = 8 , so the answer is 12 . In the second example, 10 = 10 , so the answer is 10 . In the third example, we can see that the required m does not exist, so we have to print -1 . "...

Tutorials

Codeforces Round #843 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
188808136 Wizard_of_Orz C Jan. 10, 2023, 8:18 p.m. OK Clang++17 Diagnostics TESTS 31 31 0
188798494 F1L0N C Jan. 10, 2023, 6:20 p.m. OK Clang++20 Diagnostics TESTS 31 77 0
188816581 FST_Forces C Jan. 10, 2023, 11:54 p.m. OK FPC TESTS 31 31 0
188817516 Six_San C Jan. 11, 2023, 12:20 a.m. OK FPC TESTS 31 31 0
188811544 ichi_kd C Jan. 10, 2023, 9:24 p.m. OK GNU C11 TESTS 31 31 0
188831954 gigajet C Jan. 11, 2023, 4:56 a.m. OK GNU C11 TESTS 31 31 3174400
188777040 ningfatiaoniao C Jan. 10, 2023, 3:36 p.m. OK GNU C11 TESTS 31 46 0
188825848 lmc0930 C Jan. 11, 2023, 3:21 a.m. OK GNU C++14 TESTS 31 15 0
188825272 haoren258 C Jan. 11, 2023, 3:12 a.m. OK GNU C++14 TESTS 31 15 0
188824983 adannklgdnglk C Jan. 11, 2023, 3:07 a.m. OK GNU C++14 TESTS 31 15 0
188835466 whdywjd C Jan. 11, 2023, 5:41 a.m. OK GNU C++14 TESTS 31 15 0
188831379 MCCF C Jan. 11, 2023, 4:48 a.m. OK GNU C++14 TESTS 31 15 0
188831042 njwst C Jan. 11, 2023, 4:43 a.m. OK GNU C++14 TESTS 31 15 0
188829937 shinzanmono C Jan. 11, 2023, 4:25 a.m. OK GNU C++14 TESTS 31 15 0
188828306 Lin_ C Jan. 11, 2023, 3:59 a.m. OK GNU C++14 TESTS 31 15 0
188827294 leo21468 C Jan. 11, 2023, 3:44 a.m. OK GNU C++14 TESTS 31 15 0
188827150 whdywjd C Jan. 11, 2023, 3:42 a.m. OK GNU C++14 TESTS 31 15 0
188836557 kongyuye C Jan. 11, 2023, 5:54 a.m. OK GNU C++17 TESTS 31 15 0
188832970 ouubai C Jan. 11, 2023, 5:10 a.m. OK GNU C++17 TESTS 31 15 0
188832189 anooprai.123 C Jan. 11, 2023, 5 a.m. OK GNU C++17 TESTS 31 15 0
188831454 yzyyds C Jan. 11, 2023, 4:49 a.m. OK GNU C++17 TESTS 31 15 0
188831411 GALIGAL1 C Jan. 11, 2023, 4:48 a.m. OK GNU C++17 TESTS 31 15 0
188830612 dailycpmaster C Jan. 11, 2023, 4:36 a.m. OK GNU C++17 TESTS 31 15 0
188830412 new_red C Jan. 11, 2023, 4:33 a.m. OK GNU C++17 TESTS 31 15 0
188833288 gravito69 C Jan. 11, 2023, 5:14 a.m. OK GNU C++17 TESTS 31 15 0
188834820 jk_s C Jan. 11, 2023, 5:33 a.m. OK GNU C++17 TESTS 31 15 0
188836064 shiny_sur_co C Jan. 11, 2023, 5:48 a.m. OK GNU C++17 TESTS 31 15 0
188806635 Awesome3.14 C Jan. 10, 2023, 7:52 p.m. OK GNU C++17 (64) TESTS 31 0 0
188829712 Hytidel C Jan. 11, 2023, 4:22 a.m. OK GNU C++17 (64) TESTS 31 15 0
188835493 Gepengjie007 C Jan. 11, 2023, 5:42 a.m. OK GNU C++17 (64) TESTS 31 15 0
188835461 Gepengjie007 C Jan. 11, 2023, 5:41 a.m. OK GNU C++17 (64) TESTS 31 15 0
188835428 Gepengjie007 C Jan. 11, 2023, 5:41 a.m. OK GNU C++17 (64) TESTS 31 15 0
188835068 reet_khairha C Jan. 11, 2023, 5:36 a.m. OK GNU C++17 (64) TESTS 31 15 0
188832065 tomYYDS C Jan. 11, 2023, 4:58 a.m. OK GNU C++17 (64) TESTS 31 15 0
188830461 Physics212303 C Jan. 11, 2023, 4:34 a.m. OK GNU C++17 (64) TESTS 31 15 0
188829914 YaoLingF C Jan. 11, 2023, 4:25 a.m. OK GNU C++17 (64) TESTS 31 15 0
188828723 LXH-cat C Jan. 11, 2023, 4:07 a.m. OK GNU C++17 (64) TESTS 31 15 0
188803616 Farhan20 C Jan. 10, 2023, 7:13 p.m. OK GNU C++20 (64) TESTS 31 0 0
188836811 suraj10 C Jan. 11, 2023, 5:56 a.m. OK GNU C++20 (64) TESTS 31 15 0
188836287 hnust_liuyunzhi1 C Jan. 11, 2023, 5:51 a.m. OK GNU C++20 (64) TESTS 31 15 0
188836088 hustlerr C Jan. 11, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 31 15 0
188835875 defaultedplayer C Jan. 11, 2023, 5:46 a.m. OK GNU C++20 (64) TESTS 31 15 0
188835837 chenjjjrrr C Jan. 11, 2023, 5:46 a.m. OK GNU C++20 (64) TESTS 31 15 0
188835775 defaultedplayer C Jan. 11, 2023, 5:45 a.m. OK GNU C++20 (64) TESTS 31 15 0
188837244 niraj.py C Jan. 11, 2023, 6:01 a.m. OK GNU C++20 (64) TESTS 31 15 0
188837294 s_newbie C Jan. 11, 2023, 6:01 a.m. OK GNU C++20 (64) TESTS 31 15 0
188837226 suraj10 C Jan. 11, 2023, 6 a.m. OK GNU C++20 (64) TESTS 31 15 0
188826060 djrfrn C Jan. 11, 2023, 3:25 a.m. OK Java 11 TESTS 31 187 0
188836463 leoncn C Jan. 11, 2023, 5:53 a.m. OK Java 11 TESTS 31 233 0
188831890 leoncn C Jan. 11, 2023, 4:55 a.m. OK Java 11 TESTS 31 233 0
188820621 dzhi C Jan. 11, 2023, 1:45 a.m. OK Java 11 TESTS 31 249 0
188794880 HeXecutor C Jan. 10, 2023, 5:51 p.m. OK Java 11 TESTS 31 249 409600
188808409 ash_79 C Jan. 10, 2023, 8:22 p.m. OK Java 11 TESTS 31 265 0
188794288 HeXecutor C Jan. 10, 2023, 5:47 p.m. OK Java 11 TESTS 31 265 204800
188804658 wat2 C Jan. 10, 2023, 7:26 p.m. OK Java 11 TESTS 31 280 0
188771715 rohcoding C Jan. 10, 2023, 3:03 p.m. OK Java 11 TESTS 29 280 0
188780245 creativegiant C Jan. 10, 2023, 3:59 p.m. OK Java 11 TESTS 31 342 0
188795969 this.is.shivamsingh C Jan. 10, 2023, 6 p.m. OK Java 17 TESTS 31 218 512000
188775278 Alex_by C Jan. 10, 2023, 3:25 p.m. OK Java 17 TESTS 31 218 512000
188795915 this.is.shivamsingh C Jan. 10, 2023, 5:59 p.m. OK Java 17 TESTS 31 249 819200
188799261 Abhinavrajhans C Jan. 10, 2023, 6:26 p.m. OK Java 17 TESTS 31 265 614400
188776704 FloatingOcean C Jan. 10, 2023, 3:34 p.m. OK Java 17 TESTS 31 312 1126400
188830911 Pranay_ C Jan. 11, 2023, 4:41 a.m. OK Java 8 TESTS 31 124 0
188827317 Java_Programmer C Jan. 11, 2023, 3:44 a.m. OK Java 8 TESTS 31 124 0
188810142 pranayrana14 C Jan. 10, 2023, 8:53 p.m. OK Java 8 TESTS 31 124 0
188805702 Ramez__ C Jan. 10, 2023, 7:39 p.m. OK Java 8 TESTS 31 124 0
188791097 vidwansAD C Jan. 10, 2023, 5:19 p.m. OK Java 8 TESTS 31 124 0
188832473 _Eyepatch C Jan. 11, 2023, 5:04 a.m. OK Java 8 TESTS 31 140 0
188829870 lpychemistry C Jan. 11, 2023, 4:24 a.m. OK Java 8 TESTS 31 171 0
188794381 tmpdeatheye C Jan. 10, 2023, 5:47 p.m. OK Java 8 TESTS 31 186 0
188812759 Ahmed_Hosssam C Jan. 10, 2023, 9:53 p.m. OK Java 8 TESTS 31 249 0
188796113 tmpdeatheye C Jan. 10, 2023, 6:01 p.m. OK Java 8 TESTS 31 280 0
188797687 Rajveer_100 C Jan. 10, 2023, 6:13 p.m. OK Kotlin 1.7 TESTS 31 404 4403200
188823218 SID_DARK_MONSOON_8008 C Jan. 11, 2023, 2:35 a.m. OK MS C++ 2017 TESTS 31 15 0
188821485 return_myself C Jan. 11, 2023, 2:04 a.m. OK MS C++ 2017 TESTS 31 31 0
188815821 payday3 C Jan. 10, 2023, 11:28 p.m. OK MS C++ 2017 TESTS 31 46 0
188777249 yihuicui C Jan. 10, 2023, 3:38 p.m. OK PyPy 2 TESTS 31 109 2662400
188777515 yihuicui C Jan. 10, 2023, 3:39 p.m. OK PyPy 2 TESTS 31 139 2969600
188808742 Starswap C Jan. 10, 2023, 8:27 p.m. OK PyPy 3 TESTS 31 295 9523200
188773381 NiwaP C Jan. 10, 2023, 3:13 p.m. OK PyPy 3 TESTS 30 296 9011200
188799713 KA_Rma C Jan. 10, 2023, 6:30 p.m. OK PyPy 3 TESTS 31 389 5836800
188804345 Yansou C Jan. 10, 2023, 7:22 p.m. OK PyPy 3-64 TESTS 31 109 6041600
188815134 Amay12 C Jan. 10, 2023, 11:06 p.m. OK PyPy 3-64 TESTS 31 124 6963200
188784925 2020uec1653 C Jan. 10, 2023, 4:32 p.m. OK PyPy 3-64 TESTS 31 155 10240000
188817689 EDCTY C Jan. 11, 2023, 12:24 a.m. OK PyPy 3-64 TESTS 31 156 9830400
188784975 aayush_chhabra C Jan. 10, 2023, 4:32 p.m. OK PyPy 3-64 TESTS 31 156 10240000
188781102 GG_boy C Jan. 10, 2023, 4:05 p.m. OK PyPy 3-64 TESTS 31 171 9523200
188814287 M_ElFatih C Jan. 10, 2023, 10:36 p.m. OK PyPy 3-64 TESTS 31 171 9932800
188773514 Abuer_123 C Jan. 10, 2023, 3:14 p.m. OK PyPy 3-64 TESTS 30 171 11161600
188821173 Shuja_SundarSTEM C Jan. 11, 2023, 1:57 a.m. OK PyPy 3-64 TESTS 31 186 9728000
188806975 KanishkGoel C Jan. 10, 2023, 7:58 p.m. OK PyPy 3-64 TESTS 31 186 9728000
188794570 java_py C Jan. 10, 2023, 5:49 p.m. OK Python 3 TESTS 31 78 0
188794386 java_py C Jan. 10, 2023, 5:47 p.m. OK Python 3 TESTS 31 93 0
188806577 Maanas23 C Jan. 10, 2023, 7:51 p.m. OK Python 3 TESTS 31 109 0
188802168 iam_Lost C Jan. 10, 2023, 6:56 p.m. OK Python 3 TESTS 31 109 0
188777617 YuraK C Jan. 10, 2023, 3:40 p.m. OK Python 3 TESTS 31 109 0
188793722 tgupta1729 C Jan. 10, 2023, 5:42 p.m. OK Python 3 TESTS 31 124 0
188822379 begin. C Jan. 11, 2023, 2:21 a.m. OK Python 3 TESTS 31 139 0
188822163 FCBd_w C Jan. 11, 2023, 2:16 a.m. OK Python 3 TESTS 31 139 0
188828865 orazbek C Jan. 11, 2023, 4:09 a.m. OK Python 3 TESTS 31 140 307200
188771042 SeanInAction C Jan. 10, 2023, 3 p.m. OK Python 3 TESTS 29 171 0
188771961 robostac C Jan. 10, 2023, 3:05 p.m. OK Rust 2021 TESTS 29 15 0
188799856 liut C Jan. 10, 2023, 6:32 p.m. OK Rust 2021 TESTS 31 30 0
188776920 cottoncotton C Jan. 10, 2023, 3:35 p.m. OK Rust 2021 TESTS 31 46 67276800

remove filters

Back to search problems