Codeforces Round 1059 (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
2162 Codeforces Round 1059 (Div. 3) FINISHED False 8100 15693923 Oct. 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 21138 ) C Beautiful XOR PROGRAMMING bitmasks constructive algorithms

You are given two integers (a) and (b). You are allowed to perform the following operation any number of times (including zero): choose any integer (x) such that (0 \le x \le a) (the current value of (a), not initial), set (a := a \oplus x). Here, (\oplus) represents the bitwise XOR operator. After performing a sequence of operations, you want the value of (a) to become exactly (b). Find a sequence of at most (100) operations (values of (x) used in each operation) that transforms (a) into (b), or report that it is impossible. Note that you are not required to find the minimum number of operations, but any valid sequence of at most (100) operations. The first line of input contains a single integer (t) ((1 \le t \le 1000)) — the number of test cases. Each test case contains two integers (a) and (b) ((1 \le a, b \le 10^9)). For each test case, if it is impossible to obtain (b) from (a) using the allowed operations, print a single line containing (-1). Otherwise, on the first line print a single integer (k) ((0 \le k \le 100)) — the number of operations. On the second line print (k) integers ((x_1, x_2, \dots , x_k)) — the chosen values of (x) in the order you apply them. If there are multiple valid sequences, you may print any one of them. For the first test case, choose (x = 7), now (a) becomes equal to (9 \oplus 7 = 14). choose (x = 8), now (a) becomes equal to (14 \oplus 8 = 6). For the fourth test case, choosing (x = 5) makes (a = b).

Tutorials

