Codeforces Global Round 28

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
2048 Codeforces Global Round 28 FINISHED False 10800 41786723 Dec. 19, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 57 ) I2 Kevin and Puzzle (Hard Version) PROGRAMMING bitmasks fft math

This is the hard version of the problem. The difference between the versions is that in this version, you need to count the number of good arrays. You can hack only if you solved all versions of this problem. Kevin is visiting the Red Church, and he found a puzzle on the wall. For an array (a), let (c(l,r)) indicate how many distinct numbers are among (a_l, a_{l+1}, \ldots, a_r). In particular, if (l > r), define (c(l,r) = 0). You are given a string (s) of length (n) consisting of letters (L) and (R) only. Let a non-negative array (a) be called good , if the following conditions hold for (1 \leq i \leq n): if (s_i=\verb!L!), then (c(1,i-1)=a_i); if (s_i=\verb!R!), then (c(i+1,n)=a_i). You need to count the number of good arrays (a). Since the answer may be large, you only need to output the answer modulo (998\,244\,353). Each test contains multiple test cases. The first line contains a single integer (t) ((1\le t \le 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer (n) ((2\leq n\leq 2\cdot 10^5)) — the length of string (s). The second line of each test case contains a string (s) with a length (n), containing only English uppercase letters (\verb!L!) and (\verb!R!). It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^5). For each test case, output the number of good arrays modulo (998\,244\,353). All arrays satisfying the conditions can be found in the easy version of this problem.

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
297358412 A_G I2 Dec. 19, 2024, 7:45 p.m. OK C++20 (GCC 13-64) TESTS 134 999 8704000
297361711 two_seven_cf I2 Dec. 19, 2024, 8:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 134 1014 8806400
297390475 Ion_Gravirei I2 Dec. 20, 2024, 5:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 134 1015 8806400
297371717 Benq I2 Dec. 20, 2024, 12:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 134 2078 14131200
297371627 Benq I2 Dec. 20, 2024, 12:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 134 4327 14233600

remove filters

Back to search problems