Codeforces Round 959 sponsored by NEAR (Div. 1 + 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
1994 Codeforces Round 959 sponsored by NEAR (Div. 1 + Div. 2) FINISHED False 7200 15866663 July 18, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1304 ) G Minecraft PROGRAMMING bitmasks brute force dp math

B"After winning another Bed Wars game, Masha and Olya wanted to relax and decided to play a new game. Masha gives Olya an array a of length n and a number s . Now Olya's task is to find a non-negative number x such that displaystyle sum_{i=1}^{n} a_i oplus x = s . But she is very tired after a tight round, so please help her with this. But this task seemed too simple to them, so they decided to make the numbers larger (up to 2^k ) and provide you with their binary representation. Each test consists of several test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follows the description of the test cases. The first line of each test case contains two integers n and k ( 1 <= n, k, n cdot k <= 2 cdot 10^6 ) -- the length of the array a and the length of the binary representation of all numbers. The second line contains a string of length k , consisting of zeros and ones -- the binary representation of the number s , starting from the most significant bits. The next n lines also contain strings of length k , consisting of zeros and ones, the i -th of these strings contains the binary representation of the number a_i , starting from the most significant bits. It is guaranteed that the sum of the values n cdot k for all test cases does not exceed 2 cdot 10^6 . For each test case, output a string of length k on a separate line, consisting of zeros or ones -- the binary representation of any suitable number x ( x ge 0 ), starting from the most significant bits, or -1 if such x does not exist. In the first test case, s = 11, a = [14, 6, 12, 15] , if x = 14 , then displaystyle sum_{i=1}^{n} a_i oplus x = (14 oplus 14) + (6 oplus 14) + (12 oplus 14) + (15 oplus 14) = 0 + 8 + 2 + 1 = 11 = s . In the second test case, s = 41, a = [191, 158] "...

Tutorials

Video Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
271279178 nemars G July 18, 2024, 6:54 p.m. OK C# 10 TESTS 45 202 38912000
271316371 SqrtSecond G July 19, 2024, 3:30 a.m. OK C++14 (GCC 6-32) TESTS 45 390 24064000
271312890 ImmortaLimit G July 19, 2024, 2:56 a.m. OK C++14 (GCC 6-32) TESTS 45 453 65843200
271324856 hqmm G July 19, 2024, 5:05 a.m. OK C++14 (GCC 6-32) TESTS 45 468 82739200
271256631 _FJqwq G July 18, 2024, 4:16 p.m. OK C++14 (GCC 6-32) TESTS 45 577 288563200
271258599 Ricky2021 G July 18, 2024, 4:21 p.m. OK C++14 (GCC 6-32) TESTS 45 593 139468800
271270977 omeganot G July 18, 2024, 5:43 p.m. OK C++14 (GCC 6-32) TESTS 45 655 87449600
271279245 nhho G July 18, 2024, 6:54 p.m. OK C++14 (GCC 6-32) TESTS 45 656 101990400
271306360 RX93 G July 19, 2024, 1:46 a.m. OK C++14 (GCC 6-32) TESTS 45 734 217190400
271313157 beacon_cwk G July 19, 2024, 2:58 a.m. OK C++14 (GCC 6-32) TESTS 45 781 203468800
271326334 ciuim G July 19, 2024, 5:23 a.m. OK C++14 (GCC 6-32) TESTS 45 1061 268902400
271262035 9320001e3 G July 18, 2024, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 45 249 54476800
271268796 wpp G July 18, 2024, 5:29 p.m. OK C++17 (GCC 7-32) TESTS 45 264 384819200
271292544 thanos_2 G July 18, 2024, 9:39 p.m. OK C++17 (GCC 7-32) TESTS 45 312 142643200
271268783 InternetPerson10 G July 18, 2024, 5:29 p.m. OK C++17 (GCC 7-32) TESTS 45 343 153292800
271268612 InternetPerson10 G July 18, 2024, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 45 343 185344000
271301426 wifiii G July 19, 2024, 12:39 a.m. OK C++17 (GCC 7-32) TESTS 45 359 73216000
271260193 Miko35 G July 18, 2024, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 45 374 80486400
271260242 arimxcoder G July 18, 2024, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 45 390 44134400
271314160 hhhyh G July 19, 2024, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 45 390 87449600
271257100 OIer_kzc G July 18, 2024, 4:17 p.m. OK C++17 (GCC 7-32) TESTS 45 405 144281600
271258079 MnTm G July 18, 2024, 4:20 p.m. OK C++20 (GCC 13-64) TESTS 45 171 53452800
271286097 Ignut G July 18, 2024, 8:11 p.m. OK C++20 (GCC 13-64) TESTS 45 187 46489600
271269070 k1r1t0 G July 18, 2024, 5:30 p.m. OK C++20 (GCC 13-64) TESTS 45 187 112640000
271299387 LMydd0225 G July 19, 2024, midnight OK C++20 (GCC 13-64) TESTS 45 202 97792000
271267518 dkhve G July 18, 2024, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 45 202 98611200
271256068 nightsup G July 18, 2024, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 45 203 133427200
271267399 k1r1t0 G July 18, 2024, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 45 233 144691200
271268412 ganeid G July 18, 2024, 5:27 p.m. OK C++20 (GCC 13-64) TESTS 45 234 149913600
271256153 YeongTree G July 18, 2024, 4:15 p.m. OK C++20 (GCC 13-64) TESTS 45 249 92569600
271291461 Nika_Tamliani G July 18, 2024, 9:21 p.m. OK C++20 (GCC 13-64) TESTS 45 250 188723200
271259959 Gassa G July 18, 2024, 4:25 p.m. OK D TESTS 45 1312 116940800
271297339 rainboy G July 18, 2024, 11:11 p.m. OK GNU C11 TESTS 45 359 55500800
271260164 misorin G July 18, 2024, 4:26 p.m. OK PyPy 3-64 TESTS 45 421 138342400
271291250 golomb G July 18, 2024, 9:18 p.m. OK PyPy 3-64 TESTS 45 1281 454656000
271308553 tassei903 G July 19, 2024, 2:11 a.m. OK PyPy 3-64 TESTS 45 1389 373145600

remove filters

Back to search problems