Codeforces Round 705 (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
1493 Codeforces Round 705 (Div. 2) FINISHED False 8100 122313311 March 6, 2021, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4682 ) C K-beautiful Strings PROGRAMMING binary search brute force greedy implementation strings #Beautiful strings

B'You are given a string s consisting of lowercase English letters and a number k . Let 's call a string consisting of lowercase English letters beautiful if the number of occurrences of each letter in that string is divisible by k . You are asked to find the lexicographically smallest beautiful string of length n , which is lexicographically greater or equal to string s . If such a string does not exist, output -1 . A string a is lexicographically smaller than a string b if and only if one of the following holds: The first line contains a single integer T ( 1 <= T <= 10 ,000 ) -- the number of test cases. The next 2 cdot T lines contain the description of test cases. The description of each test case consists of two lines. The first line of the description contains two integers n and k ( 1 <= k <= n <= 10^5 ) -- the length of string s and number k respectively. The second line contains string s consisting of lowercase English letters. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case output in a separate line lexicographically smallest beautiful string of length n , which is greater or equal to string s , or -1 if such a string does not exist. In the first test case "acac" is greater than or equal to s , and each letter appears 2 or 0 times in it, so it is beautiful. In the second test case each letter appears 0 or 1 times in s , so s itself is the answer. We can show that there is no suitable string in the third test case. In the fourth test case each letter appears 0 , 3 , or 6 times in "abaabaaab". All these integers are divisible by 3 . '...

Tutorials

