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 |
|---|---|---|---|---|---|---|
| 2044 | Codeforces Round 993 (Div. 4) | FINISHED | False | 8100 | 42132323 | Dec. 15, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 7267 ) | G1 | Medium Demon Problem (easy version) | PROGRAMMING | dfs and similar graph matchings graphs |
This is the easy version of the problem. The key difference between the two versions is highlighted in bold. A group of (n) spiders has come together to exchange plushies. Initially, each spider has (1) plushie. Every year, if spider (i) has at least one plushie, he will give exactly one plushie to spider (r_i). Otherwise, he will do nothing. Note that all plushie transfers happen at the same time. In this version, if any spider has more than (1) plushie at any point in time, they will throw all but (1) away. The process is stable in the current year if each spider has the same number of plushies (before the current year's exchange) as he did the previous year (before the previous year's exchange). Note that year (1) can never be stable . Find the first year in which the process becomes stable . The first line contains an integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains an integer (n) ((2 \leq n \leq 2 \cdot 10^5)) — the number of spiders. The following line contains (n) integers (r_1, r_2, \ldots, r_n) ((1 \leq r_i \leq n, r_i \neq i)) — the recipient of the plushie of each spider. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output an integer on a new line, the first year in which the process becomes stable . For the second test case: At year (1), the following array shows the number of plushies each spider has: (1, 1, 1, 1, 1). Then, year (1)'s exchange happens. At year (2), the following array shows the number of plushies each spider has: (1, 1, 1, 1, 1). Since this array is the same as the previous year, this year is stable . For the third test case: At year (1), the following array shows the number of plushies each spider has: (1, 1, 1, 1, 1). Then, year (1)'s exchange happens. At year (2), the following array shows the number o |
| Codeforces Round 993 (Div. 4) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 296766204 | ayush5556 | G1 | Dec. 15, 2024, 7:40 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 77 | 0 | ||
| 296793080 | khaled_eg | G1 | Dec. 16, 2024, 5:21 a.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 77 | 102400 | ||
| 296748188 | Huygd | G1 | Dec. 15, 2024, 5:03 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 77 | 4812800 | ||
| 296761062 | zero.xzp | G1 | Dec. 15, 2024, 6:40 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 77 | 8089600 | ||
| 296783555 | NICK_04 | G1 | Dec. 16, 2024, 2:43 a.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 0 | ||
| 296773549 | mystic_ankush | G1 | Dec. 15, 2024, 9:42 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 0 | ||
| 296773070 | Shinchan12 | G1 | Dec. 15, 2024, 9:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 0 | ||
| 296766387 | DeadlyCritic | G1 | Dec. 15, 2024, 7:42 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 0 | ||
| 296790658 | _14_ | G1 | Dec. 16, 2024, 4:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 102400 | ||
| 296773387 | complexorigin | G1 | Dec. 15, 2024, 9:39 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 78 | 102400 | ||
| 296775095 | fbabic ToniB vito1036 | G1 | Dec. 15, 2024, 10:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 0 | ||
| 296762296 | _dk_07_ | G1 | Dec. 15, 2024, 6:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 102400 | ||
| 296768205 | SuperMario | G1 | Dec. 15, 2024, 8:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 1024000 | ||
| 296777208 | aash8a9 | G1 | Dec. 15, 2024, 11:12 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 2662400 | ||
| 296772577 | Inori | G1 | Dec. 15, 2024, 9:21 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 2662400 | ||
| 296767718 | frissky9 | G1 | Dec. 15, 2024, 7:59 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 2662400 | ||
| 296783621 | Runny_Boi | G1 | Dec. 16, 2024, 2:45 a.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 2764800 | ||
| 296760509 | M.Thaer | G1 | Dec. 15, 2024, 6:35 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 2969600 | ||
| 296762969 | opop1omar | G1 | Dec. 15, 2024, 7:01 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 4710400 | ||
| 296772152 | CUBICq | G1 | Dec. 15, 2024, 9:12 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 11264000 | ||
| 296791785 | welken | G1 | Dec. 16, 2024, 5:05 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 0 | ||
| 296791594 | sskumarcp | G1 | Dec. 16, 2024, 5:02 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 0 | ||
| 296786491 | The-homeless | G1 | Dec. 16, 2024, 3:41 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 0 | ||
| 296795866 | RomanLin | G1 | Dec. 16, 2024, 5:53 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 1638400 | ||
| 296760003 | jafarbekyusupov | G1 | Dec. 15, 2024, 6:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 2048000 | ||
| 296748522 | __rose | G1 | Dec. 15, 2024, 5:04 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 2867200 | ||
| 296783078 | Euphoriababy | G1 | Dec. 16, 2024, 2:32 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 10240000 | ||
| 296780102 | qidao | G1 | Dec. 16, 2024, 12:59 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 78 | 102400 | ||
| 296746500 | Karim_Abdelaziz | G1 | Dec. 15, 2024, 4:54 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 78 | 1331200 | ||
| 296786631 | FloatingOcean | G1 | Dec. 16, 2024, 3:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 78 | 2764800 | ||
| 296769426 | haveOlogntime | G1 | Dec. 15, 2024, 8:23 p.m. | OK | GNU C11 | TESTS | 11 | 93 | 16076800 | ||
| 296767512 | gucco | G1 | Dec. 15, 2024, 7:57 p.m. | OK | Java 21 | TESTS | 11 | 608 | 7884800 | ||
| 296794099 | _Majnu_ | G1 | Dec. 16, 2024, 5:33 a.m. | OK | Java 21 | TESTS | 11 | 609 | 5324800 | ||
| 296774722 | ar_ag | G1 | Dec. 15, 2024, 10:07 p.m. | OK | Java 21 | TESTS | 11 | 749 | 35123200 | ||
| 296750492 | __Aviral__ | G1 | Dec. 15, 2024, 5:16 p.m. | OK | Java 21 | TESTS | 11 | 749 | 37478400 | ||
| 296747730 | Priyanshu_pandey15 | G1 | Dec. 15, 2024, 5 p.m. | OK | Java 21 | TESTS | 11 | 1264 | 17817600 | ||
| 296752186 | testtest111ksjfrdvn | G1 | Dec. 15, 2024, 5:28 p.m. | OK | Java 21 | TESTS | 11 | 1936 | 49254400 | ||
| 296748382 | CipherSphinx_Raj | G1 | Dec. 15, 2024, 5:04 p.m. | OK | Java 8 | TESTS | 11 | 171 | 39116800 | ||
| 296748194 | __runknowna__ | G1 | Dec. 15, 2024, 5:03 p.m. | OK | Java 8 | TESTS | 11 | 171 | 39116800 | ||
| 296792418 | NerfThis | G1 | Dec. 16, 2024, 5:13 a.m. | OK | Java 8 | TESTS | 11 | 374 | 55808000 | ||
| 296784082 | shashwat_rai | G1 | Dec. 16, 2024, 2:55 a.m. | OK | Java 8 | TESTS | 11 | 467 | 6963200 | ||
| 296773985 | gardengnome | G1 | Dec. 15, 2024, 9:50 p.m. | OK | PyPy 3-64 | TESTS | 11 | 140 | 26419200 | ||
| 296764196 | x3mka | G1 | Dec. 15, 2024, 7:15 p.m. | OK | PyPy 3-64 | TESTS | 11 | 156 | 21606400 | ||
| 296766771 | dkmidha70 | G1 | Dec. 15, 2024, 7:47 p.m. | OK | PyPy 3-64 | TESTS | 11 | 171 | 21401600 | ||
| 296780096 | PyIsTheBestLang | G1 | Dec. 16, 2024, 12:59 a.m. | OK | PyPy 3-64 | TESTS | 11 | 186 | 26112000 | ||
| 296768722 | xuanandyi | G1 | Dec. 15, 2024, 8:13 p.m. | OK | PyPy 3-64 | TESTS | 11 | 202 | 26419200 | ||
| 296797021 | Praneethrcls | G1 | Dec. 16, 2024, 6:05 a.m. | OK | PyPy 3-64 | TESTS | 11 | 202 | 26521600 | ||
| 296751884 | udalovapolina | G1 | Dec. 15, 2024, 5:26 p.m. | OK | PyPy 3-64 | TESTS | 11 | 218 | 35020800 | ||
| 296776858 | khalit7 | G1 | Dec. 15, 2024, 11 p.m. | OK | PyPy 3-64 | TESTS | 11 | 218 | 35942400 | ||
| 296746064 | misaki646 | G1 | Dec. 15, 2024, 4:53 p.m. | OK | PyPy 3-64 | TESTS | 11 | 234 | 26009600 | ||
| 296746197 | abenezer_m54 | G1 | Dec. 15, 2024, 4:53 p.m. | OK | PyPy 3-64 | TESTS | 11 | 249 | 34611200 | ||
| 296787838 | Tishow__Liuche | G1 | Dec. 16, 2024, 4:05 a.m. | OK | Python 3 | TESTS | 11 | 296 | 26521600 |
Back to search problems