Codeforces Round 1059 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
344419623 chrisTris C Oct. 18, 2025, 2:10 a.m. OK C# 13 TESTS 6 77 1126400
344423276 lxn C Oct. 18, 2025, 3:09 a.m. OK C++17 (GCC 7-32) TESTS 6 30 0
344584127 reqiv C Oct. 19, 2025, 4:40 a.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344578676 chrisnortiya C Oct. 19, 2025, 3:02 a.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344572540 Mo7amedAbady C Oct. 19, 2025, 12:05 a.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344568289 aryan.ktpt C Oct. 18, 2025, 9:56 p.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344521629 chief_27 C Oct. 18, 2025, 3:07 p.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344521470 ITBlockZ C Oct. 18, 2025, 3:06 p.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344504819 RB19 C Oct. 18, 2025, 1:34 p.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344434717 Mystrycoder C Oct. 18, 2025, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 6 31 0
344520620 push_3872 C Oct. 18, 2025, 3:01 p.m. OK C++17 (GCC 7-32) TESTS 6 31 1638400
344545984 achanchal11 C Oct. 18, 2025, 5:46 p.m. OK C++20 (GCC 13-64) TESTS 6 30 0
344497543 rishawrajofficial75 C Oct. 18, 2025, 12:50 p.m. OK C++20 (GCC 13-64) TESTS 6 30 0
344584801 g__k_f C Oct. 19, 2025, 4:52 a.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344572253 felipeft C Oct. 18, 2025, 11:52 p.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344548227 OAleksa C Oct. 18, 2025, 6:01 p.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344514548 Akhil_09 C Oct. 18, 2025, 2:27 p.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344500885 520llj C Oct. 18, 2025, 1:10 p.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344492858 GOTKAKO C Oct. 18, 2025, 12:24 p.m. OK C++20 (GCC 13-64) TESTS 6 31 0
344590867 gsdkvjhbsdvuhb C Oct. 19, 2025, 6:01 a.m. OK C++20 (GCC 13-64) TESTS 6 46 0
344588593 Obnoxious_Monk3y C Oct. 19, 2025, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 6 46 0
344563434 hayoosh610 C Oct. 18, 2025, 8:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 30 0
344513911 22kangwonWHS C Oct. 18, 2025, 2:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 30 0
344423643 devansh_arora C Oct. 18, 2025, 3:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 30 0
344554318 Acp_imt026 C Oct. 18, 2025, 6:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 6 30 102400
344589682 namaniac80 C Oct. 19, 2025, 5:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344589569 grind_on C Oct. 19, 2025, 5:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344585545 Krishna_Srivastav1234 C Oct. 19, 2025, 5:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344582052 goddddgg C Oct. 19, 2025, 4:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344580087 _YourCodeIsMine_ C Oct. 19, 2025, 3:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344579198 heartflow C Oct. 19, 2025, 3:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 6 31 0
344520460 Mysni C Oct. 18, 2025, 3 p.m. OK GNU C11 TESTS 6 46 0
344421256 jaishreeram123 C Oct. 18, 2025, 2:38 a.m. OK GNU C11 TESTS 6 46 0
344560799 KL2400031478 C Oct. 18, 2025, 8:01 p.m. OK GNU C11 TESTS 6 46 102400
344422855 VtoVu C Oct. 18, 2025, 3:03 a.m. OK GNU C11 TESTS 6 46 102400
344424899 sravanthi_89 C Oct. 18, 2025, 3:32 a.m. OK GNU C11 TESTS 6 233 102400
344540350 harsha187 C Oct. 18, 2025, 5:06 p.m. OK Go TESTS 6 77 409600
344529898 akshatjai258 C Oct. 18, 2025, 3:59 p.m. OK Java 21 TESTS 6 218 512000
344543243 nikshaykataria3 C Oct. 18, 2025, 5:27 p.m. OK Java 21 TESTS 6 233 1945600
344546466 santaniabhimanyu C Oct. 18, 2025, 5:49 p.m. OK Java 21 TESTS 6 234 512000
344547184 keshav14 C Oct. 18, 2025, 5:54 p.m. OK Java 21 TESTS 6 234 1433600
344431221 sumukha6 C Oct. 18, 2025, 4:49 a.m. OK Java 21 TESTS 6 249 204800
344523480 tomcat11 C Oct. 18, 2025, 3:19 p.m. OK Java 21 TESTS 6 249 409600
344504251 vellacoder1 C Oct. 18, 2025, 1:31 p.m. OK Java 21 TESTS 6 249 512000
344432015 fatal-98 C Oct. 18, 2025, 4:57 a.m. OK Java 21 TESTS 6 249 921600
344517781 Raghvendra7415 C Oct. 18, 2025, 2:45 p.m. OK Java 21 TESTS 6 264 614400
344577540 Bhuvi_will C Oct. 19, 2025, 2:38 a.m. OK Java 21 TESTS 6 264 921600
344565385 dimple_girl C Oct. 18, 2025, 9:01 p.m. OK Java 8 TESTS 6 124 0
344570273 yashvardhan3 C Oct. 18, 2025, 10:45 p.m. OK Java 8 TESTS 6 156 0
344575030 guiji_9155 C Oct. 19, 2025, 1:38 a.m. OK Java 8 TESTS 6 171 0
344524629 javeed_123 C Oct. 18, 2025, 3:26 p.m. OK Java 8 TESTS 6 187 0
344427323 deepthisuddapalli05 C Oct. 18, 2025, 4:05 a.m. OK Java 8 TESTS 6 187 0
344523742 javeed_123 C Oct. 18, 2025, 3:20 p.m. OK Java 8 TESTS 6 217 0
344510438 Radhe_1 C Oct. 18, 2025, 2:04 p.m. OK Java 8 TESTS 6 218 0
344499418 KrishnaDuby C Oct. 18, 2025, 1:01 p.m. OK Java 8 TESTS 6 218 0
344499645 Viskey4u C Oct. 18, 2025, 1:03 p.m. OK Java 8 TESTS 6 234 0
344543041 chrisc C Oct. 18, 2025, 5:26 p.m. OK Node.js TESTS 6 109 2252800
344420585 jared.mccarthy05 C Oct. 18, 2025, 2:27 a.m. OK PyPy 3 TESTS 6 156 3993600
344509146 gopikrishna9968 C Oct. 18, 2025, 1:57 p.m. OK PyPy 3 TESTS 6 156 5222400
344541118 opgod_07 C Oct. 18, 2025, 5:12 p.m. OK PyPy 3 TESTS 6 218 5939200
344435127 hundunlilun1 C Oct. 18, 2025, 5:26 a.m. OK PyPy 3-64 TESTS 6 93 1433600
344566536 ResurrectionEye C Oct. 18, 2025, 9:20 p.m. OK PyPy 3-64 TESTS 6 93 2048000
344423380 Aayush_69 C Oct. 18, 2025, 3:11 a.m. OK PyPy 3-64 TESTS 6 93 2048000
344584935 hiibuddy C Oct. 19, 2025, 4:54 a.m. OK PyPy 3-64 TESTS 6 93 3686400
344562585 Itrenbach C Oct. 18, 2025, 8:23 p.m. OK PyPy 3-64 TESTS 6 93 4403200
344431238 bailimice C Oct. 18, 2025, 4:49 a.m. OK PyPy 3-64 TESTS 6 108 2150400
344525782 Luciefer_x C Oct. 18, 2025, 3:33 p.m. OK PyPy 3-64 TESTS 6 109 2048000
344571074 NotWacky77 C Oct. 18, 2025, 11:08 p.m. OK PyPy 3-64 TESTS 6 109 2150400
344418908 Hearthstone114514 C Oct. 18, 2025, 1:58 a.m. OK PyPy 3-64 TESTS 6 109 2150400
344568392 mxdycn C Oct. 18, 2025, 9:58 p.m. OK PyPy 3-64 TESTS 6 109 2252800
344565424 haradeep C Oct. 18, 2025, 9:01 p.m. OK Python 3 TESTS 6 62 0
344509866 neelkheni19 C Oct. 18, 2025, 2:01 p.m. OK Python 3 TESTS 6 62 0
344429463 hiddenmachine C Oct. 18, 2025, 4:29 a.m. OK Python 3 TESTS 6 62 0
344589694 SteveCoder C Oct. 19, 2025, 5:50 a.m. OK Python 3 TESTS 6 62 102400
344530898 Coder_Ayush_ C Oct. 18, 2025, 4:05 p.m. OK Python 3 TESTS 6 62 102400
344496109 ehsansoltanm C Oct. 18, 2025, 12:42 p.m. OK Python 3 TESTS 6 62 102400
344551486 Argonised C Oct. 18, 2025, 6:27 p.m. OK Python 3 TESTS 6 77 0
344525167 ElbekB C Oct. 18, 2025, 3:29 p.m. OK Python 3 TESTS 6 77 0
344436312 gulchiroy_rm C Oct. 18, 2025, 5:37 a.m. OK Python 3 TESTS 6 77 0
344421656 seifkh03 C Oct. 18, 2025, 2:45 a.m. OK Python 3 TESTS 6 77 0
344506863 Clear23 C Oct. 18, 2025, 1:45 p.m. OK Ruby 3 TESTS 6 296 512000
344429015 MoSooN C Oct. 18, 2025, 4:25 a.m. OK Rust 2021 TESTS 6 61 0
344507011 Clear23 C Oct. 18, 2025, 1:46 p.m. OK Rust 2024 TESTS 6 46 0

remove filters

Back to search problems