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 |
|---|---|---|---|---|---|---|
| 2085 | Codeforces Round 1011 (Div. 2) | FINISHED | False | 7200 | 33751523 | March 22, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 23380 ) | A | Serval and String Theory | PROGRAMMING | constructive algorithms implementation |
A string (r) consisting only of lowercase Latin letters is called universal if and only if (r) is lexicographically smaller(^{\text{∗}}) than the reversal(^{\text{†}}) of (r). You are given a string (s) consisting of (n) lowercase Latin letters. You are required to make (s) universal . To achieve this, you can perform the following operation on (s) at most (k) times: Choose two indices (i) and (j) ((1\le i,j\le n)), then swap (s_i) and (s_j). Note that if (i=j), you do nothing. Determine whether you can make (s) universal by performing the above operation at most (k) times. (^{\text{∗}})A string (a) is lexicographically smaller than a string (b) of the same length, if and only if the following holds: in the first position where (a) and (b) differ, the string (a) has a letter that appears earlier in the alphabet than the corresponding letter in (b). (^{\text{†}})The reversal of a string (r) is the string obtained by writing (r) from right to left. For example, the reversal of the string (abcad) is (dacba). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains two integers (n) and (k) ((1\le n\le 100), (0\le k\le 10^4)) — the length of the string (s), and the maximum number of operations you can perform. The second line contains a string (s) consisting of (n) lowercase Latin letters. For each test case, print " YES " if it is possible to make (s) universal by performing the operation at most (k) times. Otherwise, print " NO ". You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. In the first test case, (s) will keep the same a |
| Codeforces Round #1011 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 311950148 | huangchenpeng | A | March 23, 2025, 3:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311944086 | CCCman | A | March 23, 2025, 1:42 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311943831 | asmitdeb | A | March 23, 2025, 1:36 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311940391 | varun-1728 | A | March 23, 2025, 12:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311921290 | Bebo. | A | March 22, 2025, 8:21 p.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311905849 | Nayeem_11720 | A | March 22, 2025, 6 p.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311904813 | topcomder69 | A | March 22, 2025, 5:52 p.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311904391 | harinivas_28 | A | March 22, 2025, 5:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311902021 | v0rtex | A | March 22, 2025, 5:33 p.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 0 | ||
| 311953027 | Sarvesh07 | A | March 23, 2025, 4:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 4 | 30 | 102400 | ||
| 311952701 | hars_raj | A | March 23, 2025, 4:09 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311948665 | ryuuko_ | A | March 23, 2025, 3:05 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311948136 | boluowang | A | March 23, 2025, 2:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311938946 | yumkam | A | March 22, 2025, 11:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311912787 | mogamal17 | A | March 22, 2025, 6:57 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311910784 | saket_kumar_07 | A | March 22, 2025, 6:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311903195 | maniii97 | A | March 22, 2025, 5:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311901096 | Treks | A | March 22, 2025, 5:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311900087 | Aezqual | A | March 22, 2025, 5:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 | ||
| 311896343 | pujakumari456pandey | A | March 22, 2025, 5:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 4 | 30 | 0 |
Back to search problems