Codeforces Round 785 (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
1673 Codeforces Round 785 (Div. 2) FINISHED False 7200 85850663 April 30, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 15821 ) B A Perfectly Balanced String? PROGRAMMING brute force greedy strings

B'Let 's call a string s perfectly balanced if for all possible triplets (t,u,v) such that t is a non-empty substring of s and u and v are characters present in s , the difference between the frequencies of u and v in t is not more than 1 . For example, the strings "aba" and "abc" are perfectly balanced but "abb" is not because for the triplet ("bb", 'a ', 'b '), the condition is not satisfied. You are given a string s consisting of lowercase English letters only. Your task is to determine whether s is perfectly balanced or not. A string b is called a substring of another string a if b can be obtained by deleting some characters (possibly 0 ) from the start and some characters (possibly 0 ) from the end of a . The first line of input contains a single integer t ( 1 <= q t <= q 2 cdot 10^4 ) denoting the number of testcases. Each of the next t lines contain a single string s ( 1 <= q |s| <= q 2 cdot 10^5 ), consisting of lowercase English letters. It is guaranteed that the sum of |s| over all testcases does not exceed 2 cdot 10^5 . For each test case, print "YES" if s is a perfectly balanced string, and "NO" otherwise. You may print each letter in any case (for example, "YES", "Yes", "yes", "yEs" will all be recognized as positive answer). Let f_t(c) represent the frequency of character c in string t . For the first testcase we have t f_t(a) f_t(b) a 1 0 ab 1 1 aba 2 1 b 0 1 ba 1 1 It can be seen that for any substring t of s , the difference between f_t(a) and f_t(b) is not more than 1 . Hence the string s is perfectly balanced. For the second testcase we have t f_t(a) f_t(b) a 1 0 ab 1 1 abb 1 2 b 0 1 $$'...

Tutorials

