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'There is a binary string a of length n . In one operation, you can select any prefix of a with an equal number of 0 and 1 symbols. Then all symbols in the prefix are inverted: each 0 becomes 1 and each 1 becomes 0 . For example, suppose a=0111010000 . Can you transform the string a into the string b using some finite number of operations (possibly, none)? The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 3 cdot 10^5 ) -- the length of the strings a and b . The following two lines contain strings a and b of length n , consisting of symbols 0 and 1 . The sum of n across all test cases does not exceed 3 cdot 10^5 . For each test case, output "YES" if it is possible to transform a into b , or "NO" if it is impossible. You can print each letter in any case (upper or lower). The first test case is shown in the statement. In the second test case, we transform a into b by using zero operations. In the third test case, there is no legal operation, so it is impossible to transform a into b . In the fourth test case, here is one such transformation: In the fifth test case, the only legal operation is to transform a into 111000 . From there, the only legal operation is to return to the string we started with, so we cannot transform a into b . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
111946973 |
Bishal256 |
B |
April 3, 2021, 6:59 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
33 |
326 |
16179200 |
|
1200 |
111960696 |
bot_hibiki |
B |
April 4, 2021, 2:35 a.m. |
OK |
GNU C11 |
TESTS |
33 |
31 |
2969600 |
|
1200 |
111940753 |
chowdhuryshashwoto |
B |
April 3, 2021, 5:48 p.m. |
OK |
GNU C11 |
TESTS |
33 |
62 |
614400 |
|
1200 |
111964826 |
_PaRz1VaL |
B |
April 4, 2021, 4:23 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111960340 |
fishcathu. |
B |
April 4, 2021, 2:24 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111934079 |
Naii_the_Baf |
B |
April 3, 2021, 4:41 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111960727 |
NightStalker |
B |
April 4, 2021, 2:36 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111956466 |
do_while_not_not_true |
B |
April 3, 2021, 11:28 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
1228800 |
|
1200 |
111946637 |
alokmaurya_81 |
B |
April 3, 2021, 6:54 p.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111957752 |
picachu |
B |
April 4, 2021, 12:34 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111961559 |
invaded |
B |
April 4, 2021, 2:59 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
1843200 |
|
1200 |
111957363 |
mazihang2022 |
B |
April 4, 2021, 12:14 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
2764800 |
|
1200 |
111957668 |
luogu_bot5 |
B |
April 4, 2021, 12:30 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
31 |
2867200 |
|
1200 |
111964815 |
RaviNadoda |
B |
April 4, 2021, 4:23 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111963359 |
jaishreeram2001 |
B |
April 4, 2021, 3:46 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111962562 |
kjoshi_ |
B |
April 4, 2021, 3:26 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111960572 |
XwolverineX |
B |
April 4, 2021, 2:31 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111952643 |
KunKKa |
B |
April 3, 2021, 9:07 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111950195 |
Neel_Patel |
B |
April 3, 2021, 8:07 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111949979 |
akash028 |
B |
April 3, 2021, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111946995 |
_testing |
B |
April 3, 2021, 7 p.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111965428 |
prshntsrivas |
B |
April 4, 2021, 4:41 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111969639 |
Jeel_patel_1812 |
B |
April 4, 2021, 5:59 a.m. |
OK |
GNU C++14 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111933258 |
ke_123 |
B |
April 3, 2021, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111969763 |
rheallyc |
B |
April 4, 2021, 6:01 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111941847 |
aboAdnan |
B |
April 3, 2021, 5:57 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111928376 |
g135136 |
B |
April 3, 2021, 4:24 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
614400 |
|
1200 |
111933404 |
spOy |
B |
April 3, 2021, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
921600 |
|
1200 |
111969005 |
harshnv.26 |
B |
April 4, 2021, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111967728 |
preet_mungra |
B |
April 4, 2021, 5:29 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111967112 |
Nipen_Paul |
B |
April 4, 2021, 5:18 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111966783 |
deuslovelt |
B |
April 4, 2021, 5:12 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111969071 |
logbase2 |
B |
April 4, 2021, 5:51 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111960102 |
Pino |
B |
April 4, 2021, 2:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111953254 |
praveenojha33 |
B |
April 3, 2021, 9:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111953253 |
ale_naser_pastoriza |
B |
April 3, 2021, 9:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111952071 |
timoffey14 |
B |
April 3, 2021, 8:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111959407 |
12662 |
B |
April 4, 2021, 1:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111967586 |
Rextrom |
B |
April 4, 2021, 5:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111966714 |
alyanser |
B |
April 4, 2021, 5:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111965171 |
it_aint_me |
B |
April 4, 2021, 4:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111961221 |
ayush_nishad |
B |
April 4, 2021, 2:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111961133 |
ayush_nishad |
B |
April 4, 2021, 2:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
31 |
1536000 |
|
1200 |
111959612 |
Puru299792458 |
B |
April 4, 2021, 1:58 a.m. |
OK |
Go |
TESTS |
33 |
62 |
4812800 |
|
1200 |
111929876 |
jtk |
B |
April 3, 2021, 4:29 p.m. |
OK |
Go |
TESTS |
33 |
78 |
4812800 |
|
1200 |
111969918 |
codelegend |
B |
April 4, 2021, 6:03 a.m. |
OK |
Haskell |
TESTS |
33 |
171 |
24268800 |
|
1200 |
111941927 |
zting |
B |
April 3, 2021, 5:58 p.m. |
OK |
Java 11 |
TESTS |
33 |
187 |
0 |
|
1200 |
111948071 |
coder0687 |
B |
April 3, 2021, 7:18 p.m. |
OK |
Java 11 |
TESTS |
33 |
202 |
0 |
|
1200 |
111955069 |
valeesi |
B |
April 3, 2021, 10:23 p.m. |
OK |
Java 11 |
TESTS |
33 |
202 |
0 |
|
1200 |
111943602 |
ankit_bit |
B |
April 3, 2021, 6:15 p.m. |
OK |
Java 11 |
TESTS |
33 |
202 |
0 |
|
1200 |
111943535 |
HastaLaVistaLa |
B |
April 3, 2021, 6:14 p.m. |
OK |
Java 11 |
TESTS |
33 |
202 |
0 |
|
1200 |
111962139 |
DavinderSinghKharoud |
B |
April 4, 2021, 3:15 a.m. |
OK |
Java 11 |
TESTS |
33 |
218 |
0 |
|
1200 |
111941643 |
RuthlessAggression |
B |
April 3, 2021, 5:55 p.m. |
OK |
Java 11 |
TESTS |
33 |
218 |
2662400 |
|
1200 |
111937211 |
mrlucent |
B |
April 3, 2021, 4:49 p.m. |
OK |
Java 11 |
TESTS |
33 |
233 |
0 |
|
1200 |
111947197 |
DetoAce |
B |
April 3, 2021, 7:03 p.m. |
OK |
Java 11 |
TESTS |
33 |
248 |
0 |
|
1200 |
111951609 |
_merlin_ |
B |
April 3, 2021, 8:39 p.m. |
OK |
Java 11 |
TESTS |
33 |
249 |
5017600 |
|
1200 |
111947609 |
Devil__ |
B |
April 3, 2021, 7:09 p.m. |
OK |
Java 8 |
TESTS |
33 |
124 |
0 |
|
1200 |
111964255 |
kira_101 |
B |
April 4, 2021, 4:07 a.m. |
OK |
Java 8 |
TESTS |
33 |
139 |
0 |
|
1200 |
111954862 |
RonWonWon |
B |
April 3, 2021, 10:16 p.m. |
OK |
Java 8 |
TESTS |
33 |
140 |
0 |
|
1200 |
111939442 |
myaw |
B |
April 3, 2021, 5:39 p.m. |
OK |
Java 8 |
TESTS |
33 |
140 |
0 |
|
1200 |
111939348 |
Mr.Awesome |
B |
April 3, 2021, 5:39 p.m. |
OK |
Java 8 |
TESTS |
33 |
140 |
0 |
|
1200 |
111931150 |
java. |
B |
April 3, 2021, 4:32 p.m. |
OK |
Java 8 |
TESTS |
33 |
155 |
0 |
|
1200 |
111927054 |
vizaar128 |
B |
April 3, 2021, 4:21 p.m. |
OK |
Java 8 |
TESTS |
33 |
155 |
0 |
|
1200 |
111969260 |
GTnoob14 |
B |
April 4, 2021, 5:53 a.m. |
OK |
Java 8 |
TESTS |
33 |
187 |
0 |
|
1200 |
111962706 |
aggarwalanshul01 |
B |
April 4, 2021, 3:29 a.m. |
OK |
Java 8 |
TESTS |
33 |
187 |
0 |
|
1200 |
111934503 |
_mcubed123 |
B |
April 3, 2021, 4:42 p.m. |
OK |
Java 8 |
TESTS |
33 |
217 |
0 |
|
1200 |
111954461 |
mnrmustafa |
B |
April 3, 2021, 10:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
46 |
1536000 |
|
1200 |
111963017 |
dingzhao777 |
B |
April 4, 2021, 3:37 a.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
46 |
2048000 |
|
1200 |
111960713 |
SlatyFish |
B |
April 4, 2021, 2:35 a.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
77 |
819200 |
|
1200 |
111952197 |
Ilyaiq300 |
B |
April 3, 2021, 8:55 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
77 |
3686400 |
|
1200 |
111940058 |
ustaritz |
B |
April 3, 2021, 5:43 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
92 |
6656000 |
|
1200 |
111954563 |
Myao |
B |
April 3, 2021, 10:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
93 |
1536000 |
|
1200 |
111950403 |
zkxshg |
B |
April 3, 2021, 8:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
93 |
5836800 |
|
1200 |
111931457 |
CCCCC_zxc |
B |
April 3, 2021, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
171 |
4710400 |
|
1200 |
111927443 |
Willemkmetsch |
B |
April 3, 2021, 4:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
187 |
2457600 |
|
1200 |
111931481 |
danthanhhuynhpham |
B |
April 3, 2021, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
33 |
202 |
3072000 |
|
1200 |
111945623 |
Anuranjan_Pandey |
B |
April 3, 2021, 6:40 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
202 |
17305600 |
|
1200 |
111960171 |
majay1638 |
B |
April 4, 2021, 2:21 a.m. |
OK |
PyPy 3 |
TESTS |
33 |
218 |
9113600 |
|
1200 |
111944358 |
deepanshu_pali |
B |
April 3, 2021, 6:24 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
218 |
11059200 |
|
1200 |
111954724 |
pk31299 |
B |
April 3, 2021, 10:12 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
249 |
9932800 |
|
1200 |
111955444 |
light_yagami52 |
B |
April 3, 2021, 10:36 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
249 |
17305600 |
|
1200 |
111929740 |
bjy |
B |
April 3, 2021, 4:28 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
280 |
9011200 |
|
1200 |
111943177 |
krishna369 |
B |
April 3, 2021, 6:10 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
280 |
17305600 |
|
1200 |
111926927 |
Adroit_2k2 |
B |
April 3, 2021, 4:20 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
280 |
17305600 |
|
1200 |
111946118 |
SPD_9X2 |
B |
April 3, 2021, 6:46 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
280 |
18124800 |
|
1200 |
111949093 |
silvertint |
B |
April 3, 2021, 7:39 p.m. |
OK |
PyPy 3 |
TESTS |
33 |
280 |
25395200 |
|
1200 |
111957839 |
Koki_tkg |
B |
April 4, 2021, 12:38 a.m. |
OK |
Python 3 |
TESTS |
33 |
202 |
3686400 |
|
1200 |
111941821 |
Dhruv_Vavliya |
B |
April 3, 2021, 5:57 p.m. |
OK |
Python 3 |
TESTS |
33 |
249 |
1638400 |
|
1200 |
111952034 |
IngaleAnkur10 |
B |
April 3, 2021, 8:51 p.m. |
OK |
Python 3 |
TESTS |
33 |
249 |
9625600 |
|
1200 |
111942988 |
yatinagg |
B |
April 3, 2021, 6:08 p.m. |
OK |
Python 3 |
TESTS |
33 |
264 |
1638400 |
|
1200 |
111943817 |
snape_here |
B |
April 3, 2021, 6:17 p.m. |
OK |
Python 3 |
TESTS |
33 |
264 |
11980800 |
|
1200 |
111948725 |
rashed_khalil7 |
B |
April 3, 2021, 7:33 p.m. |
OK |
Python 3 |
TESTS |
33 |
280 |
13107200 |
|
1200 |
111933351 |
VarAmu |
B |
April 3, 2021, 4:39 p.m. |
OK |
Python 3 |
TESTS |
33 |
280 |
16588800 |
|
1200 |
111953091 |
ilgizar1313 |
B |
April 3, 2021, 9:19 p.m. |
OK |
Python 3 |
TESTS |
33 |
311 |
1638400 |
|
1200 |
111961568 |
tusharjain0022 |
B |
April 4, 2021, 3 a.m. |
OK |
Python 3 |
TESTS |
33 |
327 |
1740800 |
|
1200 |
111963330 |
mayankmittal9269 |
B |
April 4, 2021, 3:45 a.m. |
OK |
Python 3 |
TESTS |
33 |
327 |
3993600 |
|
1200 |
remove filters
Back to search problems