Codeforces Round #705 (Div.2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
109309847 chen_03 C March 7, 2021, 6:06 a.m. OK GNU C++11 TESTS 36 30 0
109279910 huangyi10040 C March 6, 2021, 4:57 p.m. OK GNU C++11 TESTS 36 31 0
109299545 fishcathu. C March 7, 2021, 2 a.m. OK GNU C++11 TESTS 36 31 102400
109282190 YeahPotato C March 6, 2021, 5:20 p.m. OK GNU C++11 TESTS 36 31 102400
109275198 c20201807 C March 6, 2021, 4:15 p.m. OK GNU C++11 TESTS 36 31 102400
109300140 cunzai_zsy0531 C March 7, 2021, 2:18 a.m. OK GNU C++11 TESTS 36 31 102400
109272263 Bowen123 C March 6, 2021, 4:07 p.m. OK GNU C++11 TESTS 36 31 102400
109306733 xh092113 C March 7, 2021, 5:13 a.m. OK GNU C++11 TESTS 36 31 204800
109271504 echozhou C March 6, 2021, 4:04 p.m. OK GNU C++11 TESTS 36 31 204800
109268834 jxm2001_ C March 6, 2021, 3:55 p.m. OK GNU C++11 TESTS 36 31 1024000
109304599 byteeplus C March 7, 2021, 4:25 a.m. OK GNU C++14 TESTS 36 31 102400
109273510 Redsquanium C March 6, 2021, 4:11 p.m. OK GNU C++14 TESTS 36 31 307200
109306427 201901060324 C March 7, 2021, 5:08 a.m. OK GNU C++14 TESTS 36 31 307200
109303530 George1123 C March 7, 2021, 3:56 a.m. OK GNU C++14 TESTS 36 31 307200
109281359 lkj18 C March 6, 2021, 5:10 p.m. OK GNU C++14 TESTS 36 31 307200
109310272 bansalkanha68 C March 7, 2021, 6:13 a.m. OK GNU C++14 TESTS 36 31 409600
109272863 I_Love_Arif C March 6, 2021, 4:09 p.m. OK GNU C++14 TESTS 36 31 512000
109281302 acm C March 6, 2021, 5:09 p.m. OK GNU C++14 TESTS 36 31 512000
109281342 lmhoang C March 6, 2021, 5:10 p.m. OK GNU C++14 TESTS 36 31 11571200
109298534 SuperJ6 C March 7, 2021, 1:18 a.m. OK GNU C++14 TESTS 36 46 307200
109279142 chen_zexing C March 6, 2021, 4:51 p.m. OK GNU C++17 TESTS 36 31 102400
109280882 windy7926778 C March 6, 2021, 5:06 p.m. OK GNU C++17 TESTS 36 31 204800
109299091 200815147 C March 7, 2021, 1:42 a.m. OK GNU C++17 TESTS 36 31 204800
109276351 fr200110217102 C March 6, 2021, 4:18 p.m. OK GNU C++17 TESTS 36 31 204800
109275823 I_Scream C March 6, 2021, 4:17 p.m. OK GNU C++17 TESTS 36 31 204800
109282095 Is1500EnoughForEGOI C March 6, 2021, 5:19 p.m. OK GNU C++17 TESTS 36 31 307200
109272099 kiyoshi0205 C March 6, 2021, 4:06 p.m. OK GNU C++17 TESTS 36 31 307200
109300373 ariloc C March 7, 2021, 2:24 a.m. OK GNU C++17 TESTS 36 31 409600
109290755 mehtaji C March 6, 2021, 7:41 p.m. OK GNU C++17 TESTS 36 31 409600
109286258 ShlokG C March 6, 2021, 6:17 p.m. OK GNU C++17 TESTS 36 31 409600
109282603 Roberticey C March 6, 2021, 5:25 p.m. OK GNU C++17 (64) TESTS 36 31 102400
109274250 compute C March 6, 2021, 4:13 p.m. OK GNU C++17 (64) TESTS 36 31 409600
109304540 Jorge213 C March 7, 2021, 4:23 a.m. OK GNU C++17 (64) TESTS 36 31 409600
109280015 GeorgeMaharis C March 6, 2021, 4:58 p.m. OK GNU C++17 (64) TESTS 36 31 409600
109278609 Geothermal C March 6, 2021, 4:48 p.m. OK GNU C++17 (64) TESTS 36 31 409600
109278460 kiyoshi0205 C March 6, 2021, 4:47 p.m. OK GNU C++17 (64) TESTS 36 31 409600
109269489 yash_daga C March 6, 2021, 3:58 p.m. OK GNU C++17 (64) TESTS 36 31 409600
109284192 michao C March 6, 2021, 5:47 p.m. OK GNU C++17 (64) TESTS 36 31 512000
109289250 NoPoint C March 6, 2021, 7:09 p.m. OK GNU C++17 (64) TESTS 36 31 512000
109284602 log2win C March 6, 2021, 5:53 p.m. OK GNU C++17 (64) TESTS 36 31 512000
109272630 yaegashi C March 6, 2021, 4:08 p.m. OK Go TESTS 36 265 102400
109282865 sersht C March 6, 2021, 5:29 p.m. OK Go TESTS 36 405 102400
109279682 WSJYQ C March 6, 2021, 4:55 p.m. OK Go TESTS 36 935 102400
109281062 Airflow C March 6, 2021, 5:07 p.m. OK Haskell TESTS 36 77 1126400
109303661 alibaba C March 7, 2021, 4 a.m. OK Java 11 TESTS 36 202 0
109308388 michaelwang23 C March 7, 2021, 5:43 a.m. OK Java 11 TESTS 36 218 0
109301951 pikachu_pika_pika C March 7, 2021, 3:14 a.m. OK Java 11 TESTS 36 218 5632000
109279495 baron_ C March 6, 2021, 4:54 p.m. OK Java 11 TESTS 36 218 5632000
109285504 dusty.and.rusty C March 6, 2021, 6:05 p.m. OK Java 11 TESTS 36 295 102400
109281643 Ste C March 6, 2021, 5:13 p.m. OK Java 11 TESTS 36 311 0
109280639 dusty.and.rusty C March 6, 2021, 5:03 p.m. OK Java 11 TESTS 36 311 102400
109283202 dusty.and.rusty C March 6, 2021, 5:33 p.m. OK Java 11 TESTS 36 327 102400
109294005 i_ll_try_123 C March 6, 2021, 9:12 p.m. OK Java 11 TESTS 36 421 0
109281537 notnamed C March 6, 2021, 5:12 p.m. OK Java 11 TESTS 36 452 1536000
109308256 shojin_pro C March 7, 2021, 5:41 a.m. OK Java 8 TESTS 36 124 0
109296178 polyakoff C March 6, 2021, 10:48 p.m. OK Java 8 TESTS 36 124 0
109294755 TheSawan C March 6, 2021, 9:40 p.m. OK Java 8 TESTS 36 140 0
109287575 This_is_the_one C March 6, 2021, 6:38 p.m. OK Java 8 TESTS 36 155 0
109271454 beroul C March 6, 2021, 4:04 p.m. OK Java 8 TESTS 36 155 15974400
109279394 Zahid_Hasan_Sahin C March 6, 2021, 4:53 p.m. OK Java 8 TESTS 36 187 0
109283447 martins C March 6, 2021, 5:36 p.m. OK Java 8 TESTS 36 326 0
109292600 ZerooCool C March 6, 2021, 8:28 p.m. OK Java 8 TESTS 36 327 0
109271891 MubtasimShahriar C March 6, 2021, 4:06 p.m. OK Java 8 TESTS 36 436 13107200
109279659 YahiaSherif C March 6, 2021, 4:55 p.m. OK Java 8 TESTS 36 467 0
109278820 Tlatoani C March 6, 2021, 4:49 p.m. OK Kotlin TESTS 36 156 0
109299020 SGHD C March 7, 2021, 1:39 a.m. OK Kotlin TESTS 36 795 102400
109272218 koper C March 6, 2021, 4:07 p.m. OK Kotlin TESTS 36 1512 1945600
109283669 jonitox C March 6, 2021, 5:39 p.m. OK MS C++ 2017 TESTS 36 46 409600
109283698 jonitox C March 6, 2021, 5:40 p.m. OK MS C++ 2017 TESTS 36 46 614400
109279818 moreda C March 6, 2021, 4:56 p.m. OK MS C++ 2017 TESTS 36 61 204800
109279723 yvandoor C March 6, 2021, 4:55 p.m. OK MS C++ 2017 TESTS 36 78 204800
109289285 grey C March 6, 2021, 7:09 p.m. OK MS C++ 2017 TESTS 36 92 614400
109271203 Cube219 C March 6, 2021, 4:03 p.m. OK MS C++ 2017 TESTS 36 109 204800
109281422 songuno1 C March 6, 2021, 5:11 p.m. OK MS C++ 2017 TESTS 36 217 614400
109288041 qing_lin C March 6, 2021, 6:46 p.m. OK MS C++ 2017 TESTS 36 296 614400
109279862 Peton C March 6, 2021, 4:57 p.m. OK MS C++ 2017 TESTS 36 296 108441600
109270727 G4NP0N C March 6, 2021, 4:02 p.m. OK .NET Core C# TESTS 36 218 21504000
109279725 shehebe C March 6, 2021, 4:55 p.m. OK PyPy 2 TESTS 36 405 37478400
109268848 jimm89 C March 6, 2021, 3:55 p.m. OK PyPy 3 TESTS 36 280 8704000
109276267 daigakupotato C March 6, 2021, 4:18 p.m. OK PyPy 3 TESTS 36 296 9728000
109289719 kopok C March 6, 2021, 7:18 p.m. OK PyPy 3 TESTS 36 327 9728000
109287949 shuyefan C March 6, 2021, 6:45 p.m. OK PyPy 3 TESTS 36 358 9216000
109293060 manish.17 C March 6, 2021, 8:41 p.m. OK PyPy 3 TESTS 36 358 27648000
109308928 armsusman C March 7, 2021, 5:52 a.m. OK PyPy 3 TESTS 36 405 25497600
109297422 Kishen19 C March 7, 2021, 12:07 a.m. OK PyPy 3 TESTS 36 405 25804800
109283453 titia C March 6, 2021, 5:37 p.m. OK PyPy 3 TESTS 36 421 28569600
109268458 Kishen19 C March 6, 2021, 3:54 p.m. OK PyPy 3 TESTS 36 451 27648000
109294072 Zack C March 6, 2021, 9:14 p.m. OK PyPy 3 TESTS 36 467 10035200
109283028 sh1194 C March 6, 2021, 5:31 p.m. OK Python 3 TESTS 36 686 1740800
109283172 sh1194 C March 6, 2021, 5:33 p.m. OK Python 3 TESTS 36 717 1638400
109282916 sh1194 C March 6, 2021, 5:30 p.m. OK Python 3 TESTS 36 733 1740800
109282871 sh1194 C March 6, 2021, 5:29 p.m. OK Python 3 TESTS 36 748 1638400
109278224 toomer C March 6, 2021, 4:46 p.m. OK Rust TESTS 36 46 1331200
109269058 apilat C March 6, 2021, 3:56 p.m. OK Rust TESTS 36 249 614400

remove filters

Back to search problems