Codeforces Round 868 (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
1823 Codeforces Round 868 (Div. 2) FINISHED False 7200 54660263 April 27, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3957 ) D Unique Palindromes PROGRAMMING binary search constructive algorithms greedy math strings

B'A palindrome is a string that reads the same backwards as forwards. For example, the string abcba is palindrome, while the string abca is not. Let p(t) be the number of unique palindromic substrings of string t , i. e. the number of substrings t[l ... r] that are palindromes themselves. Even if some substring occurs in t several times, it 's counted exactly once. (The whole string t is also counted as a substring of t ). For example, string t = abcbbcabcb has p(t) = 6 unique palindromic substrings: a, b, c, bb, bcb and cbbc. Now, let 's define p(s, m) = p(t) where t = s[1 ... m] . In other words, p(s, m) is the number of palindromic substrings in the prefix of s of length m . For example, p( abcbbcabcb , 5) = p( abcbb ) = 5 . You are given an integer n and k "conditions" ( k <= 20 ). Let 's say that string s , consisting of n lowercase Latin letters, is good if all k conditions are satisfied at the same time. A condition is a pair (x_i, c_i) and have the following meaning: Look in Notes if you need further clarifications. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The first line of each test case contains two integers n and k ( 3 <= n <= 2 cdot 10^5 ; 1 <= k <= 20 ) -- length of good string s and number of conditions. The second line of each test case contains k integers x_1, x_2, ... , x_k ( 3 <= x_1 < x_2 < ... < x_k = n ) where x_i is the length of the prefix in the i -th condition. The third line of each test case contains k integers c_1, c_2, ... , c_k ( 3 <= c_1 <= c_2 <= ... <= c_k <= min{ <= ft(10^9, frac{(n + 1) n}{2} right)} ) where c_i is the number of palindromic substrings in the $$'...

Tutorials

115465

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
203705345 mban259 D April 27, 2023, 3:55 p.m. OK C# 10 TESTS 17 155 4608000
203701636 Ice_teapoy D April 27, 2023, 3:41 p.m. OK GNU C++14 TESTS 17 30 9011200
203715681 Kosmo00 D April 27, 2023, 4:33 p.m. OK GNU C++14 TESTS 17 31 204800
203713803 HakuroKawashiro D April 27, 2023, 4:27 p.m. OK GNU C++14 TESTS 17 31 204800
203711418 carnation13_2 D April 27, 2023, 4:18 p.m. OK GNU C++14 TESTS 17 31 204800
203719590 palindroam D April 27, 2023, 5:08 p.m. OK GNU C++14 TESTS 17 31 409600
203758623 hkr04 D April 28, 2023, 3:28 a.m. OK GNU C++14 TESTS 17 31 512000
203710422 Nicolas125841 D April 27, 2023, 4:14 p.m. OK GNU C++14 TESTS 17 31 512000
203743497 LinkZelda D April 27, 2023, 10:32 p.m. OK GNU C++14 TESTS 17 31 819200
203707228 2023ljw D April 27, 2023, 4:02 p.m. OK GNU C++14 TESTS 17 31 819200
203706834 abhi_atg D April 27, 2023, 4 p.m. OK GNU C++14 TESTS 17 31 1331200

remove filters

Back to search problems