Reconstruction Codeforces
Reconstruction Codeforces
|
NguyenDucHien | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION
Since the answer may be large, output it modulo 998 244 353 . Submit
Input
The first line contains a single integer t (1 ≤ t ≤ 103 ) — the number of test cases. → Score table
3
The first line of each test case contains two integers n and m (2 ≤ n ≤ 2 ⋅ 10 , Score
9
2 ≤ m ≤ 10 ) — the length of the hidden array a1 , a2 , … , an and the maximum absolute Problem A 446
value of an element ai . Problem B 668
The second line of each test case contains a string s of length n consisting of characters P, S, Problem C1 668
and ?. Problem C2 1114
Problem D 2227
The third line of each test case contains n integers b1 , b2 , … , bn (|bi | ≤ m ⋅ n).
Problem E 2672
3
The sum of n over all test cases does not exceed 5 ⋅ 10 . Problem F 2672
6 Resubmission -50
4 10 * If you solve problem on 00:41 from the first attempt
PSPP
1 9 8 10
4 1000000000
????
1 1 1 4000000000
8 1000000000
?P?SSP?P
-857095623 -1424391899 -851974476 673437144 471253851 -543483033 364945701
-178537332
4 7
PPSS
4 2 1 3
https://codeforces.com/contest/1984/problem/F 1/2
6/9/24, 10:16 PM Problem - F - Codeforces
9 20
?????????
1 2 3 4 5 6 7 8 9
3 1000000000
P??
-145463248 -974068460 -1287458396
output Copy
1
0
2
1
14
1
Note
In the first test case, we can see that the following array satisfies all constraints, thus the
answer is 1:
9
In the second test case, it can be shown that no array a with all |ai | ≤ m = 10 satisfies all
constraints.
Supported by
https://codeforces.com/contest/1984/problem/F 2/2