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.
Problems
B"Let's define the cost of a string s as the number of index pairs i and j ( 1 <= i < j < |s| ) such that s_i = s_j and s_{i+1} = s_{j+1} . You are given two positive integers n and k . Among all strings with length n that contain only the first k characters of the Latin alphabet, find a string with minimum possible cost. If there are multiple such strings with minimum cost -- find any of them. The only line contains two integers n and k ( 1 <= n <= 2 cdot 10^5; 1 <= k <= 26 ). Print the string s such that it consists of n characters, each its character is one of the k first Latin letters, and it has the minimum possible cost among all these strings. If there are multiple such strings -- print any of them. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
112864275 |
eastnman |
D |
April 12, 2021, 5:33 p.m. |
OK |
Delphi |
TESTS |
43 |
31 |
282624 |
|
|
remove filters
Back to search problems