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
B'You are given a 1 -indexed array a of length n where each element is 1 or 2 . Process q queries of the following two types: ^{ dagger} An array b is a subarray of an array a if b can be obtained from a by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. In particular, an array is a subarray of itself. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 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 and q ( 1 <= n,q <= 10^5 ) -- the length of array a and the number of queries. The second line of each test case contains n integers a_1,a_2, ldots,a_n ( a_i is 1 or 2 ) -- the elements of array a . Each of the following q lines of each test case contains some integers. The first integer mathrm{op} is either 1 or 2 . It is guaranteed that the sum of n and the sum of q over all test cases both do not exceed 10^5 . For each query with mathrm{op}=1 , output "YES" in one line if there exists a subarray of a whose sum is equals to s , otherwise output "NO". You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses. Consider the first example: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
234323437 |
ksandr1v |
D |
Nov. 25, 2023, 7:25 p.m. |
OK |
C# 10 |
TESTS |
16 |
124 |
8294400 |
|
|
234294275 |
mban259 |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
C# 10 |
TESTS |
16 |
312 |
21299200 |
|
|
234308204 |
sergmel |
D |
Nov. 25, 2023, 5:17 p.m. |
OK |
C# 10 |
TESTS |
16 |
358 |
12902400 |
|
|
234337048 |
NenadDapic |
D |
Nov. 25, 2023, 10:51 p.m. |
OK |
FPC |
TESTS |
16 |
436 |
4505600 |
|
|
234330973 |
rainboy |
D |
Nov. 25, 2023, 9:03 p.m. |
OK |
GNU C11 |
TESTS |
16 |
436 |
819200 |
|
|
234346107 |
Unk1ndled |
D |
Nov. 26, 2023, 2:33 a.m. |
OK |
GNU C11 |
TESTS |
16 |
452 |
819200 |
|
|
234356507 |
WBS123 |
D |
Nov. 26, 2023, 5:33 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3174400 |
|
|
234326677 |
wakeup.....WAKE_UUUUUUP |
D |
Nov. 25, 2023, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3788800 |
|
|
234326672 |
wakeup.....WAKE_UUUUUUP |
D |
Nov. 25, 2023, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3788800 |
|
|
234315223 |
srikar03 |
D |
Nov. 25, 2023, 6:04 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3788800 |
|
|
234339192 |
Zhangrunnan |
D |
Nov. 25, 2023, 11:43 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3788800 |
|
|
234349446 |
fairyduck |
D |
Nov. 26, 2023, 3:37 a.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
3788800 |
|
|
234325599 |
Brute_Solo_Leveling |
D |
Nov. 25, 2023, 7:50 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
4198400 |
|
|
234314781 |
bunH2O |
D |
Nov. 25, 2023, 6:01 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
78 |
5017600 |
|
|
234300764 |
lyc1001 |
D |
Nov. 25, 2023, 4:52 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
93 |
819200 |
|
|
234291233 |
dongyinjie001 |
D |
Nov. 25, 2023, 4:19 p.m. |
OK |
GNU C++14 |
TESTS |
16 |
93 |
819200 |
|
|
234337342 |
sazas |
D |
Nov. 25, 2023, 10:57 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
62 |
3788800 |
|
|
234320992 |
MediationalField |
D |
Nov. 25, 2023, 6:57 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
62 |
17920000 |
|
|
234296729 |
AINgrey |
D |
Nov. 25, 2023, 4:38 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
62 |
17920000 |
|
|
234325724 |
wakeup.....WAKE_UUUUUUP |
D |
Nov. 25, 2023, 7:51 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
77 |
3788800 |
|
|
234295424 |
Amazed |
D |
Nov. 25, 2023, 4:33 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
77 |
4403200 |
|
|
234337299 |
Nada_A7med |
D |
Nov. 25, 2023, 10:57 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
3379200 |
|
|
234305251 |
Bestron |
D |
Nov. 25, 2023, 5:07 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
3379200 |
|
|
234341610 |
nianzi |
D |
Nov. 26, 2023, 12:56 a.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
3788800 |
|
|
234330227 |
ahmedmiz |
D |
Nov. 25, 2023, 8:52 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
3788800 |
|
|
234330061 |
ahmedmiz |
D |
Nov. 25, 2023, 8:49 p.m. |
OK |
GNU C++17 |
TESTS |
16 |
78 |
3788800 |
|
|
234296218 |
AbdalrhmanEssam |
D |
Nov. 25, 2023, 4:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
2048000 |
|
|
234325211 |
MrPerson |
D |
Nov. 25, 2023, 7:46 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
5324800 |
|
|
234358234 |
manishjha91 |
D |
Nov. 26, 2023, 5:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
5324800 |
|
|
234346979 |
DinosaurSlayer |
D |
Nov. 26, 2023, 2:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
5632000 |
|
|
234334888 |
ocelo7 |
D |
Nov. 25, 2023, 10:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
5632000 |
|
|
234314679 |
AnriEsoev |
D |
Nov. 25, 2023, 6 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
5734400 |
|
|
234340877 |
enslaved |
D |
Nov. 26, 2023, 12:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
6860800 |
|
|
234301346 |
John314 |
D |
Nov. 25, 2023, 4:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
62 |
29081600 |
|
|
234294089 |
prairie2022 |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
77 |
819200 |
|
|
234290070 |
Wielomian |
D |
Nov. 25, 2023, 4:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
16 |
77 |
2048000 |
|
|
234294371 |
CLT |
D |
Nov. 25, 2023, 4:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
31 |
2764800 |
|
|
234290871 |
TamingMeteor |
D |
Nov. 25, 2023, 4:17 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
31 |
7680000 |
|
|
234304993 |
1gfgh |
D |
Nov. 25, 2023, 5:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
31 |
100147200 |
|
|
234313998 |
Red_snow |
D |
Nov. 25, 2023, 5:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
409600 |
|
|
234330186 |
NatanVek |
D |
Nov. 25, 2023, 8:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
409600 |
|
|
234307478 |
anyejunwang |
D |
Nov. 25, 2023, 5:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
409600 |
|
|
234298122 |
ap12345 |
D |
Nov. 25, 2023, 4:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
819200 |
|
|
234352695 |
DanRan02 |
D |
Nov. 26, 2023, 4:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
819200 |
|
|
234294079 |
Nakagawa.Kanon |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
819200 |
|
|
234347340 |
pineapple_pizza69 |
D |
Nov. 26, 2023, 2:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
16 |
46 |
1843200 |
|
|
234291661 |
DarLam |
D |
Nov. 25, 2023, 4:20 p.m. |
OK |
Java 11 |
TESTS |
16 |
312 |
0 |
|
|
234290156 |
Yuki_B |
D |
Nov. 25, 2023, 4:15 p.m. |
OK |
Java 11 |
TESTS |
16 |
499 |
5632000 |
|
|
234318777 |
kasiru_69 |
D |
Nov. 25, 2023, 6:34 p.m. |
OK |
Java 11 |
TESTS |
16 |
810 |
0 |
|
|
234297330 |
Dukkha |
D |
Nov. 25, 2023, 4:40 p.m. |
OK |
Java 17 |
TESTS |
16 |
249 |
512000 |
|
|
234316178 |
Utsav82 |
D |
Nov. 25, 2023, 6:10 p.m. |
OK |
Java 17 |
TESTS |
16 |
249 |
5427200 |
|
|
234292011 |
TCchen |
D |
Nov. 25, 2023, 4:21 p.m. |
OK |
Java 17 |
TESTS |
16 |
280 |
409600 |
|
|
234340136 |
CutSandstone |
D |
Nov. 26, 2023, 12:10 a.m. |
OK |
Java 17 |
TESTS |
16 |
358 |
5529600 |
|
|
234356498 |
TopCloser |
D |
Nov. 26, 2023, 5:33 a.m. |
OK |
Java 17 |
TESTS |
16 |
358 |
5734400 |
|
|
234356669 |
TopCloser |
D |
Nov. 26, 2023, 5:35 a.m. |
OK |
Java 17 |
TESTS |
16 |
405 |
6348800 |
|
|
234356849 |
TopCloser |
D |
Nov. 26, 2023, 5:38 a.m. |
OK |
Java 17 |
TESTS |
16 |
421 |
6758400 |
|
|
234317366 |
Eslam_Ahmed |
D |
Nov. 25, 2023, 6:20 p.m. |
OK |
Java 17 |
TESTS |
16 |
686 |
13312000 |
|
|
234297483 |
mapleKing |
D |
Nov. 25, 2023, 4:40 p.m. |
OK |
Java 17 |
TESTS |
16 |
920 |
614400 |
|
|
234297366 |
mcrash12 |
D |
Nov. 25, 2023, 4:40 p.m. |
OK |
Java 21 |
TESTS |
16 |
607 |
5120000 |
|
|
234317304 |
Eslam_Ahmed |
D |
Nov. 25, 2023, 6:20 p.m. |
OK |
Java 21 |
TESTS |
16 |
795 |
12800000 |
|
|
234296281 |
110101011 |
D |
Nov. 25, 2023, 4:36 p.m. |
OK |
Java 8 |
TESTS |
16 |
187 |
0 |
|
|
234314213 |
aditya888 |
D |
Nov. 25, 2023, 5:57 p.m. |
OK |
Java 8 |
TESTS |
16 |
218 |
0 |
|
|
234301489 |
rowechen |
D |
Nov. 25, 2023, 4:54 p.m. |
OK |
Java 8 |
TESTS |
16 |
218 |
0 |
|
|
234298943 |
invincible777 |
D |
Nov. 25, 2023, 4:45 p.m. |
OK |
Java 8 |
TESTS |
16 |
249 |
1126400 |
|
|
234292210 |
Eslam_Ahmed |
D |
Nov. 25, 2023, 4:22 p.m. |
OK |
Java 8 |
TESTS |
16 |
732 |
8089600 |
|
|
234325467 |
arvindf232 |
D |
Nov. 25, 2023, 7:48 p.m. |
OK |
Kotlin 1.6 |
TESTS |
16 |
280 |
0 |
|
|
234294147 |
kre |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
Kotlin 1.7 |
TESTS |
16 |
1278 |
124723200 |
|
|
234305823 |
maxK99 |
D |
Nov. 25, 2023, 5:09 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
234 |
1638400 |
|
|
234294167 |
Piashy |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
MS C++ 2017 |
TESTS |
16 |
234 |
3686400 |
|
|
234330954 |
sixthcore |
D |
Nov. 25, 2023, 9:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
358 |
26214400 |
|
|
234293097 |
ossau_guildo |
D |
Nov. 25, 2023, 4:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
374 |
14233600 |
|
|
234315119 |
2025 |
D |
Nov. 25, 2023, 6:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
405 |
14745600 |
|
|
234290498 |
abc_2002 |
D |
Nov. 25, 2023, 4:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
436 |
13824000 |
|
|
234313233 |
wish-nu |
D |
Nov. 25, 2023, 5:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
452 |
34611200 |
|
|
234295552 |
plevande |
D |
Nov. 25, 2023, 4:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
483 |
29798400 |
|
|
234332778 |
the_last_smilodon |
D |
Nov. 25, 2023, 9:30 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
514 |
21401600 |
|
|
234294876 |
khanter_ |
D |
Nov. 25, 2023, 4:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
623 |
14643200 |
|
|
234299706 |
katonyonko |
D |
Nov. 25, 2023, 4:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
826 |
20377600 |
|
|
234294317 |
flygon |
D |
Nov. 25, 2023, 4:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
16 |
888 |
19046400 |
|
|
234316031 |
kaivalya1809 |
D |
Nov. 25, 2023, 6:09 p.m. |
OK |
Python 3 |
TESTS |
16 |
748 |
12288000 |
|
|
234329561 |
haihamabossu |
D |
Nov. 25, 2023, 8:42 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
62 |
6758400 |
|
|
234296165 |
kost |
D |
Nov. 25, 2023, 4:36 p.m. |
OK |
Rust 2021 |
TESTS |
16 |
77 |
6656000 |
|
|
remove filters
Back to search problems