Codeforces Round 580 (Div. 1)

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
1205 Codeforces Round 580 (Div. 1) FINISHED False 7800 165687299 Aug. 18, 2019, 1:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 284 ) E Expected Value Again PROGRAMMING combinatorics strings 3100

B"You are given integers n , k . Let's consider the alphabet consisting of k different elements. Let beauty f(s) of the string s be the number of indexes i , 1 <= i<|s| , for which prefix of s of length i equals to suffix of s of length i . For example, beauty of the string abacaba equals 2 , as for i = 1, 3 prefix and suffix of length i are equal. Consider all words of length n in the given alphabet. Find the expected value of f(s)^2 of a uniformly chosen at random word. We can show that it can be expressed as frac{P}{Q} , where P and Q are coprime and Q isn't divided by 10^9 + 7 . Output P cdot Q^{-1} bmod 10^9 + 7 . The first and the only line contains two integers n , k ( 1 <= n <= 10^5 , 1 <= k <= 10^9 ) -- the length of a string and the size of alphabet respectively. Output a single integer -- P x Q^{-1} bmod 10^9 + 7 . In the first example, there are 9 words of length 2 in alphabet of size 3 -- aa , ab , ac , ba , bb , bc , ca , cb , cc . 3 of them have beauty 1 and 6 of them have beauty 0 , so the average value is frac{1}{3} . In the third example, there is only one such word, and it has beauty 99 , so the average value is 99^2 . "...

Tutorials

69158

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
59122780 yasugongshang E Aug. 20, 2019, 6:42 a.m. OK GNU C++11 TESTS 39 31 2048000 3100
62849396 frodakcin E Oct. 18, 2019, 6:43 a.m. OK GNU C++11 TESTS 39 31 3072000 3100
60510462 jambow E Sept. 14, 2019, 2:28 a.m. OK GNU C++11 TESTS 39 31 4812800 3100
59067340 zx2003 E Aug. 19, 2019, 2:36 a.m. OK GNU C++11 TESTS 39 93 1433600 3100
62606190 lhylhy E Oct. 15, 2019, 7:50 a.m. OK GNU C++11 TESTS 39 124 3788800 3100
59117495 nealchen E Aug. 20, 2019, 2:40 a.m. OK GNU C++11 TESTS 39 140 3174400 3100
63312253 hzy9819 E Oct. 24, 2019, 3:26 p.m. OK GNU C++11 TESTS 39 156 3993600 3100
59407160 ZhongJQ E Aug. 24, 2019, 2:20 p.m. OK GNU C++11 TESTS 39 187 3788800 3100
59406989 ZhongJQ E Aug. 24, 2019, 2:17 p.m. OK GNU C++11 TESTS 39 187 3788800 3100
60348629 yyf0309 E Sept. 10, 2019, 1:29 p.m. OK GNU C++11 TESTS 39 202 1638400 3100
63418517 yan-zp E Oct. 26, 2019, 5:30 a.m. OK GNU C++14 TESTS 39 30 1433600 3100
59601993 emoairx E Aug. 28, 2019, 6:37 a.m. OK GNU C++14 TESTS 39 30 3276800 3100
59200682 shdut E Aug. 21, 2019, 4:35 a.m. OK GNU C++14 TESTS 39 46 4096000 3100
59045402 ecnerwala E Aug. 18, 2019, 3:51 p.m. OK GNU C++14 TESTS 39 61 1740800 3100
68034487 rterte E Jan. 1, 2020, 11:15 a.m. OK GNU C++14 TESTS 39 93 2150400 3100
60510806 mayaohua2003 E Sept. 14, 2019, 2:46 a.m. OK GNU C++14 TESTS 39 93 2150400 3100
63385636 rterte E Oct. 25, 2019, 1:41 p.m. OK GNU C++14 TESTS 39 109 3174400 3100
66508434 icecuber E Dec. 8, 2019, 3:23 p.m. OK GNU C++14 TESTS 39 124 3174400 3100
59062429 krijgertje E Aug. 18, 2019, 11:07 p.m. OK GNU C++14 TESTS 39 171 2048000 3100
68309372 1213James E Jan. 6, 2020, 10:29 a.m. OK GNU C++14 TESTS 39 202 3993600 3100
68060958 rterte E Jan. 2, 2020, 3:54 a.m. OK GNU C++17 TESTS 39 31 1740800 3100
61448906 neal E Sept. 29, 2019, 12:12 a.m. OK GNU C++17 TESTS 39 31 1740800 3100
61448296 neal E Sept. 28, 2019, 11:10 p.m. OK GNU C++17 TESTS 39 31 1740800 3100
61448251 neal E Sept. 28, 2019, 11:06 p.m. OK GNU C++17 TESTS 39 31 1740800 3100
59055396 aid E Aug. 18, 2019, 6:43 p.m. OK GNU C++17 TESTS 39 77 2150400 3100
59138338 ivan100sic E Aug. 20, 2019, 1:29 p.m. OK GNU C++17 TESTS 39 93 1638400 3100
59041033 Benq E Aug. 18, 2019, 3:34 p.m. OK GNU C++17 TESTS 39 124 1024000 3100
59039150 tEMMIE.w. E Aug. 18, 2019, 3:26 p.m. OK GNU C++17 TESTS 39 124 3174400 3100
59091147 maroonrk E Aug. 19, 2019, 12:47 p.m. OK GNU C++17 TESTS 39 140 1331200 3100
59703780 HyscereXD E Aug. 30, 2019, 11:48 a.m. OK GNU C++17 TESTS 39 171 3993600 3100
61117057 vjudge1 E Sept. 23, 2019, 1:12 p.m. OK MS C++ TESTS 39 1809 22016000 3100

remove filters

Back to search problems