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 two binary strings a and b of length n . In each move, the string a is modified in the following way. What is the expected number of moves required to make both strings equal for the first time? A binary string is a string, in which the character is either tt{0} or tt{1} . The first line contains a single integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q 10^6 ) -- the length of the strings. The second line of each test case contains the binary string a of length n . The third line of each test case contains the binary string b of length n . It is guaranteed that the sum of n over all test cases does not exceed 10^6 . For each test case, output a single line containing the expected number of moves modulo 998 ,244 ,353 . Formally, let M = 998 ,244 ,353 . It can be shown that the answer can be expressed as an irreducible fraction frac{p}{q} , where p and q are integers and q not equiv 0 pmod{M} . Output the integer equal to p cdot q^{-1} bmod M . In other words, output such an integer x that 0 <= x < M and x cdot q equiv p pmod{M} . In the first test case, index 1 is chosen randomly and a_1 is flipped. After the move, the strings a and b are equal. The expected number of moves is 1 . The strings a and b are already equal in the second test case. So, the expected number of moves is 0 . The expected number of moves for the third and fourth test cases are frac{56}{3} and frac{125}{3} respectively. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
191652101 |
Tdyx |
D |
Feb. 2, 2023, 3:54 a.m. |
OK |
C# 10 |
TESTS |
24 |
530 |
19353600 |
|
|
191592936 |
mban259 |
D |
Feb. 1, 2023, 4:02 p.m. |
OK |
C# 10 |
TESTS |
24 |
530 |
27750400 |
|
|
191647730 |
YeahPotato |
D |
Feb. 2, 2023, 2:48 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
108 |
20070400 |
|
|
191635852 |
GreatJMore |
D |
Feb. 1, 2023, 10:40 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
140 |
18022400 |
|
|
191647304 |
wsyhb |
D |
Feb. 2, 2023, 2:41 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
156 |
14336000 |
|
|
191597278 |
Cai1000 |
D |
Feb. 1, 2023, 4:16 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
187 |
84172800 |
|
|
191640137 |
MIKEFENG |
D |
Feb. 2, 2023, 12:31 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
202 |
26112000 |
|
|
191643626 |
vjudge3 |
D |
Feb. 2, 2023, 1:40 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
389 |
6041600 |
|
|
191618059 |
iliya_mon |
D |
Feb. 1, 2023, 6:33 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
404 |
129331200 |
|
|
191660601 |
superyijin |
D |
Feb. 2, 2023, 5:35 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
405 |
19148800 |
|
|
191618510 |
not_a_genius |
D |
Feb. 1, 2023, 6:37 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
421 |
11161600 |
|
|
191613827 |
mod998244353 |
D |
Feb. 1, 2023, 6 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
421 |
12083200 |
|
|
191625017 |
shaurya001 |
D |
Feb. 1, 2023, 7:48 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
124 |
11161600 |
|
|
191644148 |
287029 |
D |
Feb. 2, 2023, 1:50 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
139 |
14131200 |
|
|
191643728 |
1101_ |
D |
Feb. 2, 2023, 1:42 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
139 |
26214400 |
|
|
191620253 |
Saransh6772 |
D |
Feb. 1, 2023, 6:54 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
140 |
11161600 |
|
|
191615378 |
nauynix |
D |
Feb. 1, 2023, 6:11 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
140 |
19456000 |
|
|
191597464 |
undec |
D |
Feb. 1, 2023, 4:17 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
155 |
3379200 |
|
|
191638539 |
handsome_Lee66 |
D |
Feb. 1, 2023, 11:49 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
155 |
6144000 |
|
|
191630263 |
AhmedKhaled |
D |
Feb. 1, 2023, 9 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
155 |
11161600 |
|
|
191608985 |
ORIGNAL_SENSEI |
D |
Feb. 1, 2023, 5:30 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
155 |
11161600 |
|
|
191608559 |
masterchief831 |
D |
Feb. 1, 2023, 5:28 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
155 |
11161600 |
|
|
191654931 |
Shangguanyunxiao |
D |
Feb. 2, 2023, 4:16 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
92 |
27750400 |
|
|
191629444 |
enslaved |
D |
Feb. 1, 2023, 8:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
93 |
15769600 |
|
|
191598474 |
FillBred |
D |
Feb. 1, 2023, 4:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
93 |
20172800 |
|
|
191607821 |
Shangguanyunxiao |
D |
Feb. 1, 2023, 5:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
93 |
27750400 |
|
|
191594231 |
AlveRahman |
D |
Feb. 1, 2023, 4:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
108 |
27750400 |
|
|
191660781 |
euoao |
D |
Feb. 2, 2023, 5:37 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
140 |
7680000 |
|
|
191648610 |
Luv_Ray |
D |
Feb. 2, 2023, 3:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
140 |
10035200 |
|
|
191640398 |
SATSKY |
D |
Feb. 2, 2023, 12:36 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
140 |
10035200 |
|
|
191660028 |
yh11 |
D |
Feb. 2, 2023, 5:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
140 |
11673600 |
|
|
191603199 |
EE97 |
D |
Feb. 1, 2023, 4:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
155 |
7680000 |
|
|
191614052 |
musatur |
D |
Feb. 1, 2023, 6:02 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
61 |
27545600 |
|
|
191613692 |
Aestivate |
D |
Feb. 1, 2023, 5:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
13004800 |
|
|
191601071 |
Joler_ |
D |
Feb. 1, 2023, 4:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
13004800 |
|
|
191655587 |
Aurora_xz |
D |
Feb. 2, 2023, 4:26 a.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
20992000 |
|
|
191627879 |
Sy_03 |
D |
Feb. 1, 2023, 8:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
30105600 |
|
|
191648794 |
Alice114514 |
D |
Feb. 2, 2023, 3:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
62 |
31539200 |
|
|
191608346 |
Ayham_Dabah |
D |
Feb. 1, 2023, 5:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
77 |
11468800 |
|
|
191601899 |
Ayham_Dabah |
D |
Feb. 1, 2023, 4:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
77 |
11468800 |
|
|
191613439 |
Aestivate |
D |
Feb. 1, 2023, 5:57 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
77 |
12902400 |
|
|
191612537 |
Mahmoud-Khalid |
D |
Feb. 1, 2023, 5:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
77 |
13004800 |
|
|
191602266 |
rlblaster |
D |
Feb. 1, 2023, 4:32 p.m. |
OK |
Go |
TESTS |
24 |
249 |
29081600 |
|
|
191618965 |
dzhi |
D |
Feb. 1, 2023, 6:41 p.m. |
OK |
Java 11 |
TESTS |
24 |
967 |
12595200 |
|
|
191619113 |
dzhi |
D |
Feb. 1, 2023, 6:42 p.m. |
OK |
Java 11 |
TESTS |
24 |
1123 |
73625600 |
|
|
191615177 |
dzhi |
D |
Feb. 1, 2023, 6:10 p.m. |
OK |
Java 11 |
TESTS |
24 |
1544 |
6963200 |
|
|
191607795 |
profchi |
D |
Feb. 1, 2023, 5:25 p.m. |
OK |
Java 11 |
TESTS |
24 |
1808 |
19968000 |
|
|
191610103 |
dzhi |
D |
Feb. 1, 2023, 5:36 p.m. |
OK |
Java 11 |
TESTS |
24 |
1824 |
73625600 |
|
|
191617101 |
MagentaCobra |
D |
Feb. 1, 2023, 6:25 p.m. |
OK |
Java 8 |
TESTS |
24 |
265 |
28057600 |
|
|
191642135 |
cc4414 |
D |
Feb. 2, 2023, 1:12 a.m. |
OK |
Java 8 |
TESTS |
24 |
623 |
58880000 |
|
|
191656894 |
megaspazz |
D |
Feb. 2, 2023, 4:45 a.m. |
OK |
Java 8 |
TESTS |
24 |
935 |
39628800 |
|
|
191628141 |
megaspazz |
D |
Feb. 1, 2023, 8:28 p.m. |
OK |
Java 8 |
TESTS |
24 |
1153 |
92569600 |
|
|
191609681 |
elizarov |
D |
Feb. 1, 2023, 5:34 p.m. |
OK |
Kotlin 1.7 |
TESTS |
24 |
1076 |
63078400 |
|
|
191614413 |
oadey89 |
D |
Feb. 1, 2023, 6:04 p.m. |
OK |
PyPy 2 |
TESTS |
24 |
1934 |
130867200 |
|
|
191596634 |
yupooh |
D |
Feb. 1, 2023, 4:14 p.m. |
OK |
PyPy 3 |
TESTS |
24 |
1622 |
76492800 |
|
|
191612307 |
hxu10 |
D |
Feb. 1, 2023, 5:50 p.m. |
OK |
PyPy 3 |
TESTS |
24 |
1762 |
125542400 |
|
|
191643012 |
00zijian |
D |
Feb. 2, 2023, 1:29 a.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
295 |
44953600 |
|
|
191649917 |
yupooh |
D |
Feb. 2, 2023, 3:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
295 |
60313600 |
|
|
191593992 |
roaris |
D |
Feb. 1, 2023, 4:05 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
311 |
29696000 |
|
|
191600299 |
hulahula3247 |
D |
Feb. 1, 2023, 4:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
342 |
11468800 |
|
|
191636017 |
Remineva |
D |
Feb. 1, 2023, 10:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
452 |
13414400 |
|
|
191628445 |
codicon |
D |
Feb. 1, 2023, 8:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
452 |
14540800 |
|
|
191637656 |
BrendanSGubbins |
D |
Feb. 1, 2023, 11:25 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
482 |
21196800 |
|
|
191636067 |
Remineva |
D |
Feb. 1, 2023, 10:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
482 |
21196800 |
|
|
191635675 |
Remineva |
D |
Feb. 1, 2023, 10:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
498 |
14233600 |
|
|
191624754 |
hulahula3247 |
D |
Feb. 1, 2023, 7:45 p.m. |
OK |
PyPy 3-64 |
TESTS |
24 |
530 |
11878400 |
|
|
191633695 |
liut |
D |
Feb. 1, 2023, 9:55 p.m. |
OK |
Rust 2021 |
TESTS |
24 |
499 |
11571200 |
|
|
remove filters
Back to search problems