Codeforces Round 604 (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
1265 Codeforces Round 604 (Div. 2) FINISHED False 7200 156266699 Dec. 5, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15160 ) A Beautiful String PROGRAMMING constructive algorithms greedy 1000

B'A string is called beautiful if no two consecutive characters are equal. For example, "ababcb", "a" and "abab" are beautiful strings, while "aaaaaa", "abaa" and "bb" are not. Ahcl wants to construct a beautiful string. He has a string s , consisting of only characters 'a ', 'b ', 'c ' and '? '. Ahcl needs to replace each character '? ' with one of the three characters 'a ', 'b ' or 'c ', such that the resulting string is beautiful. Please help him! More formally, after replacing all characters '? ', the condition s_i neq s_{i+1} should be satisfied for all 1 <= q i <= q |s| - 1 , where |s| is the length of the string s . The first line contains positive integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. Next t lines contain the descriptions of test cases. Each line contains a non-empty string s consisting of only characters 'a ', 'b ', 'c ' and '? '. It is guaranteed that in each test case a string s has at least one character '? '. The sum of lengths of strings s in all test cases does not exceed 10^5 . For each test case given in the input print the answer in the following format: In the first test case, all possible correct answers are "ababcb", "abcacb", "abcbcb", "acabcb" and "acbacb". The two answers "abcbab" and "abaabc" are incorrect, because you can replace only '? ' characters and the resulting string must be beautiful. In the second test case, it is impossible to create a beautiful string, because the 4 -th and 5 -th characters will be always equal. In the third test case, the only answer is "acbac". '...

Tutorials

