Codeforces Round 1077 (Div. 1)

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
2187 Codeforces Round 1077 (Div. 1) FINISHED False 10800 6708323 Jan. 29, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5179 ) B Shortest Statement Ever PROGRAMMING bitmasks constructive algorithms dp greedy

You are given two non-negative integers (x), (y). Find two non-negative integers (p) and (q) such that (p\;\&\;q=0), and (|x-p|+|y-q|) is minimized. Here, (\&) denotes the bitwise AND operation . Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The only line of each test case contains two non-negative integers (x) and (y) ((0 \le x,y < 2^{30})). For each test case, output two non-negative integers (p) and (q) you found. If there are multiple pairs of (p) and (q) satisfying the conditions, you may output any of them. It can be proven that under the constraints of the problem, any valid solution satisfies (\max(p,q)<2^{31}). In the first test case, one valid pair would be (p=0) and (q=0), as (0\,\&\,0=0) and (|x-p|+|y-q|=|0-0|+|0-0|=0) is the minimum over all pairs of (p) and (q). In the third test case, one valid pair would be (p=3) and (q=8), as (3\,\&\,8=0) and (|x-p|+|y-q|=|3-3|+|8-6|=2) is the minimum over all pairs of (p) and (q). Note that ((p,q)=(3,4)) is also a valid pair.

Tutorials

Codeforces Round 1077 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
360667712 Treks B Jan. 30, 2026, 5:45 a.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360666444 Prashant_thakur77 B Jan. 30, 2026, 5:35 a.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360586935 Grok B Jan. 29, 2026, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360573439 bubbarob19 B Jan. 29, 2026, 4:04 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360533667 clfzs B Jan. 29, 2026, 3:16 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360532438 how_to_solve_D_Div2 B Jan. 29, 2026, 3:15 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360529153 More B Jan. 29, 2026, 3:11 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360518486 HugeWide B Jan. 29, 2026, 3:02 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
360646678 devecent B Jan. 29, 2026, 11:49 p.m. OK C++17 (GCC 7-32) TESTS 16 46 102400
360596116 Lawali B Jan. 29, 2026, 4:45 p.m. OK C++17 (GCC 7-32) TESTS 16 46 102400
360561496 feev1x B Jan. 29, 2026, 3:47 p.m. OK C++20 (GCC 13-64) TESTS 16 31 102400
360649435 lbmzxhb B Jan. 30, 2026, 1:15 a.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360613285 wuhudsm B Jan. 29, 2026, 5:28 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360606553 chaeyihwan B Jan. 29, 2026, 5:10 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360603490 d1mk B Jan. 29, 2026, 5:02 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360599252 Lemuen B Jan. 29, 2026, 4:52 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360578216 Probka B Jan. 29, 2026, 4:11 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360576537 krigare B Jan. 29, 2026, 4:08 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360573143 fisher199 B Jan. 29, 2026, 4:03 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360573138 installb B Jan. 29, 2026, 4:03 p.m. OK C++20 (GCC 13-64) TESTS 16 46 0
360542022 kolorVXL B Jan. 29, 2026, 3:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 31 0
360656476 wlh__1 B Jan. 30, 2026, 3:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 31 102400
360663650 -zura- B Jan. 30, 2026, 5:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360658121 BoBoowen B Jan. 30, 2026, 4:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360657507 sEa1nn013uR1o B Jan. 30, 2026, 3:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360653607 chzhc B Jan. 30, 2026, 2:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360645254 peti1234 B Jan. 29, 2026, 11:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360643775 Arnav_Singhal1 B Jan. 29, 2026, 10:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360639402 chromate00 B Jan. 29, 2026, 9:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360628849 Dr_Zhang B Jan. 29, 2026, 7:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
360503632 hos.lyric B Jan. 29, 2026, 2:50 p.m. OK D TESTS 16 421 0
360554236 pengin_2000 B Jan. 29, 2026, 3:38 p.m. OK GNU C11 TESTS 16 15 0
360552749 Ritwin B Jan. 29, 2026, 3:36 p.m. OK GNU C11 TESTS 16 156 0
360647850 0x3F B Jan. 30, 2026, 12:26 a.m. OK Go TESTS 16 62 512000
360559372 Hmzaawy B Jan. 29, 2026, 3:44 p.m. OK Go TESTS 16 140 409600
360646861 tarun_op B Jan. 29, 2026, 11:54 p.m. OK Java 21 TESTS 16 343 1331200
360571625 MBBN B Jan. 29, 2026, 4:01 p.m. OK Java 21 TESTS 16 671 512000
360603576 Goku_Kakarot B Jan. 29, 2026, 5:02 p.m. OK Java 8 TESTS 16 140 0
360544197 NeelmaniPandey09 B Jan. 29, 2026, 3:26 p.m. OK Java 8 TESTS 16 953 0
360544120 Tlatoani B Jan. 29, 2026, 3:26 p.m. OK Kotlin 2.2 TESTS 16 843 204800
360508497 Ergodic137 B Jan. 29, 2026, 2:54 p.m. OK PyPy 3-64 TESTS 16 156 6553600
360547318 teekaytai B Jan. 29, 2026, 3:30 p.m. OK PyPy 3-64 TESTS 16 156 7680000
360535484 AKSLEGION B Jan. 29, 2026, 3:18 p.m. OK PyPy 3-64 TESTS 16 171 5734400
360533636 sav B Jan. 29, 2026, 3:16 p.m. OK PyPy 3-64 TESTS 16 171 6860800
360510464 harurun4635 B Jan. 29, 2026, 2:55 p.m. OK PyPy 3-64 TESTS 16 171 7680000
360528038 dyppp B Jan. 29, 2026, 3:10 p.m. OK PyPy 3-64 TESTS 16 171 8806400
360634814 34z12000 B Jan. 29, 2026, 8:22 p.m. OK PyPy 3-64 TESTS 16 187 7168000
360531180 diss_quack B Jan. 29, 2026, 3:13 p.m. OK PyPy 3-64 TESTS 16 218 7782400
360548449 kdy8128 B Jan. 29, 2026, 3:31 p.m. OK PyPy 3-64 TESTS 16 218 8806400
360548430 titia B Jan. 29, 2026, 3:31 p.m. OK PyPy 3-64 TESTS 16 234 7065600
360546169 darkkcyan B Jan. 29, 2026, 3:29 p.m. OK Rust 2024 TESTS 16 46 0
360506919 Mon_ster B Jan. 29, 2026, 2:52 p.m. OK Rust 2024 TESTS 16 93 0
360505706 Darknef B Jan. 29, 2026, 2:51 p.m. OK Rust 2024 TESTS 16 93 0
360526089 drydock B Jan. 29, 2026, 3:09 p.m. OK Rust 2024 TESTS 16 156 0
360525014 Egor B Jan. 29, 2026, 3:08 p.m. OK Rust 2024 TESTS 16 1859 0

remove filters

Back to search problems