Codeforces Round #785 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
155435387 cyrus_msk B April 30, 2022, 4:09 p.m. OK D TESTS 16 46 6348800
155475786 zsa.sauran B May 1, 2022, 4:51 a.m. OK GNU C11 TESTS 17 78 204800
155441013 sayemsub15 B April 30, 2022, 4:31 p.m. OK GNU C11 TESTS 16 93 204800
155453491 Gold_Dragon B April 30, 2022, 7:02 p.m. OK GNU C11 TESTS 17 93 204800
155434728 Pawan_Lahoti B April 30, 2022, 4:07 p.m. OK GNU C11 TESTS 16 109 204800
155436316 ztfgsxdgyt B April 30, 2022, 4:13 p.m. OK GNU C11 TESTS 16 109 1024000
155469626 InterContation B May 1, 2022, 2:37 a.m. OK GNU C++14 TESTS 17 15 204800
155450002 AFObject B April 30, 2022, 6:04 p.m. OK GNU C++14 TESTS 17 15 204800
155474129 AIM-9X B May 1, 2022, 4:18 a.m. OK GNU C++14 TESTS 17 15 307200
155471941 Murot_06 B May 1, 2022, 3:34 a.m. OK GNU C++14 TESTS 17 15 512000
155469317 Fantasyli B May 1, 2022, 2:29 a.m. OK GNU C++14 TESTS 17 15 512000
155466686 vivek2943 B May 1, 2022, 1:09 a.m. OK GNU C++14 TESTS 17 15 512000
155466127 TheNeverChosen B May 1, 2022, 12:50 a.m. OK GNU C++14 TESTS 17 15 512000
155465894 wesley055555 B May 1, 2022, 12:43 a.m. OK GNU C++14 TESTS 17 15 512000
155478724 shreyyshahh B May 1, 2022, 5:37 a.m. OK GNU C++14 TESTS 17 15 512000
155475244 GlenBzc B May 1, 2022, 4:40 a.m. OK GNU C++14 TESTS 17 15 512000
155466266 202001024324 B May 1, 2022, 12:55 a.m. OK GNU C++17 TESTS 17 15 204800
155465452 QiuZiYi B May 1, 2022, 12:28 a.m. OK GNU C++17 TESTS 17 15 204800
155445421 xlykle B April 30, 2022, 5:12 p.m. OK GNU C++17 TESTS 17 15 204800
155442319 yuban17143 B April 30, 2022, 4:34 p.m. OK GNU C++17 TESTS 16 15 204800
155439428 Andycraft B April 30, 2022, 4:25 p.m. OK GNU C++17 TESTS 16 15 204800
155468831 xlykle B May 1, 2022, 2:16 a.m. OK GNU C++17 TESTS 17 15 204800
155476303 Heart_hurt B May 1, 2022, 5 a.m. OK GNU C++17 TESTS 17 15 204800
155477613 Fatma_Abdelhamed B May 1, 2022, 5:21 a.m. OK GNU C++17 TESTS 17 15 204800
155477738 nozeno B May 1, 2022, 5:23 a.m. OK GNU C++17 TESTS 17 15 204800
155473822 julic20s B May 1, 2022, 4:12 a.m. OK GNU C++17 TESTS 17 15 204800
155436082 Vistonzhang B April 30, 2022, 4:12 p.m. OK GNU C++17 (64) TESTS 16 15 204800
155464283 julianferres B April 30, 2022, 11:47 p.m. OK GNU C++17 (64) TESTS 17 15 512000
155479332 startrek4 B May 1, 2022, 5:45 a.m. OK GNU C++17 (64) TESTS 17 15 512000
155478954 startrek4 B May 1, 2022, 5:40 a.m. OK GNU C++17 (64) TESTS 17 15 512000
155474016 Inzam_Z B May 1, 2022, 4:16 a.m. OK GNU C++17 (64) TESTS 17 15 512000
155468987 leo22 B May 1, 2022, 2:20 a.m. OK GNU C++17 (64) TESTS 17 15 512000
155468292 lnitwz B May 1, 2022, 2:01 a.m. OK GNU C++17 (64) TESTS 17 15 512000
155464482 Zuka B April 30, 2022, 11:55 p.m. OK GNU C++17 (64) TESTS 17 15 512000
155464274 Rania B April 30, 2022, 11:47 p.m. OK GNU C++17 (64) TESTS 17 15 512000
155464222 llc5pg B April 30, 2022, 11:45 p.m. OK GNU C++17 (64) TESTS 17 15 512000
155479191 Mechashadow B May 1, 2022, 5:43 a.m. OK GNU C++20 (64) TESTS 17 0 512000
155456277 Lana_Qassas B April 30, 2022, 7:56 p.m. OK GNU C++20 (64) TESTS 17 0 2355200
155434704 give5 B April 30, 2022, 4:07 p.m. OK GNU C++20 (64) TESTS 16 15 102400
155465654 A-Quark B May 1, 2022, 12:34 a.m. OK GNU C++20 (64) TESTS 17 15 204800
155474673 arpandesai0 B May 1, 2022, 4:29 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155478130 aspireboy B May 1, 2022, 5:29 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155480298 pradeep_kasyap B May 1, 2022, 5:59 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155477141 Aktan17 B May 1, 2022, 5:14 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155477019 LEMMiNO B May 1, 2022, 5:12 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155475473 Kinmod B May 1, 2022, 4:45 a.m. OK GNU C++20 (64) TESTS 17 15 512000
155479233 sharnit B May 1, 2022, 5:44 a.m. OK Java 11 TESTS 17 186 0
155474606 dhruvil8804 B May 1, 2022, 4:27 a.m. OK Java 11 TESTS 17 186 0
155453615 Tima_Ulezko B April 30, 2022, 7:04 p.m. OK Java 11 TESTS 17 186 0
155446317 vijender_8601 B April 30, 2022, 5:23 p.m. OK Java 11 TESTS 17 187 0
155477570 sf14t B May 1, 2022, 5:20 a.m. OK Java 11 TESTS 17 202 0
155473735 Harshit66 B May 1, 2022, 4:10 a.m. OK Java 11 TESTS 17 202 0
155452714 mareshkau B April 30, 2022, 6:49 p.m. OK Java 11 TESTS 17 202 0
155443510 rohanailoni B April 30, 2022, 4:57 p.m. OK Java 11 TESTS 16 202 0
155430921 parth_13_ B April 30, 2022, 3:52 p.m. OK Java 11 TESTS 16 202 0
155466586 the_unseen B May 1, 2022, 1:05 a.m. OK Java 11 TESTS 17 234 0
155455291 Mohamed308 B April 30, 2022, 7:35 p.m. OK Java 8 TESTS 17 108 0
155477383 ninjamayank B May 1, 2022, 5:17 a.m. OK Java 8 TESTS 17 109 0
155448428 Mohamed308 B April 30, 2022, 5:43 p.m. OK Java 8 TESTS 17 109 0
155441926 ibrahim.soltan918 B April 30, 2022, 4:33 p.m. OK Java 8 TESTS 16 109 0
155476221 Syed_Ali_SJIT B May 1, 2022, 4:59 a.m. OK Java 8 TESTS 17 124 0
155460383 rock_777 B April 30, 2022, 9:36 p.m. OK Java 8 TESTS 17 124 0
155456394 Koka B April 30, 2022, 7:59 p.m. OK Java 8 TESTS 17 124 0
155445960 sanjayram21 B April 30, 2022, 5:18 p.m. OK Java 8 TESTS 17 124 0
155437673 headshot1703 B April 30, 2022, 4:18 p.m. OK Java 8 TESTS 16 124 0
155431145 ttolkku B April 30, 2022, 3:53 p.m. OK Java 8 TESTS 16 124 0
155445322 ryanberg B April 30, 2022, 5:11 p.m. OK Kotlin 1.5 TESTS 17 436 0
155471593 deyilhou B May 1, 2022, 3:24 a.m. OK MS C++ 2017 TESTS 17 31 409600
155432720 hero_of_math_and_magic B April 30, 2022, 3:59 p.m. OK MS C++ 2017 TESTS 16 31 512000
155434677 202003021019 B April 30, 2022, 4:06 p.m. OK MS C++ 2017 TESTS 16 31 6451200
155477135 onepeopleheart B May 1, 2022, 5:14 a.m. OK MS C++ 2017 TESTS 17 46 23244800
155464174 ArcComp B April 30, 2022, 11:43 p.m. OK MS C++ 2017 TESTS 17 77 409600
155432277 F.O.X. B April 30, 2022, 3:57 p.m. OK MS C++ 2017 TESTS 16 77 409600
155437499 star-coder-ioer B April 30, 2022, 4:18 p.m. OK MS C++ 2017 TESTS 16 77 1024000
155443236 liJD B April 30, 2022, 4:56 p.m. OK MS C++ 2017 TESTS 16 77 2048000
155472146 Fish_L B May 1, 2022, 3:39 a.m. OK MS C++ 2017 TESTS 17 92 512000
155433858 LSY530 B April 30, 2022, 4:03 p.m. OK MS C++ 2017 TESTS 16 93 204800
155435802 stevenguyen1107ntu B April 30, 2022, 4:11 p.m. OK Node.js TESTS 16 93 8908800
155439149 Janer B April 30, 2022, 4:24 p.m. OK PascalABC.NET TESTS 16 717 204800
155443702 1_2_3_4_5_9 B April 30, 2022, 4:58 p.m. OK PyPy 2 TESTS 17 171 3379200
155458914 fme B April 30, 2022, 8:57 p.m. OK PyPy 2 TESTS 17 436 11468800
155477582 vermakunal088 B May 1, 2022, 5:21 a.m. OK PyPy 3 TESTS 17 140 6246400
155439189 yosuanicolaus B April 30, 2022, 4:24 p.m. OK PyPy 3 TESTS 16 155 6246400
155452010 nezzd B April 30, 2022, 6:37 p.m. OK PyPy 3 TESTS 17 155 8192000
155477603 vermakunal088 B May 1, 2022, 5:21 a.m. OK PyPy 3 TESTS 17 156 6041600
155444362 abhijeet.panihar.cse20 B April 30, 2022, 5:03 p.m. OK PyPy 3 TESTS 17 170 6758400
155453539 Adolf988 B April 30, 2022, 7:03 p.m. OK PyPy 3 TESTS 17 171 7680000
155470266 lemiao12 B May 1, 2022, 2:53 a.m. OK PyPy 3 TESTS 17 171 7782400
155431428 arpan.parikh B April 30, 2022, 3:54 p.m. OK PyPy 3 TESTS 16 187 73216000
155449969 YashNandwana B April 30, 2022, 6:04 p.m. OK PyPy 3 TESTS 17 202 7987200
155436749 wizardrabbit B April 30, 2022, 4:15 p.m. OK PyPy 3 TESTS 16 202 14438400
155449525 gesuta B April 30, 2022, 5:58 p.m. OK PyPy 3-64 TESTS 17 93 14438400
155463758 unknownSolver B April 30, 2022, 11:26 p.m. OK PyPy 3-64 TESTS 17 124 20889600
155444198 IkshitG B April 30, 2022, 5:01 p.m. OK PyPy 3-64 TESTS 17 139 13209600
155463821 unknownSolver B April 30, 2022, 11:29 p.m. OK PyPy 3-64 TESTS 17 139 22528000
155439074 Night_Spark--75 B April 30, 2022, 4:24 p.m. OK PyPy 3-64 TESTS 16 155 9625600
155449767 Igrmi B April 30, 2022, 6:01 p.m. OK PyPy 3-64 TESTS 17 155 9932800
155430692 _icy_ B April 30, 2022, 3:52 p.m. OK PyPy 3-64 TESTS 16 218 12800000
155438849 xenonide B April 30, 2022, 4:23 p.m. OK PyPy 3-64 TESTS 16 233 10240000
155460108 zero_dev B April 30, 2022, 9:29 p.m. OK PyPy 3-64 TESTS 17 248 12390400
155450866 nitish420 B April 30, 2022, 6:18 p.m. OK PyPy 3-64 TESTS 17 264 14643200
155443246 iron_nicko B April 30, 2022, 4:56 p.m. OK Python 3 TESTS 16 124 409600
155469597 sayedElgholy B May 1, 2022, 2:36 a.m. OK Python 3 TESTS 17 187 409600
155474806 andr14142 B May 1, 2022, 4:31 a.m. OK Python 3 TESTS 17 202 204800
155469675 sayedElgholy B May 1, 2022, 2:38 a.m. OK Python 3 TESTS 17 202 409600
155440390 kamal_singh89 B April 30, 2022, 4:28 p.m. OK Python 3 TESTS 16 202 409600
155469496 sayedElgholy B May 1, 2022, 2:33 a.m. OK Python 3 TESTS 17 217 409600
155433521 prathamgolhani B April 30, 2022, 4:02 p.m. OK Python 3 TESTS 16 218 1126400
155474415 andr14142 B May 1, 2022, 4:24 a.m. OK Python 3 TESTS 17 233 409600
155470528 senju_kage B May 1, 2022, 2:59 a.m. OK Python 3 TESTS 17 233 409600
155436424 vignesh_Vel B April 30, 2022, 4:13 p.m. OK Python 3 TESTS 16 233 409600
155454358 utkarsh B April 30, 2022, 7:17 p.m. OK Ruby 3 TESTS 17 358 28979200
155470209 zeronosu77108_ B May 1, 2022, 2:51 a.m. OK Rust 2021 TESTS 17 62 25292800

remove filters

Back to search problems