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'Cirno gave AquaMoon a chessboard of size 1 x n . Its cells are numbered with integers from 1 to n from left to right. In the beginning, some of the cells are occupied with at most one pawn, and other cells are unoccupied. In each operation, AquaMoon can choose a cell i with a pawn, and do either of the following (if possible): You are given an initial state of the chessboard. AquaMoon wants to count the number of states reachable from the initial state with some sequence of operations. But she is not good at programming. Can you help her? As the answer can be large find it modulo 998 ,244 ,353 . The input consists of multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 10 ,000 ) -- the number of test cases. The first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the size of the chessboard. The second line contains a string of n characters, consists of characters "0" and "1". If the i -th character is "1", the i -th cell is initially occupied; otherwise, the i -th cell is initially unoccupied. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print the number of states that reachable from the initial state with some sequence of operations modulo 998 ,244 ,353 . In the first test case the strings "1100", "0110" and "0011" are reachable from the initial state with some sequence of operations. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
122095834 |
Gassa |
B |
July 11, 2021, 2:47 p.m. |
OK |
D |
TESTS |
17 |
31 |
9728000 |
|
1900 |
122086681 |
yao11617 |
B |
July 11, 2021, 2:29 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
15 |
3788800 |
|
1900 |
122102103 |
srijon51 |
B |
July 11, 2021, 3:01 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
15 |
4812800 |
|
1900 |
122143066 |
fishcathu. |
B |
July 11, 2021, 7:34 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
3993600 |
|
1900 |
122082134 |
ghj1222 |
B |
July 11, 2021, 2:21 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122143267 |
fishcathu. |
B |
July 11, 2021, 7:38 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122103416 |
fr200110217102 |
B |
July 11, 2021, 3:04 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122098366 |
zhuzhirui2005 |
B |
July 11, 2021, 2:52 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122116266 |
1.618 |
B |
July 11, 2021, 3:41 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
5632000 |
|
1900 |
122112311 |
gary888 |
B |
July 11, 2021, 3:28 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
6860800 |
|
1900 |
122155187 |
dengyipeng |
B |
July 11, 2021, 11:58 p.m. |
OK |
GNU C++11 |
TESTS |
17 |
30 |
7680000 |
|
1900 |
122086325 |
kimjihoon |
B |
July 11, 2021, 2:29 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
3993600 |
|
1900 |
122099541 |
Vin__ar |
B |
July 11, 2021, 2:55 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122106094 |
cypherop |
B |
July 11, 2021, 3:11 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122098452 |
ngpin04 |
B |
July 11, 2021, 2:52 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
4812800 |
|
1900 |
122095238 |
Solashiro |
B |
July 11, 2021, 2:45 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5427200 |
|
1900 |
122086687 |
BSBandme |
B |
July 11, 2021, 2:29 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5427200 |
|
1900 |
122090565 |
guangmutianwang |
B |
July 11, 2021, 2:36 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5427200 |
|
1900 |
122099727 |
adnan_toky |
B |
July 11, 2021, 2:55 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5632000 |
|
1900 |
122086049 |
binsjl |
B |
July 11, 2021, 2:28 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5632000 |
|
1900 |
122091575 |
Fidisk |
B |
July 11, 2021, 2:38 p.m. |
OK |
GNU C++14 |
TESTS |
17 |
30 |
5632000 |
|
1900 |
122093611 |
Periquito |
B |
July 11, 2021, 2:42 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
3993600 |
|
1900 |
122124832 |
Nickir |
B |
July 11, 2021, 4:12 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
3993600 |
|
1900 |
122100939 |
thatprogrammer |
B |
July 11, 2021, 2:58 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
4710400 |
|
1900 |
122089608 |
PogosovArseny |
B |
July 11, 2021, 2:34 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
4812800 |
|
1900 |
122167500 |
Qg3 |
B |
July 12, 2021, 4:25 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
4812800 |
|
1900 |
122165811 |
izhang05 |
B |
July 12, 2021, 3:53 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
15 |
5222400 |
|
1900 |
122104695 |
y_men9_dva_po_fizike |
B |
July 11, 2021, 3:07 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
5324800 |
|
1900 |
122112700 |
jiaangk_ |
B |
July 11, 2021, 3:29 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
5529600 |
|
1900 |
122109937 |
Nson |
B |
July 11, 2021, 3:21 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
5529600 |
|
1900 |
122123249 |
doublewang |
B |
July 11, 2021, 4:06 p.m. |
OK |
GNU C++17 |
TESTS |
17 |
15 |
5632000 |
|
1900 |
122077496 |
jiangly |
B |
July 11, 2021, 2:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
4608000 |
|
1900 |
122100893 |
JasonLan |
B |
July 11, 2021, 2:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
5222400 |
|
1900 |
122089415 |
ollpu |
B |
July 11, 2021, 2:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
5324800 |
|
1900 |
122093693 |
Lawali |
B |
July 11, 2021, 2:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
5324800 |
|
1900 |
122098559 |
emthrm |
B |
July 11, 2021, 2:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
5939200 |
|
1900 |
122093268 |
edenooo |
B |
July 11, 2021, 2:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
6144000 |
|
1900 |
122113812 |
zhaoyiping |
B |
July 11, 2021, 3:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
6144000 |
|
1900 |
122096020 |
oleh1421 |
B |
July 11, 2021, 2:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
6144000 |
|
1900 |
122122025 |
hardikkapoor |
B |
July 11, 2021, 4:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
6144000 |
|
1900 |
122127950 |
Agnimandur |
B |
July 11, 2021, 4:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
17 |
15 |
6144000 |
|
1900 |
122091374 |
clyring |
B |
July 11, 2021, 2:38 p.m. |
OK |
Haskell |
TESTS |
17 |
77 |
11673600 |
|
1900 |
122117778 |
2020akadaver |
B |
July 11, 2021, 3:46 p.m. |
OK |
Java 11 |
TESTS |
17 |
202 |
23859200 |
|
1900 |
122084200 |
uwi |
B |
July 11, 2021, 2:25 p.m. |
OK |
Java 11 |
TESTS |
17 |
217 |
23961600 |
|
1900 |
122091845 |
shilov |
B |
July 11, 2021, 2:39 p.m. |
OK |
Java 11 |
TESTS |
17 |
233 |
23859200 |
|
1900 |
122103597 |
Discombobulated |
B |
July 11, 2021, 3:04 p.m. |
OK |
Java 11 |
TESTS |
17 |
249 |
25395200 |
|
1900 |
122099110 |
martins |
B |
July 11, 2021, 2:54 p.m. |
OK |
Java 11 |
TESTS |
17 |
249 |
27955200 |
|
1900 |
122102200 |
cirno3153 |
B |
July 11, 2021, 3:01 p.m. |
OK |
Java 11 |
TESTS |
17 |
296 |
41472000 |
|
1900 |
122118922 |
hu_tao |
B |
July 11, 2021, 3:50 p.m. |
OK |
Java 8 |
TESTS |
17 |
109 |
20480000 |
|
1900 |
122099407 |
dalt |
B |
July 11, 2021, 2:55 p.m. |
OK |
Java 8 |
TESTS |
17 |
124 |
21606400 |
|
1900 |
122115789 |
DarLam |
B |
July 11, 2021, 3:39 p.m. |
OK |
Java 8 |
TESTS |
17 |
140 |
20787200 |
|
1900 |
122107156 |
golions |
B |
July 11, 2021, 3:13 p.m. |
OK |
Java 8 |
TESTS |
17 |
155 |
20480000 |
|
1900 |
122105804 |
Hakiobo |
B |
July 11, 2021, 3:10 p.m. |
OK |
Kotlin |
TESTS |
17 |
140 |
20992000 |
|
1900 |
122112390 |
knightL |
B |
July 11, 2021, 3:28 p.m. |
OK |
Kotlin |
TESTS |
17 |
187 |
20684800 |
|
1900 |
122084116 |
Tlatoani |
B |
July 11, 2021, 2:25 p.m. |
OK |
Kotlin |
TESTS |
17 |
218 |
20684800 |
|
1900 |
122113097 |
Friska |
B |
July 11, 2021, 3:31 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
31 |
3993600 |
|
1900 |
122118351 |
vpike |
B |
July 11, 2021, 3:48 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
77 |
5632000 |
|
1900 |
122091053 |
Catmoonlight |
B |
July 11, 2021, 2:37 p.m. |
OK |
MS C++ 2017 |
TESTS |
17 |
109 |
3993600 |
|
1900 |
122115602 |
azukun |
B |
July 11, 2021, 3:39 p.m. |
OK |
.NET Core C# |
TESTS |
17 |
93 |
16588800 |
|
1900 |
122103924 |
terry_u16 |
B |
July 11, 2021, 3:05 p.m. |
OK |
.NET Core C# |
TESTS |
17 |
93 |
21196800 |
|
1900 |
122079136 |
Yupiteru |
B |
July 11, 2021, 2:16 p.m. |
OK |
.NET Core C# |
TESTS |
17 |
108 |
18124800 |
|
1900 |
122104395 |
.I. |
B |
July 11, 2021, 3:06 p.m. |
OK |
.NET Core C# |
TESTS |
17 |
171 |
16179200 |
|
1900 |
122114774 |
nagiss |
B |
July 11, 2021, 3:36 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
202 |
35430400 |
|
1900 |
122125189 |
misorin |
B |
July 11, 2021, 4:14 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
233 |
37068800 |
|
1900 |
122084287 |
hir35 |
B |
July 11, 2021, 2:25 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
249 |
35328000 |
|
1900 |
122097793 |
SPD_9X2 |
B |
July 11, 2021, 2:51 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
264 |
48640000 |
|
1900 |
122096391 |
asdsasd |
B |
July 11, 2021, 2:48 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
311 |
46592000 |
|
1900 |
122130002 |
eepsilon |
B |
July 11, 2021, 4:32 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
514 |
35635200 |
|
1900 |
122112808 |
googol_S0 |
B |
July 11, 2021, 3:30 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
514 |
75468800 |
|
1900 |
122092557 |
musdolph |
B |
July 11, 2021, 2:40 p.m. |
OK |
PyPy 3 |
TESTS |
17 |
779 |
29491200 |
|
1900 |
122121994 |
nwi |
B |
July 11, 2021, 4:01 p.m. |
OK |
Python 2 |
TESTS |
17 |
187 |
11059200 |
|
1900 |
122083342 |
belkka |
B |
July 11, 2021, 2:23 p.m. |
OK |
Python 3 |
TESTS |
17 |
171 |
8806400 |
|
1900 |
122089619 |
VTifand |
B |
July 11, 2021, 2:34 p.m. |
OK |
Python 3 |
TESTS |
17 |
186 |
9728000 |
|
1900 |
122143021 |
belkka |
B |
July 11, 2021, 7:33 p.m. |
OK |
Python 3 |
TESTS |
17 |
187 |
8704000 |
|
1900 |
122144792 |
belkka |
B |
July 11, 2021, 8:08 p.m. |
OK |
Python 3 |
TESTS |
17 |
218 |
8294400 |
|
1900 |
122087695 |
sansen |
B |
July 11, 2021, 2:31 p.m. |
OK |
Rust |
TESTS |
17 |
62 |
17203200 |
|
1900 |
122096657 |
cottoncotton |
B |
July 11, 2021, 2:48 p.m. |
OK |
Rust |
TESTS |
17 |
92 |
4812800 |
|
1900 |
remove filters
Back to search problems