Codeforces Global Round 30 (Div. 1 + Div. 2)

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
2164 Codeforces Global Round 30 (Div. 1 + Div. 2) FINISHED False 10800 13965923 Nov. 6, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 41 ) H PalindromePalindrome PROGRAMMING data structures strings

We define the humor value of a string (t) as the length of the longest palindrome string which occurs at least twice in it. Formally, a string (p) is humor with respect to (t) , if and only if both of the following conditions are met: (p) is a palindrome, and there exist at least two different indices (i \in 1, |t| - |p| + 1), such that (ti, i + |p| - 1 = p). The humor value of (t) is defined as the maximum length among all humor strings with respect to (t) . You are given a string (s) of length (n) which only contains lowercase Latin letters and (q) queries. Each query contains two integers (l_i), (r_i), and you need to find the humor value of the string (sl_i, r_i). Here, (al, r) is defined as the string (a_l,a_{l+1},\ldots,a_r). The first line contains two integers (n), (q) ((1\le n,q\le 5\cdot10^5)). The second line contains a string (s). The next (q) lines contain the description of queries. The (i)-th line contains two integers (l_i), (r_i) ((1\le l_i\le r_i\le n)). On the (i)-th line, output the answer to the (i)-th query. In the first query, the following palindrome strings occur at least twice: a,aa,aaa,aaaa,b,bb,bbb . The longest one is aaaa , so the humor value is (4). In the second query, one of the longest humor strings with respect to (s2, 7) is aa .

Tutorials

Codeforces Global Round 30 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
347797802 hungchi17 H Nov. 6, 2025, 9:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1296 189440000
347789476 dominator2.00 H Nov. 6, 2025, 7:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1296 189440000
347821635 hungchi17 H Nov. 7, 2025, 4:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1327 189440000
347788366 pradeep027 H Nov. 6, 2025, 7:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1718 190259200
347777427 rainboy H Nov. 6, 2025, 5:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1718 190259200
347781998 rainboy H Nov. 6, 2025, 6:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1796 190259200
347788011 pradeep027 H Nov. 6, 2025, 7:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 1812 190259200
347782904 300iq H Nov. 6, 2025, 6:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 43 4202 377856000
347781789 rainboy H Nov. 6, 2025, 6:26 p.m. OK GNU C11 TESTS 43 3265 172646400

remove filters

Back to search problems