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 |
|---|---|---|---|---|---|---|
| 2223 | Codeforces Round 1097 (Div. 1, Based on Zhili Cup 2026) | FINISHED | False | 9000 | 2418896 | May 6, 2026, 6:05 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 299 ) | D | Zhily and Cycle | PROGRAMMING | graphs greedy |
Zhily and Jily resolved to travel across the entire world to eliminate all chaos. They start from a certain place and wish to visit every region exactly once. You are given a directed graph with (n) vertices numbered from (1) to (n). For each vertex (i) ((1 \le i \le n)), there are directed edges from (i) to all vertices (j) such that (a_i \le j \le n). Find a Hamiltonian cycle (^{\text{∗}}) of the graph. (^{\text{∗}})A Hamiltonian cycle is a cycle that visits each vertex exactly once. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n\,(1 \leq n \leq 10^5)) — the number of vertices. The second line of each test case contains (n) integers (a_1,a_2,\cdots,a_n\,(1 \leq a_i \leq n)) describing the graph. It is guaranteed that the sum of (n) across all test cases does not exceed (10^6). For each test case, if no Hamiltonian cycle exists, output " No " in one line. Otherwise, output " Yes " on the first line. On the second line, output a permutation (p_1, p_2, \dots, p_n) ((1\le p_i\le n)) representing the order of vertices visited in the cycle. If there are multiple solutions, print any of them. 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, the figure below illustrates a Hamiltonian cycle: (1 \to 7 \to 5 \to 2 \to 4 \to 3 \to 6 \to 1). In the second test case, no Hamiltonian cycle exists because there are no incoming edges to vertex (1) (i.e., no vertex can reach vertex (1)). |
| Codeforces Round 1097 (Div. 1, Div2, Based on Zhili Cup 2026) Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 373682440 | caffeine2ac | D | May 6, 2026, 7:50 a.m. | OK | C# 13 | TESTS | 36 | 203 | 43724800 | ||
| 373676677 | PEIMUDA | D | May 6, 2026, 7:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 390 | 1740800 | ||
| 373710564 | daokailaoge | D | May 6, 2026, 11:45 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 406 | 102400 | ||
| 373679158 | potato167 | D | May 6, 2026, 7:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 421 | 102400 | ||
| 373739068 | oceeff | D | May 6, 2026, 3:41 p.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 421 | 4198400 | ||
| 373690813 | CareCare | D | May 6, 2026, 8:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 531 | 32153600 | ||
| 373698156 | keisuke6 | D | May 6, 2026, 9:32 a.m. | OK | C++17 (GCC 7-32) | TESTS | 36 | 750 | 3993600 | ||
| 373766273 | maxplus | D | May 6, 2026, 10:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 125 | 2150400 | ||
| 373688952 | _paper_ | D | May 6, 2026, 8:21 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 281 | 20070400 | ||
| 373756841 | JPMM | D | May 6, 2026, 6:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 296 | 102400 | ||
| 373696723 | CPluhPluh | D | May 6, 2026, 9:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 312 | 1638400 | ||
| 373709372 | huangleyi | D | May 6, 2026, 11:34 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 312 | 8089600 | ||
| 373697940 | DDUDUDDUDU | D | May 6, 2026, 9:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 328 | 102400 | ||
| 373683367 | Xerxes | D | May 6, 2026, 7:54 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 328 | 102400 | ||
| 373690228 | XiaY | D | May 6, 2026, 8:26 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 328 | 1638400 | ||
| 373682260 | yeminghan | D | May 6, 2026, 7:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 328 | 1638400 | ||
| 373696298 | RaresPoinaru | D | May 6, 2026, 9:15 a.m. | OK | C++20 (GCC 13-64) | TESTS | 36 | 328 | 9728000 | ||
| 373731848 | mhb2010 | D | May 6, 2026, 2:40 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 296 | 3276800 | ||
| 373770382 | yangchang | D | May 7, 2026, 12:49 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 312 | 1638400 | ||
| 373686871 | autumoon | D | May 6, 2026, 8:11 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 312 | 16896000 | ||
| 373757506 | hodza | D | May 6, 2026, 6:58 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 328 | 102400 | ||
| 373741206 | llm67 | D | May 6, 2026, 4:01 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 328 | 102400 | ||
| 373732933 | GOTKAKO | D | May 6, 2026, 2:50 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 343 | 0 | ||
| 373694846 | e4rendel | D | May 6, 2026, 9:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 343 | 0 | ||
| 373781723 | physics0523 | D | May 7, 2026, 5:23 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 343 | 102400 | ||
| 373774558 | leolin0214 | D | May 7, 2026, 2:49 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 343 | 102400 | ||
| 373701779 | anhkha1004 | D | May 6, 2026, 10:12 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 36 | 343 | 102400 | ||
| 373682487 | codecrasher_ | D | May 6, 2026, 7:50 a.m. | OK | Go | TESTS | 36 | 187 | 22118400 | ||
| 373691855 | gofrozen21 | D | May 6, 2026, 8:33 a.m. | OK | Java 21 | TESTS | 36 | 375 | 21708800 | ||
| 373696120 | MBBN | D | May 6, 2026, 9:14 a.m. | OK | Java 21 | TESTS | 36 | 406 | 22323200 | ||
| 373687554 | hardgonnapass | D | May 6, 2026, 8:14 a.m. | OK | Java 8 | TESTS | 36 | 343 | 40550400 | ||
| 373691871 | bitplease_ | D | May 6, 2026, 8:33 a.m. | OK | Node.js | TESTS | 36 | 453 | 46899200 | ||
| 373764940 | misty | D | May 6, 2026, 9:46 p.m. | OK | PyPy 3-64 | TESTS | 36 | 1015 | 121856000 | ||
| 373764878 | misty | D | May 6, 2026, 9:44 p.m. | OK | PyPy 3-64 | TESTS | 36 | 1046 | 121958400 | ||
| 373694066 | toam | D | May 6, 2026, 8:56 a.m. | OK | PyPy 3-64 | TESTS | 36 | 1453 | 44236800 | ||
| 373693979 | toam | D | May 6, 2026, 8:55 a.m. | OK | PyPy 3-64 | TESTS | 36 | 1937 | 54067200 | ||
| 373669517 | harurun4635 | D | May 6, 2026, 6:55 a.m. | OK | PyPy 3-64 | TESTS | 36 | 1968 | 32358400 |
Back to search problems