VK Cup 2022 - Отборочный раунд (Engine)

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
1781 VK Cup 2022 - Отборочный раунд (Engine) FINISHED False 10800 58038899 Jan. 15, 2023, 12:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7725 ) C Equal Frequencies PROGRAMMING greedy implementation

B'Let 's call a string balanced if all characters that are present in it appear the same number of times. For example, "coder", "appall", and "ttttttt" are balanced, while "wowwow" and "codeforces" are not. You are given a string s of length n consisting of lowercase English letters. Find a balanced string t of the same length n consisting of lowercase English letters that is different from the string s in as few positions as possible. In other words, the number of indices i such that s_i ne t_i should be as small as possible. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. Each test case consists of two lines. The first line contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the string s . The second line contains the string s of length n 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, print the smallest number of positions where string s and a balanced string t can differ, followed by such a string t . If there are multiple solutions, print any. It can be shown that at least one balanced string always exists. In the first test case, the given string "hello" is not balanced: letters 'h ', 'e ', and 'o ' appear in it once, while letter 'l ' appears twice. On the other hand, string "helno" is balanced: five distinct letters are present in it, and each of them appears exactly once. Strings "hello" and "helno" differ in just one position: the fourth character. Other solutions are possible too. In the second test case, string "codefofced" is balanced since only letters 'c ', 'o ', 'd ', 'e ', and 'f ' are present in it, and each of them appears exactly twice. In the third test case, string "eeeee" is balanced since only letter 'e ' is present in it. In t'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
189323706 Gassa C Jan. 15, 2023, 12:49 p.m. OK D TESTS 32 124 6144000
189386477 sprads C Jan. 16, 2023, 12:27 a.m. OK GNU C++14 TESTS 32 30 307200
189393410 YeahPotato C Jan. 16, 2023, 3:45 a.m. OK GNU C++14 TESTS 33 31 1638400
189388010 an_interesting_name C Jan. 16, 2023, 1:29 a.m. OK GNU C++14 TESTS 32 46 102400
189317144 TeaPot C Jan. 15, 2023, 12:30 p.m. OK GNU C++14 TESTS 32 46 409600
189315978 awoo C Jan. 15, 2023, 12:27 p.m. OK GNU C++14 TESTS 32 62 4812800
189332515 Igor_Parfenov C Jan. 15, 2023, 1:19 p.m. OK GNU C++14 TESTS 32 77 921600
189395080 yu__xuan C Jan. 16, 2023, 4:20 a.m. OK GNU C++14 TESTS 33 78 409600
189391856 yu__xuan C Jan. 16, 2023, 3:11 a.m. OK GNU C++14 TESTS 33 78 409600
189392382 apovalyaev C Jan. 16, 2023, 3:23 a.m. OK GNU C++14 TESTS 33 109 307200
189317284 antonis.white C Jan. 15, 2023, 12:30 p.m. OK GNU C++17 TESTS 32 31 307200
189314426 Nutella3000 C Jan. 15, 2023, 12:23 p.m. OK GNU C++17 TESTS 32 31 409600
189329376 mrfoxygmfr C Jan. 15, 2023, 1:08 p.m. OK GNU C++17 TESTS 32 31 614400
189324443 limage C Jan. 15, 2023, 12:51 p.m. OK GNU C++17 TESTS 32 31 614400
189319585 Loading. C Jan. 15, 2023, 12:36 p.m. OK GNU C++17 TESTS 32 31 614400
189337325 T0uRistq C Jan. 15, 2023, 1:39 p.m. OK GNU C++17 TESTS 32 46 307200
189329982 kdalex C Jan. 15, 2023, 1:10 p.m. OK GNU C++17 TESTS 32 46 307200
189335276 m0t9_ C Jan. 15, 2023, 1:31 p.m. OK GNU C++17 TESTS 32 46 409600
189330312 Skeef79 C Jan. 15, 2023, 1:11 p.m. OK GNU C++17 TESTS 32 46 409600
189318456 Tima C Jan. 15, 2023, 12:33 p.m. OK GNU C++17 TESTS 32 46 409600
189321280 HCPS42 C Jan. 15, 2023, 12:41 p.m. OK GNU C++17 (64) TESTS 32 15 409600
189317628 Kniaz C Jan. 15, 2023, 12:31 p.m. OK GNU C++17 (64) TESTS 32 31 307200
189324567 JackPa C Jan. 15, 2023, 12:52 p.m. OK GNU C++17 (64) TESTS 32 31 409600
189317289 Andreasyan C Jan. 15, 2023, 12:30 p.m. OK GNU C++17 (64) TESTS 32 31 409600
189315889 tabr C Jan. 15, 2023, 12:26 p.m. OK GNU C++17 (64) TESTS 32 31 512000
189313690 Kirill22 C Jan. 15, 2023, 12:21 p.m. OK GNU C++17 (64) TESTS 32 31 512000
189319556 74TrAkToR C Jan. 15, 2023, 12:36 p.m. OK GNU C++17 (64) TESTS 32 31 1638400
189327223 Absurd_ C Jan. 15, 2023, 1:01 p.m. OK GNU C++17 (64) TESTS 32 31 2355200
189320668 After_all_this_time C Jan. 15, 2023, 12:40 p.m. OK GNU C++17 (64) TESTS 32 46 307200
189319826 receed C Jan. 15, 2023, 12:37 p.m. OK GNU C++17 (64) TESTS 32 46 307200
189338830 leforelle C Jan. 15, 2023, 1:45 p.m. OK GNU C++20 (64) TESTS 32 15 307200
189328703 CoDeRoK C Jan. 15, 2023, 1:05 p.m. OK GNU C++20 (64) TESTS 32 15 307200
189337434 russian_proger C Jan. 15, 2023, 1:39 p.m. OK GNU C++20 (64) TESTS 32 15 1536000
189332623 Wandoka C Jan. 15, 2023, 1:20 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189329379 Mortus C Jan. 15, 2023, 1:08 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189328900 Kmaxkum C Jan. 15, 2023, 1:06 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189328080 EgorUlin C Jan. 15, 2023, 1:03 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189322602 amokrousov C Jan. 15, 2023, 12:46 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189320100 maks_matiupatenko C Jan. 15, 2023, 12:38 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189319171 Alexdat2000 C Jan. 15, 2023, 12:35 p.m. OK GNU C++20 (64) TESTS 32 31 307200
189323455 knightL C Jan. 15, 2023, 12:48 p.m. OK Java 11 TESTS 32 233 0
189321384 mmaxio C Jan. 15, 2023, 12:42 p.m. OK Java 11 TESTS 32 296 0
189344228 alexyz C Jan. 15, 2023, 2:09 p.m. OK Java 17 TESTS 32 358 1024000
189333016 DarLam C Jan. 15, 2023, 1:21 p.m. OK Java 8 TESTS 32 155 0
189319478 iakovlev.zakhar C Jan. 15, 2023, 12:36 p.m. OK Java 8 TESTS 32 156 0
189319487 darnley C Jan. 15, 2023, 12:36 p.m. OK Kotlin 1.7 TESTS 32 1060 78336000
189334964 habibulka C Jan. 15, 2023, 1:29 p.m. OK Kotlin 1.7 TESTS 32 1076 86118400
189346874 batony4 C Jan. 15, 2023, 2:20 p.m. OK Kotlin 1.7 TESTS 32 1872 89395200
189335871 ktropin C Jan. 15, 2023, 1:33 p.m. OK Mono C# TESTS 32 218 8908800
189317015 Arsen4ikVar C Jan. 15, 2023, 12:29 p.m. OK PyPy 3 TESTS 32 763 11776000
189338177 mike_live C Jan. 15, 2023, 1:43 p.m. OK PyPy 3-64 TESTS 32 545 10035200
189335326 Aksnov C Jan. 15, 2023, 1:31 p.m. OK PyPy 3-64 TESTS 32 545 38297600
189315427 Egor C Jan. 15, 2023, 12:25 p.m. OK Rust 2021 TESTS 32 31 409600

remove filters

Back to search problems