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.
Problems
This is the easy version of the problem. The difference between the versions is that in this version, the constraints on (t), (k), and (m) are lower. You can hack only if you solved all versions of this problem. A sequence (a) of (n) integers is called good if the following condition holds: Let (\text{cnt}_x) be the number of occurrences of (x) in sequence (a). For all pairs (0 \le i < j < m), at least one of the following has to be true: (\text{cnt}_i = 0), (\text{cnt}_j = 0), or (\text{cnt}_i \le \text{cnt}_j). In other words, if both (i) and (j) are present in sequence (a), then the number of occurrences of (i) in (a) is less than or equal to the number of occurrences of (j) in (a). You are given integers (n) and (m). Calculate the value of the bitwise XOR of the median(^{\text{∗}}) of all good sequences (a) of length (n) with (0\le a_i < m). Note that the value of (n) can be very large, so you are given its binary representation instead. (^{\text{∗}})The median of a sequence (a) of length (n) is defined as the (\left\lfloor\frac{n + 1}{2}\right\rfloor)-th smallest value in the sequence. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 50)). The description of the test cases follows. The first line of each test case contains two integers (k) and (m) ((1 \le k \le 200), (1 \le m \le 500)) — the number of bits in (n) and the upper bound on the elements in sequence (a). The second line of each test case contains a binary string of length (k) — the binary representation of (n) with no leading zeros. It is guaranteed that the sum of (k) over all test cases does not exceed (200). For each test case, output a single integer representing the bitwise XOR of the median of all good sequences (a) of length (n) where (0\le a_i < m). |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
301500884 |
Isuki |
F1 |
Jan. 18, 2025, 2:45 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
46 |
102400 |
|
|
|
301504400 |
ggg |
F1 |
Jan. 18, 2025, 3:44 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
46 |
1024000 |
|
|
|
301502922 |
Isuki |
F1 |
Jan. 18, 2025, 3:20 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
46 |
1331200 |
|
|
|
301495887 |
Menaabdo_e |
F1 |
Jan. 18, 2025, 12:48 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
61 |
0 |
|
|
|
301454739 |
potato167 |
F1 |
Jan. 17, 2025, 4:16 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
62 |
102400 |
|
|
|
301498009 |
chenhongrui |
F1 |
Jan. 18, 2025, 1:44 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
62 |
204800 |
|
|
|
301461815 |
OdtreeKing |
F1 |
Jan. 17, 2025, 4:31 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
62 |
1126400 |
|
|
|
301469954 |
EL_DOKSH |
F1 |
Jan. 17, 2025, 5:32 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
62 |
1228800 |
|
|
|
301459872 |
tmwilliamlin168 |
F1 |
Jan. 17, 2025, 4:27 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
62 |
1228800 |
|
|
|
301455964 |
saaaalty |
F1 |
Jan. 17, 2025, 4:19 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
33 |
77 |
8192000 |
|
|
|
301490678 |
kaiboy |
F1 |
Jan. 17, 2025, 9:54 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
46 |
204800 |
|
|
|
301495546 |
Ra16bit |
F1 |
Jan. 18, 2025, 12:38 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
46 |
2150400 |
|
|
|
301472480 |
4977 |
F1 |
Jan. 17, 2025, 5:52 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
61 |
102400 |
|
|
|
301466143 |
Misuki |
F1 |
Jan. 17, 2025, 5:07 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
102400 |
|
|
|
301458356 |
STUDENT0 |
F1 |
Jan. 17, 2025, 4:24 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
204800 |
|
|
|
301456503 |
YocyCraft |
F1 |
Jan. 17, 2025, 4:20 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
204800 |
|
|
|
301484863 |
wishgoodluck |
F1 |
Jan. 17, 2025, 8:04 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
2150400 |
|
|
|
301462471 |
4977 |
F1 |
Jan. 17, 2025, 4:32 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
2560000 |
|
|
|
301501162 |
Citnaris |
F1 |
Jan. 18, 2025, 2:50 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
4198400 |
|
|
|
301500641 |
Survivor_winner |
F1 |
Jan. 18, 2025, 2:40 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
33 |
62 |
7270400 |
|
|
|
301506483 |
Normalizerr |
F1 |
Jan. 18, 2025, 4:15 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
46 |
102400 |
|
|
|
301479124 |
AgafonovArtem |
F1 |
Jan. 17, 2025, 6:54 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
46 |
102400 |
|
|
|
301495421 |
xuyifei1 |
F1 |
Jan. 18, 2025, 12:34 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
46 |
1638400 |
|
|
|
301475322 |
415411 |
F1 |
Jan. 17, 2025, 6:17 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
61 |
102400 |
|
|
|
301502443 |
Tagaki_san |
F1 |
Jan. 18, 2025, 3:12 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
61 |
2150400 |
|
|
|
301476204 |
415411 |
F1 |
Jan. 17, 2025, 6:24 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
62 |
102400 |
|
|
|
301475640 |
415411 |
F1 |
Jan. 17, 2025, 6:19 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
62 |
102400 |
|
|
|
301472447 |
_DRVGON_ |
F1 |
Jan. 17, 2025, 5:52 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
62 |
102400 |
|
|
|
301468953 |
SkyAscendant |
F1 |
Jan. 17, 2025, 5:25 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
62 |
102400 |
|
|
|
301454611 |
AmirAli-Asgari |
F1 |
Jan. 17, 2025, 4:16 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
33 |
62 |
1024000 |
|
|
|
301460565 |
toam |
F1 |
Jan. 17, 2025, 4:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
33 |
140 |
3276800 |
|
|
remove filters
Back to search problems