Codeforces Round 674 (Div. 3)

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
1426 Codeforces Round 674 (Div. 3) FINISHED False 7200 136072511 Sept. 28, 2020, 8:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5463 ) F Number of Subsequences PROGRAMMING combinatorics dp strings 2000

B'You are given a string s consisting of lowercase Latin letters "a", "b" and "c" and question marks "?". Let the number of question marks in the string s be k . Let 's replace each question mark with one of the letters "a", "b" and "c". Here we can obtain all 3^{k} possible strings consisting only of letters "a", "b" and "c". For example, if s = "ac?b?c" then we can obtain the following strings: [ "acabac", "acabbc", "acabcc", "acbbac", "acbbbc", "acbbcc", "accbac", "accbbc", "accbcc" ] . Your task is to count the total number of subsequences "abc" in all resulting strings. Since the answer can be very large, print it modulo 10^{9} + 7 . A subsequence of the string t is such a sequence that can be derived from the string t after removing some (possibly, zero) number of letters without changing the order of remaining letters. For example, the string "baacbc" contains two subsequences "abc" -- a subsequence consisting of letters at positions (2, 5, 6) and a subsequence consisting of letters at positions (3, 5, 6) . The first line of the input contains one integer n (3 <= n <= 200 ,000) -- the length of s . The second line of the input contains the string s of length n consisting of lowercase Latin letters "a", "b" and "c" and question marks"?". Print the total number of subsequences "abc" in all strings you can obtain if you replace all question marks with letters "a", "b" and "c", modulo 10^{9} + 7 . In the first example, we can obtain 9 strings: So, there are 2 + 4 + 4 + 2 + 3 + 4 + 1 + 2 + 2 = 24 subsequences "abc" in total. '...

Tutorials

