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 |
---|---|---|---|---|---|---|
1606 | Educational Codeforces Round 116 (Rated for Div. 2) | FINISHED | False | 7200 | 101661863 | Oct. 29, 2021, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 26009 ) | A | AB Balance | PROGRAMMING | constructive algorithms strings |
B"You are given a string s of length n consisting of characters a and/or b. Let operatorname{AB}(s) be the number of occurrences of string ab in s as a substring. Analogically, operatorname{BA}(s) is the number of occurrences of ba in s as a substring. In one step, you can choose any index i and replace s_i with character a or b. What is the minimum number of steps you need to make to achieve operatorname{AB}(s) = operatorname{BA}(s) ? Reminder: The number of occurrences of string d in s as substring is the number of indices i ( 1 <= i <= |s| - |d| + 1 ) such that substring s_i s_{i + 1} ... s_{i + |d| - 1} is equal to d . For example, operatorname{AB}( aabbbabaa ) = 2 since there are two indices i : i = 2 where aabbbabaa and i = 6 where aabbbabaa. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 1000 ). Description of the test cases follows. The first and only line of each test case contains a single string s ( 1 <= |s| <= 100 , where |s| is the length of the string s ), consisting only of characters a and/or b. For each test case, print the resulting string s with operatorname{AB}(s) = operatorname{BA}(s) you'll get making the minimum number of steps. If there are multiple answers, print any of them. In the first test case, both operatorname{AB}(s) = 0 and operatorname{BA}(s) = 0 (there are no occurrences of ab (ba) in b), so can leave s untouched. In the second test case, operatorname{AB}(s) = 2 and operatorname{BA}(s) = 2 , so you can leave s untouched. In the third test case, operatorname{AB}(s) = 1 and operatorname{BA}(s) = 0 . For example, we can change s_1 to b and make both values zero. In the fourth test case, operatorname{AB}(s) = 2 and operatorname{BA}(s) ="... |
96454 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
133558150 | julic20s | A | Oct. 30, 2021, 3:07 a.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133512284 | Iizshit | A | Oct. 29, 2021, 4:13 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133513395 | __TheKing | A | Oct. 29, 2021, 4:16 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133517845 | mswetha19 | A | Oct. 29, 2021, 4:28 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133529864 | itami-o-shire | A | Oct. 29, 2021, 5:44 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133532731 | nabiurrahman2004 | A | Oct. 29, 2021, 6:11 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133533316 | p_venkatasivani | A | Oct. 29, 2021, 6:17 p.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133557762 | Mrjin | A | Oct. 30, 2021, 2:59 a.m. | OK | GNU C11 | TESTS | 4 | 15 | 3686400 | ||
133557294 | milan_s1 | A | Oct. 30, 2021, 2:49 a.m. | OK | GNU C11 | TESTS | 4 | 31 | 3686400 | ||
133523686 | Wizard_Unbeatable | A | Oct. 29, 2021, 4:52 p.m. | OK | GNU C11 | TESTS | 4 | 156 | 3686400 | ||
133557515 | fr200110217102 | A | Oct. 30, 2021, 2:53 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133568290 | AlexWangr | A | Oct. 30, 2021, 5:56 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133568376 | luogu_bot3 | A | Oct. 30, 2021, 5:57 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133566094 | L0u15 | A | Oct. 30, 2021, 5:29 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133565871 | _Sunrise | A | Oct. 30, 2021, 5:27 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133565330 | assiduous27 | A | Oct. 30, 2021, 5:20 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133561839 | L_restricted | A | Oct. 30, 2021, 4:19 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133560301 | Sophon1984 | A | Oct. 30, 2021, 3:52 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133558094 | yenaibangbing | A | Oct. 30, 2021, 3:06 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133558070 | offline_exam | A | Oct. 30, 2021, 3:06 a.m. | OK | GNU C++14 | TESTS | 4 | 0 | 1024000 | ||
133568085 | deepak_iiitr | A | Oct. 30, 2021, 5:53 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133566479 | adi_deshmukh_104 | A | Oct. 30, 2021, 5:34 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133563887 | log2r | A | Oct. 30, 2021, 4:56 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133563445 | zhbbbb | A | Oct. 30, 2021, 4:46 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133563232 | log2r | A | Oct. 30, 2021, 4:43 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133559612 | ZeesangPie | A | Oct. 30, 2021, 3:37 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133558843 | Harsh_code26 | A | Oct. 30, 2021, 3:22 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133557872 | Jiang_OVO | A | Oct. 30, 2021, 3:01 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133557868 | _Kaneki_ | A | Oct. 30, 2021, 3:01 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133557791 | kxsk | A | Oct. 30, 2021, 3 a.m. | OK | GNU C++17 | TESTS | 4 | 0 | 1024000 | ||
133552223 | El1bTys3 | A | Oct. 30, 2021, 12:44 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1126400 | ||
133566678 | sagar_vala | A | Oct. 30, 2021, 5:37 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133567440 | 2dumb | A | Oct. 30, 2021, 5:46 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133565190 | CodyTheWolf | A | Oct. 30, 2021, 5:18 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133564766 | CodyTheWolf | A | Oct. 30, 2021, 5:12 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133563302 | luogu_bot3 | A | Oct. 30, 2021, 4:44 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133562396 | 202008140314 | A | Oct. 30, 2021, 4:29 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133561551 | vegetable_rubbish | A | Oct. 30, 2021, 4:14 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133561325 | maddler | A | Oct. 30, 2021, 4:10 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133560202 | Lhohelhohehmm | A | Oct. 30, 2021, 3:50 a.m. | OK | GNU C++17 (64) | TESTS | 4 | 0 | 1228800 | ||
133545009 | sakurahashu | A | Oct. 29, 2021, 9:06 p.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133547470 | armoking | A | Oct. 29, 2021, 10:07 p.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133548852 | cyrux21 | A | Oct. 29, 2021, 10:56 p.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133552951 | Coros_Trusds | A | Oct. 30, 2021, 1:05 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133558046 | abhinay_76 | A | Oct. 30, 2021, 3:05 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133561986 | nandajigyansu | A | Oct. 30, 2021, 4:22 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133562599 | Prince008008 | A | Oct. 30, 2021, 4:32 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133562649 | Monazo1997 | A | Oct. 30, 2021, 4:33 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133565580 | omarsalem1012 | A | Oct. 30, 2021, 5:23 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133567529 | MEET30 | A | Oct. 30, 2021, 5:47 a.m. | OK | GNU C++20 (64) | TESTS | 4 | 0 | 1228800 | ||
133547185 | codelegend | A | Oct. 29, 2021, 9:59 p.m. | OK | Haskell | TESTS | 4 | 15 | 11161600 | ||
133561801 | sakethsriram19 | A | Oct. 30, 2021, 4:19 a.m. | OK | Java 11 | TESTS | 4 | 155 | 24576000 | ||
133511669 | skhammad | A | Oct. 29, 2021, 4:11 p.m. | OK | Java 11 | TESTS | 4 | 155 | 24576000 | ||
133530397 | Relief | A | Oct. 29, 2021, 5:49 p.m. | OK | Java 11 | TESTS | 4 | 155 | 24678400 | ||
133541963 | solo07 | A | Oct. 29, 2021, 8:13 p.m. | OK | Java 11 | TESTS | 4 | 170 | 24473600 | ||
133514534 | umanggupta1975 | A | Oct. 29, 2021, 4:19 p.m. | OK | Java 11 | TESTS | 4 | 171 | 24576000 | ||
133521465 | future_me | A | Oct. 29, 2021, 4:39 p.m. | OK | Java 11 | TESTS | 4 | 171 | 24678400 | ||
133568628 | ak6494285 | A | Oct. 30, 2021, 6 a.m. | OK | Java 11 | TESTS | 4 | 171 | 44748800 | ||
133568365 | ak6494285 | A | Oct. 30, 2021, 5:57 a.m. | OK | Java 11 | TESTS | 4 | 171 | 44748800 | ||
133563459 | sumitchavan | A | Oct. 30, 2021, 4:46 a.m. | OK | Java 11 | TESTS | 4 | 186 | 24473600 | ||
133556316 | fgvjkshuifd | A | Oct. 30, 2021, 2:28 a.m. | OK | Java 11 | TESTS | 4 | 186 | 24576000 | ||
133535092 | Yehia8 | A | Oct. 29, 2021, 6:37 p.m. | OK | Java 8 | TESTS | 4 | 77 | 18944000 | ||
133523174 | tarun_sm | A | Oct. 29, 2021, 4:49 p.m. | OK | Java 8 | TESTS | 4 | 92 | 18841600 | ||
133562581 | abdoad941 | A | Oct. 30, 2021, 4:32 a.m. | OK | Java 8 | TESTS | 4 | 93 | 18841600 | ||
133528582 | Shobhit_Behl | A | Oct. 29, 2021, 5:34 p.m. | OK | Java 8 | TESTS | 4 | 93 | 18841600 | ||
133522150 | RonWonWon | A | Oct. 29, 2021, 4:42 p.m. | OK | Java 8 | TESTS | 4 | 93 | 18841600 | ||
133521155 | Piyushnagpal80 | A | Oct. 29, 2021, 4:37 p.m. | OK | Java 8 | TESTS | 4 | 93 | 18841600 | ||
133558969 | jinal_parmar | A | Oct. 30, 2021, 3:25 a.m. | OK | Java 8 | TESTS | 4 | 108 | 18841600 | ||
133564997 | bugbuster81 | A | Oct. 30, 2021, 5:15 a.m. | OK | Java 8 | TESTS | 4 | 109 | 18841600 | ||
133513924 | pranayrana14 | A | Oct. 29, 2021, 4:17 p.m. | OK | Java 8 | TESTS | 4 | 109 | 18841600 | ||
133564581 | Gurtej | A | Oct. 30, 2021, 5:09 a.m. | OK | Java 8 | TESTS | 4 | 124 | 18841600 | ||
133513025 | Bisquito | A | Oct. 29, 2021, 4:15 p.m. | OK | Kotlin 1.4 | TESTS | 4 | 92 | 19046400 | ||
133518319 | nasonov.coder | A | Oct. 29, 2021, 4:29 p.m. | OK | Kotlin 1.4 | TESTS | 4 | 186 | 22016000 | ||
133559885 | Koo_Pung-Kei | A | Oct. 30, 2021, 3:43 a.m. | OK | Kotlin 1.5 | TESTS | 4 | 202 | 24678400 | ||
133568485 | shuitishashou | A | Oct. 30, 2021, 5:58 a.m. | OK | MS C++ 2017 | TESTS | 4 | 0 | 1126400 | ||
133568187 | 20hucufzh | A | Oct. 30, 2021, 5:55 a.m. | OK | MS C++ 2017 | TESTS | 4 | 0 | 1126400 | ||
133518914 | Nightblue7 | A | Oct. 29, 2021, 4:31 p.m. | OK | MS C++ 2017 | TESTS | 4 | 0 | 1126400 | ||
133568753 | 20hucufzh | A | Oct. 30, 2021, 6:02 a.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133567774 | Shiny_ruo | A | Oct. 30, 2021, 5:50 a.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133565027 | Aayush5sep | A | Oct. 30, 2021, 5:15 a.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133562197 | nwanna007 | A | Oct. 30, 2021, 4:26 a.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133538259 | Ilko_Andriy | A | Oct. 29, 2021, 7:17 p.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133535875 | kriksnonsi | A | Oct. 29, 2021, 6:46 p.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133529298 | Xeniya | A | Oct. 29, 2021, 5:40 p.m. | OK | MS C++ 2017 | TESTS | 4 | 15 | 1126400 | ||
133537801 | whatshisbucket | A | Oct. 29, 2021, 7:11 p.m. | OK | PyPy 3 | TESTS | 4 | 62 | 19251200 | ||
133521738 | orp1745 | A | Oct. 29, 2021, 4:40 p.m. | OK | PyPy 3 | TESTS | 4 | 77 | 19865600 | ||
133521452 | Bad_day_toCode | A | Oct. 29, 2021, 4:39 p.m. | OK | PyPy 3 | TESTS | 4 | 93 | 20172800 | ||
133524232 | de_sousa | A | Oct. 29, 2021, 4:56 p.m. | OK | PyPy 3 | TESTS | 4 | 93 | 20787200 | ||
133535737 | the_emerging_coder | A | Oct. 29, 2021, 6:45 p.m. | OK | PyPy 3 | TESTS | 4 | 108 | 21299200 | ||
133544053 | martarel | A | Oct. 29, 2021, 8:46 p.m. | OK | PyPy 3 | TESTS | 4 | 109 | 20172800 | ||
133543389 | _vermouth_ | A | Oct. 29, 2021, 8:35 p.m. | OK | PyPy 3 | TESTS | 4 | 109 | 20377600 | ||
133538140 | Fedak_Aleksandra | A | Oct. 29, 2021, 7:16 p.m. | OK | PyPy 3 | TESTS | 4 | 124 | 20377600 | ||
133512490 | alkesh24 | A | Oct. 29, 2021, 4:13 p.m. | OK | PyPy 3 | TESTS | 4 | 124 | 20377600 | ||
133567480 | kavbhat | A | Oct. 30, 2021, 5:46 a.m. | OK | PyPy 3 | TESTS | 4 | 124 | 20480000 | ||
133531947 | mayank35 | A | Oct. 29, 2021, 6:03 p.m. | OK | PyPy 3-64 | TESTS | 4 | 62 | 30720000 | ||
133524803 | magnus.hegdahl | A | Oct. 29, 2021, 5:01 p.m. | OK | PyPy 3-64 | TESTS | 4 | 62 | 30924800 | ||
133524306 | feelme | A | Oct. 29, 2021, 4:57 p.m. | OK | PyPy 3-64 | TESTS | 4 | 77 | 31436800 | ||
133525267 | mkawa2 | A | Oct. 29, 2021, 5:04 p.m. | OK | PyPy 3-64 | TESTS | 4 | 77 | 32051200 | ||
133519116 | IkshitG | A | Oct. 29, 2021, 4:31 p.m. | OK | PyPy 3-64 | TESTS | 4 | 78 | 31027200 | ||
133566703 | d0gied | A | Oct. 30, 2021, 5:37 a.m. | OK | PyPy 3-64 | TESTS | 4 | 92 | 32870400 | ||
133516140 | swathi-02 | A | Oct. 29, 2021, 4:23 p.m. | OK | PyPy 3-64 | TESTS | 4 | 93 | 32870400 | ||
133545555 | oadey89 | A | Oct. 29, 2021, 9:19 p.m. | OK | PyPy 3-64 | TESTS | 4 | 93 | 33075200 | ||
133532608 | jerinjoseantony | A | Oct. 29, 2021, 6:10 p.m. | OK | PyPy 3-64 | TESTS | 4 | 93 | 33996800 | ||
133534023 | freakbuoyancy | A | Oct. 29, 2021, 6:25 p.m. | OK | PyPy 3-64 | TESTS | 4 | 108 | 32870400 | ||
133547828 | NeZlox | A | Oct. 29, 2021, 10:17 p.m. | OK | Python 3 | TESTS | 4 | 30 | 4505600 | ||
133536174 | shashankbarole410 | A | Oct. 29, 2021, 6:50 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4198400 | ||
133557956 | n3ffus | A | Oct. 30, 2021, 3:04 a.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133553924 | ainunnajib | A | Oct. 30, 2021, 1:32 a.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133543749 | 2441139 | A | Oct. 29, 2021, 8:41 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133531902 | Girniiiii | A | Oct. 29, 2021, 6:02 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133528325 | Sulter | A | Oct. 29, 2021, 5:33 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133523021 | siraajgudu65 | A | Oct. 29, 2021, 4:48 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4300800 | ||
133534429 | rumanbhuiyan | A | Oct. 29, 2021, 6:29 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4505600 | ||
133519262 | tieros | A | Oct. 29, 2021, 4:31 p.m. | OK | Python 3 | TESTS | 4 | 31 | 4505600 | ||
133545033 | program141592 | A | Oct. 29, 2021, 9:06 p.m. | OK | Rust | TESTS | 4 | 0 | 1228800 | ||
133525746 | noogler | A | Oct. 29, 2021, 5:08 p.m. | OK | Rust | TESTS | 4 | 15 | 1228800 | ||
133552990 | Spheniscine | A | Oct. 30, 2021, 1:06 a.m. | OK | Rust | TESTS | 4 | 15 | 1331200 | ||
133554561 | magurofly | A | Oct. 30, 2021, 1:47 a.m. | OK | Rust | TESTS | 4 | 46 | 1536000 |
Back to search problems