Codeforces Round 1087 (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
2209 Codeforces Round 1087 (Div. 2) FINISHED False 7200 2301923 March 21, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1665 ) E A Trivial String Problem PROGRAMMING dp strings

Define (f(t)) as the maximum number of parts (t) can be split into such that each part is a non-empty prefix of (t). In other words, (f(t)) is the maximum positive integer (k) that satisfies the following condition: There exist (k) strings (p_1,p_2,\ldots,p_k), which are prefixes of (t), such that (t=p_1+p_2+\ldots+p_k). Here (+) denotes the string concatenation. You are given a string (s) of length (n), consisting of only lowercase English letters. Let (sx..y) represent the substring(^{\text{∗}}) of (s) from the (x)-th to the (y)-th character (inclusive). You need to answer (q) queries. The (i)-th query provides two integers (l_i) and (r_i), and you need to find () \sum_{j=l_i}^{r_i} f(sl_i..j). () (^{\text{∗}})A string (a) is a substring of a string (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((1 \le n \le 10^6), (1 \le q \le 100)). The second line contains the string (s) of length (n), consisting of only lowercase English letters. The (i)-th of the next (q) lines contains two integers (l_i) and (r_i) ((1 \le l_i \le r_i \le n)), representing the (i)-th query. It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each query, output an integer representing the value of the expression. In the first test case, (f(a)=1). In the second test case, (f(a)+f(aa)+f(aaa)+f(aaaa)+f(aaaaa)=1+2+3+4+5=15) and $$$f(a)+f(aa)+f(\textt

Tutorials

Codeforces Round 1087 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
367689404 wanna_be_cs_gaoshou E March 21, 2026, 5:26 p.m. OK C# 13 TESTS 32 2718 195276800
367726778 nullbrain_ E March 22, 2026, 4:14 a.m. OK C# 13 TESTS 37 3546 347852800
367678323 OIer_kzc E March 21, 2026, 4:22 p.m. OK C++17 (GCC 7-32) TESTS 32 515 13107200
367678223 MCPlayer542 E March 21, 2026, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 32 609 13107200
367696256 jakekim E March 21, 2026, 6:19 p.m. OK C++17 (GCC 7-32) TESTS 34 687 15155200
367721179 xuan_never E March 22, 2026, 2:17 a.m. OK C++17 (GCC 7-32) TESTS 37 796 12083200
367682064 Darko2026 E March 21, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 32 828 14131200
367690442 xingtiankai2023 E March 21, 2026, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 33 890 13107200
367688212 More E March 21, 2026, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 32 906 13107200
367695705 jonatas57 E March 21, 2026, 6:14 p.m. OK C++17 (GCC 7-32) TESTS 34 1015 5222400
367726268 ThaNikiso E March 22, 2026, 4:03 a.m. OK C++17 (GCC 7-32) TESTS 37 1062 14131200
367730841 oceeff E March 22, 2026, 5:20 a.m. OK C++17 (GCC 7-32) TESTS 37 1078 16179200
367688432 Cheeseman E March 21, 2026, 5:21 p.m. OK C++20 (GCC 13-64) TESTS 32 734 14336000
367678929 ffoooo E March 21, 2026, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 32 750 13107200
367681631 MaribelHearn E March 21, 2026, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 32 765 18944000
367676761 liao_ji E March 21, 2026, 4:18 p.m. OK C++20 (GCC 13-64) TESTS 32 781 9318400
367679454 Sebastian1801 E March 21, 2026, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 32 781 18124800
367722430 TranVinhHuy2010 E March 22, 2026, 2:46 a.m. OK C++20 (GCC 13-64) TESTS 37 796 12083200
367695844 jakekim E March 21, 2026, 6:15 p.m. OK C++20 (GCC 13-64) TESTS 34 828 15155200
367678617 YaKei E March 21, 2026, 4:22 p.m. OK C++20 (GCC 13-64) TESTS 32 843 13107200
367722064 PL330 E March 22, 2026, 2:37 a.m. OK C++20 (GCC 13-64) TESTS 37 859 16076800
367680506 sukon E March 21, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 32 890 7065600
367700761 415411 E March 21, 2026, 7:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 36 578 12083200
367730601 shdut0901 E March 22, 2026, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 37 625 11776000
367689266 Splashing E March 21, 2026, 5:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 656 8089600
367688223 WangSiyuan2025 E March 21, 2026, 5:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 656 13107200
367680285 cqbzzjy E March 21, 2026, 4:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 671 12083200
367719454 yangjl E March 22, 2026, 1:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 37 718 12083200
367726485 senapathidinesh.in E March 22, 2026, 4:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 37 734 12083200
367680192 chatoudp_Lance E March 21, 2026, 4:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 750 9113600
367692061 CraaazyShep E March 21, 2026, 5:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 750 24780800
367679138 ZQZBD E March 21, 2026, 4:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 32 765 12083200
367733233 hardgonnapass E March 22, 2026, 5:50 a.m. OK F# 9 TESTS 37 2000 181145600
367678518 EROR E March 21, 2026, 4:22 p.m. OK Go TESTS 32 1781 22937600
367717612 0x3F E March 22, 2026, 12:38 a.m. OK Go TESTS 37 2875 102400000
367710992 abezr882 E March 21, 2026, 9:46 p.m. OK Go TESTS 37 3500 101580800
367677516 suresh-jakhar E March 21, 2026, 4:20 p.m. OK Java 21 TESTS 32 1359 12083200
367698152 shortestpi E March 21, 2026, 6:36 p.m. OK Java 21 TESTS 34 3906 45056000
367682131 wamachine_ E March 21, 2026, 4:29 p.m. OK Java 8 TESTS 32 3093 35225600
367688203 jakekim E March 21, 2026, 5:19 p.m. OK PyPy 3-64 TESTS 32 3343 59699200
367702954 kryoton_98 E March 21, 2026, 7:30 p.m. OK PyPy 3-64 TESTS 37 3437 30822400
367727557 krism E March 22, 2026, 4:28 a.m. OK PyPy 3-64 TESTS 37 3515 29388800
367721035 gshbholanath19 E March 22, 2026, 2:14 a.m. OK PyPy 3-64 TESTS 37 3671 29081600
367678208 hardgonnapass E March 21, 2026, 4:21 p.m. OK Scala TESTS 32 1640 21606400

remove filters

Back to search problems