83120

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
94133402 detaomega F Sept. 28, 2020, 1:50 p.m. OK GNU C11 TESTS 33 46 0 2000
94115472 pengin_2000 F Sept. 28, 2020, 10:38 a.m. OK GNU C11 TESTS 33 202 6553600 2000
94137168 chen_03 F Sept. 28, 2020, 2:29 p.m. OK GNU C++11 TESTS 33 31 0 2000
94116259 I_Love_Sakurajima_Mai F Sept. 28, 2020, 10:47 a.m. OK GNU C++11 TESTS 33 31 204800 2000
94120456 xiawubing F Sept. 28, 2020, 11:33 a.m. OK GNU C++11 TESTS 33 31 204800 2000
94118702 Yzm007 F Sept. 28, 2020, 11:14 a.m. OK GNU C++11 TESTS 33 31 204800 2000
94116392 I_Love_Sakurajima_Mai F Sept. 28, 2020, 10:49 a.m. OK GNU C++11 TESTS 33 31 204800 2000
94155276 Huahuahuo F Sept. 28, 2020, 6:06 p.m. OK GNU C++11 TESTS 33 31 204800 2000
94119196 Minun. F Sept. 28, 2020, 11:20 a.m. OK GNU C++11 TESTS 33 31 307200 2000
94176657 Ging_ F Sept. 29, 2020, 4:32 a.m. OK GNU C++11 TESTS 33 31 307200 2000
94177096 QuantumCoding F Sept. 29, 2020, 4:40 a.m. OK GNU C++11 TESTS 33 31 512000 2000
94133746 huanggs F Sept. 28, 2020, 1:54 p.m. OK GNU C++11 TESTS 33 31 512000 2000
94152491 ShArt23 F Sept. 28, 2020, 5:24 p.m. OK GNU C++14 TESTS 33 31 0 2000
94168891 AK_weiye F Sept. 29, 2020, 12:37 a.m. OK GNU C++14 TESTS 33 31 204800 2000
94152345 ShArt23 F Sept. 28, 2020, 5:22 p.m. OK GNU C++14 TESTS 33 31 512000 2000
94143914 TLEsePARESHAN F Sept. 28, 2020, 3:39 p.m. OK GNU C++14 TESTS 33 31 512000 2000
94137160 nicku_06 F Sept. 28, 2020, 2:29 p.m. OK GNU C++14 TESTS 33 31 512000 2000
94170172 Yuki19_ F Sept. 29, 2020, 1:28 a.m. OK GNU C++14 TESTS 33 31 512000 2000
94130627 detaomega F Sept. 28, 2020, 1:21 p.m. OK GNU C++14 TESTS 33 31 512000 2000
94160144 swapno7064 F Sept. 28, 2020, 7:34 p.m. OK GNU C++14 TESTS 33 31 512000 2000
94132745 Gorgo F Sept. 28, 2020, 1:43 p.m. OK GNU C++14 TESTS 33 31 819200 2000
94171013 WiwiHo F Sept. 29, 2020, 1:59 a.m. OK GNU C++14 TESTS 33 31 819200 2000
94115262 tkz F Sept. 28, 2020, 10:36 a.m. OK GNU C++17 TESTS 33 31 0 2000
94168888 ooooooT_Toooooo F Sept. 29, 2020, 12:36 a.m. OK GNU C++17 TESTS 33 31 204800 2000
94170247 hunxuewangzi F Sept. 29, 2020, 1:31 a.m. OK GNU C++17 TESTS 33 31 204800 2000
94156490 jpr1974 F Sept. 28, 2020, 6:28 p.m. OK GNU C++17 TESTS 33 31 204800 2000
94156122 abbss01 F Sept. 28, 2020, 6:22 p.m. OK GNU C++17 TESTS 33 31 204800 2000
94136544 arounderstands F Sept. 28, 2020, 2:23 p.m. OK GNU C++17 TESTS 33 31 204800 2000
94179855 anupriya13 F Sept. 29, 2020, 5:36 a.m. OK GNU C++17 TESTS 33 31 512000 2000
94180030 sat7978 F Sept. 29, 2020, 5:39 a.m. OK GNU C++17 TESTS 33 31 512000 2000
94180917 rounsunn1 F Sept. 29, 2020, 5:56 a.m. OK GNU C++17 TESTS 33 31 512000 2000
94179649 ardh1999 F Sept. 29, 2020, 5:32 a.m. OK GNU C++17 TESTS 33 31 512000 2000
94164026 Anish1712 F Sept. 28, 2020, 9:05 p.m. OK GNU C++17 (64) TESTS 33 30 512000 2000
94152018 twoslowaf F Sept. 28, 2020, 5:17 p.m. OK GNU C++17 (64) TESTS 33 30 512000 2000
94120518 Felerius F Sept. 28, 2020, 11:34 a.m. OK GNU C++17 (64) TESTS 33 30 512000 2000
94164100 Anish1712 F Sept. 28, 2020, 9:07 p.m. OK GNU C++17 (64) TESTS 33 31 0 2000
94116478 Lucina F Sept. 28, 2020, 10:50 a.m. OK GNU C++17 (64) TESTS 33 31 204800 2000
94174977 gameofcodes F Sept. 29, 2020, 3:51 a.m. OK GNU C++17 (64) TESTS 33 31 512000 2000
94177698 ritikrai F Sept. 29, 2020, 4:54 a.m. OK GNU C++17 (64) TESTS 33 31 512000 2000
94165324 Destructive_Yash F Sept. 28, 2020, 9:44 p.m. OK GNU C++17 (64) TESTS 33 31 512000 2000
94165168 David_Garcia F Sept. 28, 2020, 9:39 p.m. OK GNU C++17 (64) TESTS 33 31 512000 2000
94157174 AceKing F Sept. 28, 2020, 6:40 p.m. OK GNU C++17 (64) TESTS 33 31 512000 2000
94173756 synapse F Sept. 29, 2020, 3:21 a.m. OK Go TESTS 33 77 1638400 2000
94155937 codelegend F Sept. 28, 2020, 6:18 p.m. OK Haskell TESTS 33 93 4300800 2000
94180450 tusharjape007 F Sept. 29, 2020, 5:47 a.m. OK Java 11 TESTS 33 202 0 2000
94159121 CCS_Covenant F Sept. 28, 2020, 7:14 p.m. OK Java 11 TESTS 33 218 0 2000
94158304 vidya_99 F Sept. 28, 2020, 6:59 p.m. OK Java 11 TESTS 33 233 0 2000
94117098 cribabby F Sept. 28, 2020, 10:57 a.m. OK Java 11 TESTS 33 233 5324800 2000
94159982 Kimo_Fathy F Sept. 28, 2020, 7:30 p.m. OK Java 11 TESTS 33 280 32358400 2000
94160223 Agnimandur F Sept. 28, 2020, 7:35 p.m. OK Java 11 TESTS 33 373 0 2000
94121146 rushtowest F Sept. 28, 2020, 11:40 a.m. OK Java 11 TESTS 33 389 6246400 2000
94113773 bobib F Sept. 28, 2020, 10:22 a.m. OK Java 11 TESTS 33 608 41676800 2000
94154338 Hemose F Sept. 28, 2020, 5:50 p.m. OK Java 8 TESTS 33 124 0 2000
94139445 idk321 F Sept. 28, 2020, 2:52 p.m. OK Java 8 TESTS 33 124 0 2000
94164496 icpc_loser F Sept. 28, 2020, 9:18 p.m. OK Java 8 TESTS 33 140 5017600 2000
94146300 shojin_pro F Sept. 28, 2020, 4:05 p.m. OK Java 8 TESTS 33 140 5427200 2000
94138750 JunBinLiang F Sept. 28, 2020, 2:45 p.m. OK Java 8 TESTS 33 155 0 2000
94115756 godxpunk F Sept. 28, 2020, 10:41 a.m. OK Java 8 TESTS 33 155 4710400 2000
94177771 kumarpritam863 F Sept. 29, 2020, 4:55 a.m. OK Java 8 TESTS 33 156 6246400 2000
94138663 Jetman F Sept. 28, 2020, 2:44 p.m. OK Java 8 TESTS 33 186 4403200 2000
94118796 bhautik_77 F Sept. 28, 2020, 11:15 a.m. OK Java 8 TESTS 33 186 16076800 2000
94153066 YahiaSherif F Sept. 28, 2020, 5:32 p.m. OK Java 8 TESTS 33 202 34099200 2000
94154256 Spheniscine F Sept. 28, 2020, 5:49 p.m. OK Kotlin TESTS 33 124 0 2000
94121904 SlavaG F Sept. 28, 2020, 11:49 a.m. OK Kotlin TESTS 33 701 5734400 2000
94114947 MiuraMiuMiu F Sept. 28, 2020, 10:33 a.m. OK Mono C# TESTS 33 61 5529600 2000
94176431 emsaksham F Sept. 29, 2020, 4:27 a.m. OK MS C++ 2017 TESTS 33 31 204800 2000
94171584 GreedyCoder999 F Sept. 29, 2020, 2:18 a.m. OK MS C++ 2017 TESTS 33 46 5427200 2000
94153175 semihpirpir F Sept. 28, 2020, 5:33 p.m. OK MS C++ 2017 TESTS 33 46 10752000 2000
94126127 Numbervan F Sept. 28, 2020, 12:34 p.m. OK MS C++ 2017 TESTS 33 62 29593600 2000
94158210 amindhruv3 F Sept. 28, 2020, 6:58 p.m. OK PyPy 2 TESTS 33 124 921600 2000
94151155 conqueror_of_tourist F Sept. 28, 2020, 5:05 p.m. OK PyPy 3 TESTS 33 187 3481600 2000
94169061 kclee2172 F Sept. 29, 2020, 12:43 a.m. OK PyPy 3 TESTS 33 187 3788800 2000
94112713 manikjain4 F Sept. 28, 2020, 10:14 a.m. OK PyPy 3 TESTS 33 202 3788800 2000
94136912 deepak_ug F Sept. 28, 2020, 2:26 p.m. OK PyPy 3 TESTS 33 202 4300800 2000
94124806 Bovniova F Sept. 28, 2020, 12:20 p.m. OK PyPy 3 TESTS 33 217 3993600 2000
94140264 manhar F Sept. 28, 2020, 3 p.m. OK PyPy 3 TESTS 33 234 16793600 2000
94151011 jimm89 F Sept. 28, 2020, 5:04 p.m. OK PyPy 3 TESTS 33 248 8601600 2000
94130271 wolpiskerter F Sept. 28, 2020, 1:18 p.m. OK PyPy 3 TESTS 33 327 40243200 2000
94174591 pikachu_pika_pika F Sept. 29, 2020, 3:41 a.m. OK PyPy 3 TESTS 33 358 44748800 2000
94127234 __eRRor__ F Sept. 28, 2020, 12:45 p.m. OK PyPy 3 TESTS 33 373 10444800 2000
94110875 agarus F Sept. 28, 2020, 10:04 a.m. OK Python 3 TESTS 33 280 614400 2000
94164731 IngaleAnkur10 F Sept. 28, 2020, 9:25 p.m. OK Python 3 TESTS 33 296 614400 2000
94159565 taran_orz F Sept. 28, 2020, 7:22 p.m. OK Python 3 TESTS 33 342 409600 2000
94115553 sh1194 F Sept. 28, 2020, 10:39 a.m. OK Python 3 TESTS 33 405 716800 2000
94130226 wolpiskerter F Sept. 28, 2020, 1:17 p.m. OK Python 3 TESTS 33 717 14336000 2000
94170700 Gausstein F Sept. 29, 2020, 1:48 a.m. OK Python 3 TESTS 33 810 1945600 2000
94157161 r-tron18 F Sept. 28, 2020, 6:40 p.m. OK Python 3 TESTS 33 872 43622400 2000
94157279 r-tron18 F Sept. 28, 2020, 6:42 p.m. OK Python 3 TESTS 33 936 43929600 2000
94133078 tuna_salad F Sept. 28, 2020, 1:47 p.m. OK Rust TESTS 33 31 819200 2000
94173751 akks800 F Sept. 29, 2020, 3:21 a.m. OK Rust TESTS 33 46 4812800 2000

remove filters

Back to search problems