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
Note that the memory limit is unusual. The Cheshire Cat has a riddle for Alice: given (n) integers (a_1, a_2, \ldots, a_n) and a target (m), is there a way to insert (+) and (\times) into the circles of the expression ()a_1 \circ a_2 \circ \cdots \circ a_n = m() to make it true? We follow the usual order of operations: (\times) is done before (+). Although Alice is excellent at chess, she is not good at math. Please help her so she can find a way out of Wonderland! Each test contains multiple test cases. The first line of input contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains two integers (n, m) ((1\le n\le 2\cdot 10^5); (1\le m\le 10^4)) — the number of integers and the target, respectively. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((0\le a_i\le 10^4)) — the elements of the array (a). The sum of (n) over all test cases does not exceed (2\cdot 10^5). For each test case, output " YES " without quotes if it is possible to get the target by inserting (+) or (\times) and " NO " otherwise. You can output each letter in any case (for example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as a positive answer). Possible solutions for the first four test cases are shown below. ()\begin{align*} 2 \times 1 + 1 \times 1 \times 2 &= 4 \\ 2 \times 1 + 1 + 1 \times 2 &= 5 \\ 2 \times 1 + 1 + 1 + 2 &= 6 \\ 2 + 1 + 1 + 1 + 2 &= 7 \\ \end{align*}() It is impossible to get a result of (8) in the fifth test case. |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
290996792 |
phsads |
F |
Nov. 11, 2024, 3 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
67 |
437 |
102400 |
|
|
|
290964252 |
T404 |
F |
Nov. 10, 2024, 6:38 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
66 |
546 |
102400 |
|
|
|
290974853 |
BernardoP |
F |
Nov. 10, 2024, 8:37 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
66 |
1155 |
102400 |
|
|
|
290961561 |
Xu_Hongxi |
F |
Nov. 10, 2024, 6:20 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
66 |
1186 |
2457600 |
|
|
|
291006059 |
potato167 |
F |
Nov. 11, 2024, 5:15 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
67 |
1484 |
102400 |
|
|
|
290962282 |
dmraykhan |
F |
Nov. 10, 2024, 6:24 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
66 |
2374 |
307200 |
|
|
|
290962479 |
dmraykhan |
F |
Nov. 10, 2024, 6:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
66 |
2984 |
307200 |
|
|
|
290955148 |
sweet_dream |
F |
Nov. 10, 2024, 5:34 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
203 |
18636800 |
|
|
|
290958136 |
Fysty |
F |
Nov. 10, 2024, 6 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
437 |
921600 |
|
|
|
290981321 |
Mamedov |
F |
Nov. 10, 2024, 10:44 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
67 |
468 |
102400 |
|
|
|
290990257 |
NuclearMint |
F |
Nov. 11, 2024, 12:41 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
67 |
483 |
102400 |
|
|
|
290957247 |
Intellegent |
F |
Nov. 10, 2024, 5:57 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
546 |
102400 |
|
|
|
290993076 |
Ruayhb |
F |
Nov. 11, 2024, 1:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
67 |
625 |
8089600 |
|
|
|
290966138 |
VitalyKo |
F |
Nov. 10, 2024, 6:55 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
750 |
512000 |
|
|
|
290955187 |
contee |
F |
Nov. 10, 2024, 5:34 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
843 |
102400 |
|
|
|
290966534 |
kaiboy |
F |
Nov. 10, 2024, 6:58 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
859 |
2457600 |
|
|
|
290974962 |
misteg168 |
F |
Nov. 10, 2024, 8:38 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
66 |
999 |
102400 |
|
|
|
290959417 |
wish_rajput |
F |
Nov. 10, 2024, 6:07 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
66 |
359 |
18636800 |
|
|
|
290956776 |
BallBreaker |
F |
Nov. 10, 2024, 5:55 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
66 |
718 |
102400 |
|
|
|
291000624 |
modwwe |
F |
Nov. 11, 2024, 4:01 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
718 |
2457600 |
|
|
|
290981685 |
Liudas |
F |
Nov. 10, 2024, 10:55 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
1015 |
102400 |
|
|
|
291009315 |
WRKRW |
F |
Nov. 11, 2024, 5:58 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
1030 |
1638400 |
|
|
|
290982092 |
Liudas |
F |
Nov. 10, 2024, 11:07 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
1046 |
0 |
|
|
|
290999221 |
SmuggingSpon |
F |
Nov. 11, 2024, 3:41 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
1062 |
102400 |
|
|
|
291000113 |
hhhyh |
F |
Nov. 11, 2024, 3:54 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
67 |
1093 |
102400 |
|
|
|
290957309 |
irkstepanov |
F |
Nov. 10, 2024, 5:57 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
66 |
1124 |
102400 |
|
|
|
290964375 |
_greedy |
F |
Nov. 10, 2024, 6:39 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
66 |
1124 |
4812800 |
|
|
|
290975894 |
Dukkha |
F |
Nov. 10, 2024, 8:53 p.m. |
OK |
Java 21 |
TESTS |
67 |
1436 |
1228800 |
|
|
|
290978506 |
PaciukZvichainyi |
F |
Nov. 10, 2024, 9:39 p.m. |
OK |
Rust 2021 |
TESTS |
67 |
624 |
5939200 |
|
|
remove filters
Back to search problems