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 |
|---|---|---|---|---|---|---|
| 2180 | Codeforces Global Round 31 (Div. 1 + Div. 2) | FINISHED | False | 9000 | 10250722 | Dec. 19, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 24451 ) | B | Ashmal | PROGRAMMING | greedy strings |
You have an array (a) of (n) strings (a_{1}, a_{2}, \ldots, a_{n}), each consisting of lowercase English letters, and an empty string (s). In the (i)-th ((1 \le i \le n)) step, you should do one of the following: add (a_{i}) to the beginning of (s), or add (a_{i}) to the end of (s). For example, if before the (i)-th step (s = \mathtt{aba}) and (a_{i} = \mathtt{bba}), after the (i)-th step, (s) will be equal to (\mathtt{ababba}) or (\mathtt{bbaaba}). What's the lexicographically smallest string (s) you can reach after (n) steps? 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). 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 a single integer (n) ((1 \le n \le 1000)) — size of array (a). The next line contains (n) strings (a_{1}, a_{2}, \ldots, a_{n}) ((1 \le |a_i| \le 4000)), each consisting of lowercase English letters. It is guaranteed that the sum of (n) over all test cases does not exceed (1000), and the total length of all strings in the input (over all test cases) does not exceed (4000). For each test case, print the lexicographically minimum string (s) you can reach after (n) steps. In the first test case, one possible way to construct the lexicographically minimum string (s) is as follows: After the first step, (s = \mathtt{amir}) regardless of whether we add it to the beginning or the end, since (s) was initially empty. In the second step, we add (a_2 = \mathtt{rima}) to the end of (s). Now (s = \mathtt{amirrima}). |
| Codeforces Global Round 31 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 354256680 | sam_15295 | B | Dec. 20, 2025, 4:08 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 0 | ||
| 354250903 | dargonburn | B | Dec. 20, 2025, 2:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 0 | ||
| 354247370 | JR-OIer | B | Dec. 20, 2025, 12:44 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 0 | ||
| 354235023 | SpideyOp04 | B | Dec. 19, 2025, 7:51 p.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 0 | ||
| 354212708 | limiewin | B | Dec. 19, 2025, 4:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 0 | ||
| 354265763 | pokalwartejas30102005 | B | Dec. 20, 2025, 5:57 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 102400 | ||
| 354251586 | bounce__back | B | Dec. 20, 2025, 2:35 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 102400 | ||
| 354247975 | Akash09 | B | Dec. 20, 2025, 1:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 4198400 | ||
| 354242379 | INTOTHEWOODS | B | Dec. 19, 2025, 9:54 p.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 4198400 | ||
| 354232635 | NiGhT-h-MaRe | B | Dec. 19, 2025, 7:22 p.m. | OK | C++17 (GCC 7-32) | TESTS | 9 | 15 | 4198400 | ||
| 354248325 | ProbeRealms | B | Dec. 20, 2025, 1:13 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 0 | ||
| 354244525 | Zeyad_3BcarenO | B | Dec. 19, 2025, 10:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 0 | ||
| 354262996 | Vanshi_2006 | B | Dec. 20, 2025, 5:29 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 102400 | ||
| 354257096 | Miron_Samarin | B | Dec. 20, 2025, 4:14 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 102400 | ||
| 354254157 | shomend__woooooH | B | Dec. 20, 2025, 3:26 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 102400 | ||
| 354243285 | drogbaaaa | B | Dec. 19, 2025, 10:17 p.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 102400 | ||
| 354232484 | udongein | B | Dec. 19, 2025, 7:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 3993600 | ||
| 354230180 | Alielsalek96 | B | Dec. 19, 2025, 6:54 p.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 15 | 3993600 | ||
| 354266901 | Saitama404 | B | Dec. 20, 2025, 6:08 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 31 | 0 | ||
| 354264218 | 20243660756shanta | B | Dec. 20, 2025, 5:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 9 | 31 | 0 |
Back to search problems