Codeforces Round #604 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
68384972 RyumaRyama A Jan. 8, 2020, 5:17 a.m. OK Clang++17 Diagnostics TESTS 46 77 14745600 1000
68384872 RyumaRyama A Jan. 8, 2020, 5:13 a.m. OK Clang++17 Diagnostics TESTS 46 78 14745600 1000
66769555 lumisphere902 A Dec. 13, 2019, 7:47 a.m. OK Clang++17 Diagnostics TESTS 46 93 14745600 1000
68384400 RyumaRyama A Jan. 8, 2020, 4:50 a.m. OK Clang++17 Diagnostics TESTS 46 826 34713600 1000
66410464 calonmaster A Dec. 6, 2019, 3:09 p.m. OK FPC TESTS 46 31 1126400 1000
66392585 StEpAn_123 A Dec. 6, 2019, 9:36 a.m. OK FPC TESTS 46 31 1126400 1000
66639200 canhtoanPASCAL A Dec. 11, 2019, 2:05 p.m. OK FPC TESTS 46 31 1228800 1000
66494911 net12k44 A Dec. 8, 2019, 10:05 a.m. OK FPC TESTS 46 46 1126400 1000
67288237 canhtoana2k23 A Dec. 20, 2019, 2:51 p.m. OK FPC TESTS 46 46 1228800 1000
66388695 Kostin2020 A Dec. 6, 2019, 8:23 a.m. OK FPC TESTS 46 46 1228800 1000
68123242 vjudge4 A Jan. 3, 2020, 2:09 p.m. OK GNU C11 TESTS 46 31 102400 1000
68201080 mohana-256 A Jan. 4, 2020, 3:49 p.m. OK GNU C11 TESTS 46 31 102400 1000
68296786 vjudge4 A Jan. 6, 2020, 3:29 a.m. OK GNU C11 TESTS 46 31 102400 1000
69071039 Skolfide A Jan. 18, 2020, 9:53 p.m. OK GNU C11 TESTS 46 31 102400 1000
66769515 BugLeave A Dec. 13, 2019, 7:46 a.m. OK GNU C11 TESTS 46 31 102400 1000
66811037 noooobie A Dec. 14, 2019, 2:28 a.m. OK GNU C11 TESTS 46 31 102400 1000
67005280 stella_1 A Dec. 16, 2019, 7:40 a.m. OK GNU C11 TESTS 46 31 102400 1000
67038509 Sujal123 A Dec. 16, 2019, 6:17 p.m. OK GNU C11 TESTS 46 31 102400 1000
67409672 akash19jain A Dec. 22, 2019, 7:50 a.m. OK GNU C11 TESTS 46 31 102400 1000
67454962 harsha.pathuri A Dec. 23, 2019, 6:26 a.m. OK GNU C11 TESTS 46 31 102400 1000
66493642 bogdi A Dec. 8, 2019, 9:33 a.m. OK GNU C++11 TESTS 46 31 0 1000
66587599 BeastInBlack A Dec. 10, 2019, 11:47 a.m. OK GNU C++11 TESTS 46 31 0 1000
66545491 ZJL_OIJR A Dec. 9, 2019, 1:03 p.m. OK GNU C++11 TESTS 46 31 0 1000
66541805 vjudge3 A Dec. 9, 2019, 11:48 a.m. OK GNU C++11 TESTS 46 31 0 1000
66541705 vjudge2 A Dec. 9, 2019, 11:45 a.m. OK GNU C++11 TESTS 46 31 0 1000
66522825 fyj1 A Dec. 9, 2019, 1:12 a.m. OK GNU C++11 TESTS 46 31 0 1000
66666097 16310120309 A Dec. 12, 2019, 7:11 a.m. OK GNU C++11 TESTS 46 31 0 1000
67698284 Charon_wth A Dec. 27, 2019, 1:39 p.m. OK GNU C++11 TESTS 46 31 0 1000
68149305 momomoxiaobai A Jan. 4, 2020, 6:12 a.m. OK GNU C++11 TESTS 46 31 0 1000
68241522 vjudge5 A Jan. 5, 2020, 12:59 p.m. OK GNU C++11 TESTS 46 31 0 1000
66642954 Sathy021 A Dec. 11, 2019, 3:29 p.m. OK GNU C++14 TESTS 46 15 102400 1000
68053690 vamsicool007 A Jan. 1, 2020, 8:30 p.m. OK GNU C++14 TESTS 46 15 307200 1000
67019747 Wjexmrc A Dec. 16, 2019, 12:36 p.m. OK GNU C++14 TESTS 46 15 307200 1000
66509555 tshr A Dec. 8, 2019, 3:51 p.m. OK GNU C++14 TESTS 46 15 307200 1000
66416615 vdcn A Dec. 6, 2019, 5:20 p.m. OK GNU C++14 TESTS 46 15 307200 1000
66381474 imbazhang A Dec. 6, 2019, 5:47 a.m. OK GNU C++14 TESTS 46 30 102400 1000
66791035 mariowong A Dec. 13, 2019, 3:17 p.m. OK GNU C++14 TESTS 46 30 102400 1000
66381769 TABball A Dec. 6, 2019, 5:54 a.m. OK GNU C++14 TESTS 46 30 102400 1000
66343926 BEAR0131 A Dec. 5, 2019, 3:41 p.m. OK GNU C++14 TESTS 46 30 102400 1000
68724732 sohanur_rahman A Jan. 13, 2020, 5:31 p.m. OK GNU C++14 TESTS 46 30 307200 1000
68334038 Kirt_del22 A Jan. 6, 2020, 8:24 p.m. OK GNU C++17 TESTS 46 15 307200 1000
66405299 paulica A Dec. 6, 2019, 1:30 p.m. OK GNU C++17 TESTS 46 15 512000 1000
67047706 paispls A Dec. 17, 2019, 12:41 a.m. OK GNU C++17 TESTS 46 30 102400 1000
67397132 vjudge2 A Dec. 22, 2019, 12:26 a.m. OK GNU C++17 TESTS 46 30 102400 1000
67398410 vjudge3 A Dec. 22, 2019, 1:46 a.m. OK GNU C++17 TESTS 46 30 102400 1000
67958847 gratus907 A Dec. 30, 2019, 10:45 a.m. OK GNU C++17 TESTS 46 30 102400 1000
69680511 bidirectionalprograming A Jan. 28, 2020, 3:30 p.m. OK GNU C++17 TESTS 46 30 102400 1000
66376689 Bombers A Dec. 6, 2019, 3:15 a.m. OK GNU C++17 TESTS 46 30 102400 1000
66386815 tsh A Dec. 6, 2019, 7:48 a.m. OK GNU C++17 TESTS 46 30 102400 1000
66489318 Tfenglin A Dec. 8, 2019, 7:53 a.m. OK GNU C++17 TESTS 46 30 102400 1000
69488818 fc-lib-xyz A Jan. 24, 2020, 9:05 p.m. OK Go TESTS 46 31 0 1000
66399038 suryanshv23 A Dec. 6, 2019, 11:43 a.m. OK Go TESTS 46 46 0 1000
66397750 sonlh07 A Dec. 6, 2019, 11:22 a.m. OK Go TESTS 46 46 0 1000
66380134 zhuaiballl A Dec. 6, 2019, 5:12 a.m. OK Go TESTS 46 46 0 1000
66597592 kaviranjan88 A Dec. 10, 2019, 3:17 p.m. OK Go TESTS 46 312 0 1000
66885748 toad123 A Dec. 14, 2019, 6:10 p.m. OK Go TESTS 46 327 0 1000
66893483 OniValKeloni A Dec. 14, 2019, 10:34 p.m. OK Go TESTS 46 343 4505600 1000
66786347 mstar A Dec. 13, 2019, 1:47 p.m. OK Go TESTS 46 717 5324800 1000
66973852 Xmpln A Dec. 15, 2019, 2:01 p.m. OK Haskell TESTS 46 61 4300800 1000
66470374 Laurens A Dec. 7, 2019, 6:08 p.m. OK Haskell TESTS 46 61 4300800 1000
69480773 HU_Geek A Jan. 24, 2020, 5:40 p.m. OK Java 11 TESTS 46 186 0 1000
66397933 Safrout A Dec. 6, 2019, 11:25 a.m. OK Java 11 TESTS 46 186 0 1000
66365245 machhra A Dec. 5, 2019, 7:08 p.m. OK Java 11 TESTS 46 186 0 1000
66783312 TheSawan A Dec. 13, 2019, 12:47 p.m. OK Java 11 TESTS 46 187 0 1000
66379568 Ralsei A Dec. 6, 2019, 4:55 a.m. OK Java 11 TESTS 46 187 0 1000
66379445 Ralsei A Dec. 6, 2019, 4:52 a.m. OK Java 11 TESTS 46 187 0 1000
66364775 IslamTalipovTop A Dec. 5, 2019, 6:59 p.m. OK Java 11 TESTS 46 187 0 1000
66362212 Anonymous A Dec. 5, 2019, 6:17 p.m. OK Java 11 TESTS 46 187 0 1000
66591808 kamesh.joshi A Dec. 10, 2019, 1:14 p.m. OK Java 11 TESTS 46 202 0 1000
66493032 kiberKotleta2009 A Dec. 8, 2019, 9:18 a.m. OK Java 11 TESTS 46 202 0 1000
66743698 lightseba A Dec. 12, 2019, 11:25 p.m. OK Java 8 TESTS 46 124 0 1000
68749190 amolpratap007 A Jan. 14, 2020, 6:03 a.m. OK Java 8 TESTS 46 124 0 1000
68611812 nandit A Jan. 11, 2020, 3:59 p.m. OK Java 8 TESTS 46 124 0 1000
67959625 Housam_Jehad79 A Dec. 30, 2019, 11:02 a.m. OK Java 8 TESTS 46 124 0 1000
67690808 xXAyushiXx A Dec. 27, 2019, 11:01 a.m. OK Java 8 TESTS 46 124 0 1000
67651258 Mann_27__ A Dec. 26, 2019, 12:13 p.m. OK Java 8 TESTS 46 124 0 1000
67626039 still_the_big_bang A Dec. 25, 2019, 9:53 p.m. OK Java 8 TESTS 46 124 0 1000
67381000 NormalGeek A Dec. 21, 2019, 4:22 p.m. OK Java 8 TESTS 46 124 0 1000
67317005 Vatsal53 A Dec. 21, 2019, 6:30 a.m. OK Java 8 TESTS 46 124 0 1000
66832351 Snow A Dec. 14, 2019, 10:41 a.m. OK Java 8 TESTS 46 124 0 1000
66971117 belli49 A Dec. 15, 2019, 1:14 p.m. OK JavaScript TESTS 46 46 716800 1000
66377288 Spheniscine A Dec. 6, 2019, 3:40 a.m. OK Kotlin TESTS 46 139 0 1000
66362009 Bringoff A Dec. 5, 2019, 6:15 p.m. OK Kotlin TESTS 46 155 0 1000
66402597 Andreeha A Dec. 6, 2019, 12:44 p.m. OK Kotlin TESTS 46 156 0 1000
66340394 Dock290 A Dec. 5, 2019, 3:29 p.m. OK Mono C# TESTS 46 62 614400 1000
66547788 nastya1199 A Dec. 9, 2019, 1:49 p.m. OK Mono C# TESTS 46 62 1024000 1000
66406450 ramnaidusaragadam A Dec. 6, 2019, 1:50 p.m. OK Mono C# TESTS 46 62 1024000 1000
66554127 KhalidSultan A Dec. 9, 2019, 4:03 p.m. OK Mono C# TESTS 46 62 1126400 1000
66510960 GusztavSzmolik A Dec. 8, 2019, 4:33 p.m. OK Mono C# TESTS 46 62 1433600 1000
67700514 sevimlikedicik A Dec. 27, 2019, 2:26 p.m. OK Mono C# TESTS 46 62 3788800 1000
66529435 fr0st A Dec. 9, 2019, 6:58 a.m. OK Mono C# TESTS 46 62 6144000 1000
66348027 dev8546 A Dec. 5, 2019, 3:57 p.m. OK Mono C# TESTS 46 77 3788800 1000
66403520 balibalo756 A Dec. 6, 2019, 12:59 p.m. OK Mono C# TESTS 46 93 7475200 1000
66390557 artworks A Dec. 6, 2019, 8:59 a.m. OK Mono C# TESTS 46 108 9420800 1000
67499302 vjudge4 A Dec. 24, 2019, 3:02 a.m. OK MS C++ TESTS 46 31 102400 1000
67503232 vjudge1 A Dec. 24, 2019, 5:56 a.m. OK MS C++ TESTS 46 31 102400 1000
67520222 vjudge5 A Dec. 24, 2019, 12:10 p.m. OK MS C++ TESTS 46 31 102400 1000
68490454 vjudge3 A Jan. 10, 2020, 11:31 a.m. OK MS C++ TESTS 46 31 102400 1000
68239030 vjudge4 A Jan. 5, 2020, 12:06 p.m. OK MS C++ TESTS 46 31 102400 1000
68236975 vjudge3 A Jan. 5, 2020, 11:20 a.m. OK MS C++ TESTS 46 31 102400 1000
68074543 vjudge1 A Jan. 2, 2020, 11:56 a.m. OK MS C++ TESTS 46 31 102400 1000
66826524 luoxian A Dec. 14, 2019, 9:08 a.m. OK MS C++ TESTS 46 31 102400 1000
68154367 vjudge2 A Jan. 4, 2020, 8:20 a.m. OK MS C++ TESTS 46 31 102400 1000
66822653 vjudge3 A Dec. 14, 2019, 7:54 a.m. OK MS C++ TESTS 46 31 102400 1000
66375706 5130 A Dec. 6, 2019, 2:33 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
68149256 vjudge4 A Jan. 4, 2020, 6:10 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
68067397 vjudge1 A Jan. 2, 2020, 8:34 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
66387779 vjudge4 A Dec. 6, 2019, 8:06 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
66387683 zhangwen123 A Dec. 6, 2019, 8:04 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
66378658 kunhhh A Dec. 6, 2019, 4:30 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
66376021 shenaowang A Dec. 6, 2019, 2:46 a.m. OK MS C++ 2017 TESTS 46 31 102400 1000
67929417 minhnhathcmus A Dec. 29, 2019, 5:14 p.m. OK MS C++ 2017 TESTS 46 31 204800 1000
67994604 vjudge2 A Dec. 31, 2019, 7:21 a.m. OK MS C++ 2017 TESTS 46 31 204800 1000
68644127 FumeiYaziwa A Jan. 12, 2020, 8:29 a.m. OK MS C++ 2017 TESTS 46 31 204800 1000
66550530 shivam1420 A Dec. 9, 2019, 2:44 p.m. OK Node.js TESTS 46 218 6348800 1000
67071038 Evelina.Eva A Dec. 17, 2019, 12:47 p.m. OK PascalABC.NET TESTS 46 655 102400 1000
66364347 mayakin A Dec. 5, 2019, 6:51 p.m. OK PHP TESTS 46 62 409600 1000
67152629 Kiral55 A Dec. 18, 2019, 11:22 a.m. OK PHP TESTS 46 62 409600 1000
66339841 batyrbek.zhunis A Dec. 5, 2019, 3:27 p.m. OK PHP TESTS 46 77 409600 1000
67135571 gregvernon A Dec. 18, 2019, 3:57 a.m. OK PHP TESTS 46 77 5836800 1000
66540418 MAKARonin A Dec. 9, 2019, 11:17 a.m. OK PHP TESTS 46 77 12185600 1000
66375878 aaa_bbb_ccc A Dec. 6, 2019, 2:40 a.m. OK PyPy 2 TESTS 46 202 3584000 1000
66608090 11fingers A Dec. 10, 2019, 7:36 p.m. OK PyPy 2 TESTS 46 233 4403200 1000
66500547 yumtam A Dec. 8, 2019, 12:21 p.m. OK PyPy 2 TESTS 46 311 11776000 1000
66527405 anshuman16423 A Dec. 9, 2019, 5:49 a.m. OK PyPy 2 TESTS 46 342 7884800 1000
66343091 Manjot0998 A Dec. 5, 2019, 3:38 p.m. OK PyPy 2 TESTS 46 655 5120000 1000
66367122 chaudhary_19 A Dec. 5, 2019, 7:53 p.m. OK PyPy 3 TESTS 46 202 5324800 1000
67450993 mitribunskiy A Dec. 23, 2019, 4:12 a.m. OK PyPy 3 TESTS 46 202 6041600 1000
66413194 Coki628 A Dec. 6, 2019, 4:04 p.m. OK PyPy 3 TESTS 46 202 6553600 1000
66366715 thekushalghosh A Dec. 5, 2019, 7:43 p.m. OK PyPy 3 TESTS 46 202 7168000 1000
66377429 H4Wk3ye A Dec. 6, 2019, 3:46 a.m. OK PyPy 3 TESTS 46 202 10240000 1000
66374145 Coki628 A Dec. 6, 2019, 1:23 a.m. OK PyPy 3 TESTS 46 202 10342400 1000
66338235 neweekoff A Dec. 5, 2019, 3:22 p.m. OK PyPy 3 TESTS 46 217 5120000 1000
66363356 YamenAlmasalmeh A Dec. 5, 2019, 6:34 p.m. OK PyPy 3 TESTS 46 217 5324800 1000
66344125 serezgik1994_gmail_com A Dec. 5, 2019, 3:42 p.m. OK PyPy 3 TESTS 46 217 5836800 1000
66345442 simretaraya A Dec. 5, 2019, 3:47 p.m. OK PyPy 3 TESTS 46 218 5120000 1000
66341978 resita A Dec. 5, 2019, 3:34 p.m. OK Python 2 TESTS 46 218 716800 1000
66369389 elistark A Dec. 5, 2019, 9:07 p.m. OK Python 2 TESTS 46 218 1126400 1000
66376835 aavrug A Dec. 6, 2019, 3:21 a.m. OK Python 2 TESTS 46 249 2560000 1000
66377098 aavrug A Dec. 6, 2019, 3:31 a.m. OK Python 2 TESTS 46 280 2457600 1000
66361583 ashashwat A Dec. 5, 2019, 6:10 p.m. OK Python 2 TESTS 46 311 5632000 1000
66361100 ashashwat A Dec. 5, 2019, 6:05 p.m. OK Python 2 TESTS 46 358 5734400 1000
66340591 ashashwat A Dec. 5, 2019, 3:29 p.m. OK Python 2 TESTS 46 421 5632000 1000
66662176 MehulJ A Dec. 12, 2019, 5:11 a.m. OK Python 3 TESTS 46 140 1740800 1000
66466067 sonya123 A Dec. 7, 2019, 4:33 p.m. OK Python 3 TESTS 46 140 1740800 1000
66563851 jameshamm A Dec. 9, 2019, 8:25 p.m. OK Python 3 TESTS 46 155 1126400 1000
66535873 MasterPassion A Dec. 9, 2019, 9:34 a.m. OK Python 3 TESTS 46 171 921600 1000
67124635 divyansh_io A Dec. 17, 2019, 7:29 p.m. OK Python 3 TESTS 46 171 1024000 1000
66540591 Alex_by A Dec. 9, 2019, 11:21 a.m. OK Python 3 TESTS 46 171 1024000 1000
66375252 unolight A Dec. 6, 2019, 2:16 a.m. OK Python 3 TESTS 46 171 1024000 1000
66371677 RunFor A Dec. 5, 2019, 10:44 p.m. OK Python 3 TESTS 46 171 1024000 1000
66369814 beethoven97 A Dec. 5, 2019, 9:22 p.m. OK Python 3 TESTS 46 171 1024000 1000
66382667 sayanchowdhury A Dec. 6, 2019, 6:17 a.m. OK Python 3 TESTS 46 171 1126400 1000
66384328 super_hook_girl_lover A Dec. 6, 2019, 6:54 a.m. OK Ruby TESTS 46 139 15564800 1000
67992322 Rara. A Dec. 31, 2019, 5:54 a.m. OK Ruby TESTS 46 218 15667200 1000
68072446 XytenSki A Jan. 2, 2020, 10:58 a.m. OK Rust TESTS 46 31 512000 1000
66382364 alleycat-at-git A Dec. 6, 2019, 6:09 a.m. OK Rust TESTS 46 31 1024000 1000
68236929 smas A Jan. 5, 2020, 11:19 a.m. OK Scala TESTS 46 530 0 1000

remove filters

Back to search problems