Codeforces Global Round 26

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1984 Codeforces Global Round 26 FINISHED False 10800 19236263 June 9, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 969 ) F Reconstruction PROGRAMMING brute force dp

B'There is a hidden array a_1, a_2, ldots, a_n of length n whose elements are integers between -m and m , inclusive. You are given an array b_1, b_2, ldots, b_n of length n and a string s of length n consisting of the characters texttt{P} , texttt{S} , and texttt{?} . For each i from 1 to n inclusive, we must have: Output the number of ways to replace all texttt{?} in s with either texttt{P} or texttt{S} such that there exists an array a_1, a_2, ldots, a_n with elements not exceeding m by absolute value satisfying the constraints given by the array b_1, b_2, ldots, b_n and the string s . Since the answer may be large, output it modulo 998 ,244 ,353 . The first line contains a single integer t ( 1 <= q t <= q 10^3 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 2 <= q n <= q 2 cdot 10^3 , 2 <= q m <= q 10^{9} ) -- the length of the hidden array a_1, a_2, ldots, a_n and the maximum absolute value of an element a_i . The second line of each test case contains a string s of length n consisting of characters texttt{P} , texttt{S} , and texttt{?} . The third line of each test case contains n integers b_1, b_2, ldots, b_n ( |b_i| <= q m cdot n ). The sum of n over all test cases does not exceed 5 cdot 10^3 . For each test case, output a single integer -- the number of ways to replace all texttt{?} in s with either texttt{P} or texttt{S} that result in the existence of a valid array a_1, a_2, ldots, a_n , modulo 998 ,244 ,353 . In the first test case, we can see that the following array satisfies all constraints, thus the answer is 1 : In the second test case, it can be shown that no array a with all |a_i| <= q m = 10^'...

Tutorials

Codeforces Global Round 26 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
264998308 EasonLiang F June 10, 2024, 4:15 a.m. OK C++14 (GCC 6-32) TESTS 25 61 102400
264960123 minstdfx F June 9, 2024, 5:27 p.m. OK C++14 (GCC 6-32) TESTS 24 62 4403200
264953349 jinqihao2026 F June 9, 2024, 5:03 p.m. OK C++14 (GCC 6-32) TESTS 24 77 4198400
264953099 liumohan F June 9, 2024, 5:02 p.m. OK C++14 (GCC 6-32) TESTS 24 93 4300800
264960307 JTree F June 9, 2024, 5:28 p.m. OK C++14 (GCC 6-32) TESTS 24 93 36454400
265003299 heaksicn F June 10, 2024, 5:18 a.m. OK C++14 (GCC 6-32) TESTS 25 108 204800
264961527 syx2567 F June 9, 2024, 5:32 p.m. OK C++14 (GCC 6-32) TESTS 24 124 4198400
264953300 Ricky2021 F June 9, 2024, 5:03 p.m. OK C++14 (GCC 6-32) TESTS 24 140 9216000
264955354 Nobody_Emissary F June 9, 2024, 5:10 p.m. OK C++14 (GCC 6-32) TESTS 24 156 4403200
264961181 cfhj F June 9, 2024, 5:31 p.m. OK C++14 (GCC 6-32) TESTS 24 171 4300800
264954779 torisasami F June 9, 2024, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 24 46 4198400
264955847 flaranis F June 9, 2024, 5:12 p.m. OK C++17 (GCC 7-32) TESTS 24 61 102400
264980247 cai_lw F June 9, 2024, 9:41 p.m. OK C++17 (GCC 7-32) TESTS 25 62 4198400
264954989 oleh1421 F June 9, 2024, 5:09 p.m. OK C++17 (GCC 7-32) TESTS 24 62 4300800
264953994 Ynoi F June 9, 2024, 5:05 p.m. OK C++17 (GCC 7-32) TESTS 24 62 9932800
264961588 awoo F June 9, 2024, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 24 77 204800
264960852 oceeff F June 9, 2024, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 24 77 2252800
264954952 Larry0101 F June 9, 2024, 5:09 p.m. OK C++17 (GCC 7-32) TESTS 24 77 4300800
264958495 wzc_IOI_czw F June 9, 2024, 5:21 p.m. OK C++17 (GCC 7-32) TESTS 24 77 9216000
264960976 Alpha_Q F June 9, 2024, 5:30 p.m. OK C++17 (GCC 7-32) TESTS 24 77 69632000
265000794 HHU_fl F June 10, 2024, 4:48 a.m. OK C++20 (GCC 13-64) TESTS 25 46 3993600
264993454 AFOier F June 10, 2024, 3:01 a.m. OK C++20 (GCC 13-64) TESTS 25 46 52121600
264982549 tinca_matei F June 9, 2024, 10:37 p.m. OK C++20 (GCC 13-64) TESTS 25 61 102400
264989233 2745518585 F June 10, 2024, 1:47 a.m. OK C++20 (GCC 13-64) TESTS 25 61 204800
264954592 nvmdava F June 9, 2024, 5:07 p.m. OK C++20 (GCC 13-64) TESTS 24 61 204800
264995473 HHY_zZhu F June 10, 2024, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 25 61 3993600
264965422 -1e11 F June 9, 2024, 6:32 p.m. OK C++20 (GCC 13-64) TESTS 24 61 3993600
264988725 Unlimited_zero F June 10, 2024, 1:36 a.m. OK C++20 (GCC 13-64) TESTS 25 61 4096000
264965457 cz_yxx F June 9, 2024, 6:32 p.m. OK C++20 (GCC 13-64) TESTS 24 61 4096000
264967162 Psychotic_D F June 9, 2024, 6:46 p.m. OK C++20 (GCC 13-64) TESTS 25 61 15257600
264968837 Quasicoherent F June 9, 2024, 7:01 p.m. OK Java 21 TESTS 25 343 921600
264953242 toam F June 9, 2024, 5:03 p.m. OK PyPy 3-64 TESTS 24 515 8601600
264995804 fedimser F June 10, 2024, 3:38 a.m. OK PyPy 3-64 TESTS 25 890 9523200
264960656 toor F June 9, 2024, 5:29 p.m. OK Rust 2021 TESTS 24 93 0

remove filters

Back to search problems