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
There are (n) slimes on a line, the (i)-th of which has weight (w_i). Slime (i) is able to eat another slime (j) if (w_i \geq w_j); afterwards, slime (j) disappears and the weight of slime (i) becomes (w_i \oplus w_j)(^{\text{∗}}). The King of Slimes wants to run an experiment with parameter (x) as follows: Add a new slime with weight (x) to the right end of the line (after the (n)-th slime). This new slime eats the slime to its left if it is able to, and then takes its place (moves one place to the left). It will continue to do this until there is either no slime to its left or the weight of the slime to its left is greater than its own weight. (No other slimes are eaten during this process.) The score of this experiment is the total number of slimes eaten. The King of Slimes is going to ask you (q) queries. In each query, you will be given an integer (x), and you need to determine the score of the experiment with parameter (x). Note that the King does not want you to actually perform each experiment; his slimes would die, which is not ideal. He is only asking what the hypothetical score is; in other words, the queries are not persistent. (^{\text{∗}})Here (\oplus) denotes the bitwise XOR operation . The first line contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains integers (n) and (q) ((1 \le n, q \le 2 \cdot 10^5)) — the number of slimes and the number of queries, respectively. The following line contains (n) integers (w_1,w_2,\ldots,w_n) ((1 \le w_i < 2^{30})) — the weights of the slimes. The following (q) lines contain a single integer (x) ((1 \le x < 2^{30})) — the parameter for the experiment. The sum of (n) does not exceed (2 \cdot 10^5) and the sum of (q) does not exceed (2 \cdot 10^5) across all test cases. For each query, output a single integer — the |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
306429365 |
og.kostya |
D |
Feb. 16, 2025, 4:34 p.m. |
OK |
C# 10 |
TESTS |
13 |
452 |
29696000 |
|
|
|
306426992 |
El-Bolbol-El-Khateer |
D |
Feb. 16, 2025, 4:31 p.m. |
OK |
C# 10 |
TESTS |
13 |
2843 |
326246400 |
|
|
|
306454644 |
TomazGomes |
D |
Feb. 16, 2025, 8:22 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
187 |
27750400 |
|
|
|
306465716 |
D06 |
D |
Feb. 17, 2025, 12:02 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
202 |
26521600 |
|
|
|
306484762 |
yxl123 |
D |
Feb. 17, 2025, 5:56 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
17 |
218 |
22016000 |
|
|
|
306479728 |
linweiyu123456 |
D |
Feb. 17, 2025, 4:53 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
15 |
218 |
22016000 |
|
|
|
306460635 |
Lazy_interpreter |
D |
Feb. 16, 2025, 9:51 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
218 |
25600000 |
|
|
|
306434917 |
Calculatelove |
D |
Feb. 16, 2025, 5:24 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
218 |
27340800 |
|
|
|
306435201 |
potato167 |
D |
Feb. 16, 2025, 5:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
233 |
23756800 |
|
|
|
306446334 |
Hamed5001 |
D |
Feb. 16, 2025, 6:52 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
233 |
25702400 |
|
|
|
306435509 |
commonashishw |
D |
Feb. 16, 2025, 5:28 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
234 |
25702400 |
|
|
|
306468019 |
xie_lzh |
D |
Feb. 17, 2025, 1:12 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
13 |
234 |
28160000 |
|
|
|
306483159 |
Redial |
D |
Feb. 17, 2025, 5:36 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
125 |
73830400 |
|
|
|
306477850 |
Hydrogen |
D |
Feb. 17, 2025, 4:24 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
156 |
22016000 |
|
|
|
306472140 |
yanghongyan |
D |
Feb. 17, 2025, 2:46 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
15 |
156 |
22016000 |
|
|
|
306466993 |
Khalwsh |
D |
Feb. 17, 2025, 12:44 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
22016000 |
|
|
|
306441224 |
hotcocoa |
D |
Feb. 16, 2025, 6:10 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
25702400 |
|
|
|
306433207 |
baobaybong |
D |
Feb. 16, 2025, 5:13 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
26521600 |
|
|
|
306468176 |
ymwang |
D |
Feb. 17, 2025, 1:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
29696000 |
|
|
|
306447768 |
its_priyans |
D |
Feb. 16, 2025, 7:05 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
50892800 |
|
|
|
306439706 |
Murinho |
D |
Feb. 16, 2025, 5:59 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
51404800 |
|
|
|
306437762 |
heyuhao |
D |
Feb. 16, 2025, 5:44 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
13 |
171 |
52940800 |
|
|
|
306426131 |
26100154 |
D |
Feb. 16, 2025, 4:29 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
124 |
25907200 |
|
|
|
306440921 |
424479543 |
D |
Feb. 16, 2025, 6:08 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
155 |
26316800 |
|
|
|
306447098 |
Lntano265 |
D |
Feb. 16, 2025, 6:59 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
171 |
23040000 |
|
|
|
306465430 |
Ianis |
D |
Feb. 16, 2025, 11:53 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
186 |
26521600 |
|
|
|
306455773 |
BlueDiamond |
D |
Feb. 16, 2025, 8:36 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
187 |
22118400 |
|
|
|
306437157 |
_Equinox |
D |
Feb. 16, 2025, 5:39 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
187 |
22118400 |
|
|
|
306483189 |
Mainak9093 |
D |
Feb. 17, 2025, 5:36 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
15 |
187 |
23654400 |
|
|
|
306441649 |
424479543 |
D |
Feb. 16, 2025, 6:13 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
187 |
24678400 |
|
|
|
306466898 |
FurinaHateComma |
D |
Feb. 17, 2025, 12:41 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
187 |
25702400 |
|
|
|
306456626 |
rayenbbs |
D |
Feb. 16, 2025, 8:47 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
13 |
187 |
25702400 |
|
|
|
306455795 |
DedsecKnight |
D |
Feb. 16, 2025, 8:36 p.m. |
OK |
Go |
TESTS |
13 |
952 |
189952000 |
|
|
|
306456612 |
DedsecKnight |
D |
Feb. 16, 2025, 8:47 p.m. |
OK |
Go |
TESTS |
13 |
1374 |
284057600 |
|
|
|
306431678 |
ysahu |
D |
Feb. 16, 2025, 5:07 p.m. |
OK |
Java 21 |
TESTS |
13 |
546 |
50790400 |
|
|
|
306461921 |
mangos194 |
D |
Feb. 16, 2025, 10:16 p.m. |
OK |
Java 21 |
TESTS |
13 |
577 |
53248000 |
|
|
|
306457618 |
sahasrad |
D |
Feb. 16, 2025, 9:01 p.m. |
OK |
Java 21 |
TESTS |
13 |
717 |
54784000 |
|
|
|
306426860 |
Yoda1122 |
D |
Feb. 16, 2025, 4:31 p.m. |
OK |
Java 21 |
TESTS |
13 |
1343 |
1228800 |
|
|
|
306469435 |
yang_wei |
D |
Feb. 17, 2025, 1:48 a.m. |
OK |
Java 21 |
TESTS |
14 |
1561 |
189337600 |
|
|
|
306425832 |
synasc |
D |
Feb. 16, 2025, 4:28 p.m. |
OK |
Java 21 |
TESTS |
13 |
1812 |
43827200 |
|
|
|
306428459 |
Lilypad |
D |
Feb. 16, 2025, 4:33 p.m. |
OK |
Java 21 |
TESTS |
13 |
3077 |
35225600 |
|
|
|
306425577 |
DarkAngelu |
D |
Feb. 16, 2025, 4:28 p.m. |
OK |
Java 21 |
TESTS |
13 |
3171 |
186163200 |
|
|
|
306425422 |
SanjeevKumarRay_4 |
D |
Feb. 16, 2025, 4:28 p.m. |
OK |
Java 21 |
TESTS |
13 |
3436 |
186777600 |
|
|
|
306481669 |
akshatsaxena552004.ss |
D |
Feb. 17, 2025, 5:17 a.m. |
OK |
Java 21 |
TESTS |
15 |
3889 |
271974400 |
|
|
|
306427015 |
shubham.sg53147 |
D |
Feb. 16, 2025, 4:31 p.m. |
OK |
Java 8 |
TESTS |
13 |
2280 |
107724800 |
|
|
|
306423963 |
pratyakshh |
D |
Feb. 16, 2025, 4:25 p.m. |
OK |
Java 8 |
TESTS |
13 |
2280 |
107724800 |
|
|
|
306481551 |
The_Bharadwaj |
D |
Feb. 17, 2025, 5:16 a.m. |
OK |
Node.js |
TESTS |
15 |
780 |
151449600 |
|
|
|
306464180 |
scyyyyyyyyyy |
D |
Feb. 16, 2025, 11:15 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
625 |
143052800 |
|
|
|
306474245 |
Lilpa |
D |
Feb. 17, 2025, 3:24 a.m. |
OK |
PyPy 3-64 |
TESTS |
15 |
639 |
128307200 |
|
|
|
306445923 |
x3mka |
D |
Feb. 16, 2025, 6:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
687 |
85299200 |
|
|
|
306433048 |
bigdamdam |
D |
Feb. 16, 2025, 5:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
750 |
29491200 |
|
|
|
306459791 |
mer_on |
D |
Feb. 16, 2025, 9:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
828 |
165478400 |
|
|
|
306432737 |
abcsumits |
D |
Feb. 16, 2025, 5:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
906 |
111411200 |
|
|
|
306432564 |
chreh |
D |
Feb. 16, 2025, 5:10 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
1031 |
84377600 |
|
|
|
306426962 |
JosephCifuentes |
D |
Feb. 16, 2025, 4:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
1312 |
141209600 |
|
|
|
306458454 |
Ezru1 |
D |
Feb. 16, 2025, 9:14 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
1374 |
84787200 |
|
|
|
306431643 |
Noobelectro444 |
D |
Feb. 16, 2025, 5:07 p.m. |
OK |
PyPy 3-64 |
TESTS |
13 |
1374 |
103321600 |
|
|
|
306427157 |
Dingbob1028 |
D |
Feb. 16, 2025, 4:31 p.m. |
OK |
Python 3 |
TESTS |
13 |
4453 |
109670400 |
|
|
|
306459702 |
ziggy |
D |
Feb. 16, 2025, 9:35 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
140 |
46899200 |
|
|
|
306459822 |
ziggy |
D |
Feb. 16, 2025, 9:37 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
155 |
50483200 |
|
|
|
306459552 |
ziggy |
D |
Feb. 16, 2025, 9:33 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
171 |
51302400 |
|
|
|
306465145 |
Martician |
D |
Feb. 16, 2025, 11:43 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
218 |
26828800 |
|
|
|
306434115 |
viniciusth |
D |
Feb. 16, 2025, 5:19 p.m. |
OK |
Rust 2021 |
TESTS |
13 |
311 |
136396800 |
|
|
remove filters
Back to search problems