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 |
|---|---|---|---|---|---|---|
| 2112 | Educational Codeforces Round 180 (Rated for Div. 2) | FINISHED | False | 7200 | 25716323 | June 23, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 3306 ) | E | Tree Colorings | PROGRAMMING | combinatorics dp graphs math trees |
Consider a rooted undirected tree. Each vertex can be colored blue, green, or yellow. A coloring is called beautiful if it meets these conditions: the root of the tree is green; if you consider all blue and green vertices , they are reachable from each other without passing through any yellow vertices; if you consider all yellow and green vertices , they are reachable from each other without passing through any blue vertices; You are given an integer (m). Your task is to calculate the minimum number of vertices in a tree with exactly (m) beautiful colorings. The first line contains a single integer ((1 \le t \le 10^5)) — the number of test cases. The only line of each test case contains a single integer (m) ((1 \le m \le 5 \cdot 10^5)). For each test case, print a single integer — the minimum number of vertices in a tree with exactly (m) beautiful colorings. If such a tree does not exist, print (-1). In the following notes, let (g) describe green color, (b) be blue, and (y) be yellow. In the first example, consider a simple tree with just (1) vertex. This tree has exactly (1) beautiful coloring: the root is green. In the second example, consider a simple tree with (2) vertices with a root at the (1)-st vertex. There are exactly (3) beautiful colorings: (g, g), (g, b) and (g, y). In the third example, consider a bamboo tree with (3) vertices with a root at the (1)-st vertex. There are exactly (5) beautiful colorings: (g, g, g), (g, g, b), (g, g, y), (g, b, b) and (g, y, y). In the fifth example, consider a tree with (3) vertices with a root at the (1)-st vertex, and the other (2) vertices connected to it. There are exactly (9) beautiful colorings: (g, g, g), (g, g, b), (g, g, y), (g, b, g), (g, b, b), (g, b, y), (g, y, g), (g, y, b) and (g, y, y). |
| Educational Codeforces Round 180 — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 325962922 | og.kostya | E | June 25, 2025, 6:01 a.m. | OK | C# 10 | TESTS | 8 | 109 | 4812800 | ||
| 325962252 | og.kostya | E | June 25, 2025, 5:54 a.m. | OK | C# 10 | TESTS | 8 | 156 | 7065600 | ||
| 325962281 | og.kostya | E | June 25, 2025, 5:54 a.m. | OK | C# 13 | TESTS | 8 | 140 | 5939200 | ||
| 325852100 | Cuiyi_SAI | E | June 24, 2025, 9:27 a.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 62 | 2048000 | ||
| 325841399 | omarkurde | E | June 23, 2025, 8:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 77 | 0 | ||
| 325942675 | zhlzt | E | June 25, 2025, 12:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 78 | 2048000 | ||
| 325905516 | Cutelhqqq | E | June 24, 2025, 4:47 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 93 | 0 | ||
| 325903602 | Cutelhqqq | E | June 24, 2025, 4:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 93 | 0 | ||
| 325855042 | He_XY | E | June 24, 2025, 10:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 93 | 2048000 | ||
| 325845231 | antguz | E | June 23, 2025, 10:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 93 | 2048000 | ||
| 325838402 | wikijokiel | E | June 23, 2025, 7:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 93 | 8089600 | ||
| 325826436 | KawakiMeido | E | June 23, 2025, 5:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 108 | 2048000 | ||
| 325949096 | 8Conan8 | E | June 25, 2025, 2:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 8 | 109 | 12083200 | ||
| 325944152 | propane | E | June 25, 2025, 1:15 a.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 0 | ||
| 325937355 | abstract_nonsense | E | June 24, 2025, 9:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 102400 | ||
| 325893081 | OmarAli. | E | June 24, 2025, 3:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 102400 | ||
| 325833965 | Artist04 | E | June 23, 2025, 6:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 102400 | ||
| 325833812 | NotFound | E | June 23, 2025, 6:46 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 102400 | ||
| 325945943 | hanime1 | E | June 25, 2025, 2:03 a.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 2048000 | ||
| 325894835 | FlowerandYou | E | June 24, 2025, 3:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 62 | 2048000 | ||
| 325894396 | Shahod | E | June 24, 2025, 3:31 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 77 | 0 | ||
| 325863817 | overnap | E | June 24, 2025, 11:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 77 | 0 | ||
| 325832895 | NotFound | E | June 23, 2025, 6:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 8 | 77 | 0 | ||
| 325949924 | mekadalibrahem123 | E | June 25, 2025, 3:07 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 0 | ||
| 325937445 | alphax171 | E | June 24, 2025, 9:43 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 2048000 | ||
| 325858718 | HasibEvnRiaz | E | June 24, 2025, 10:54 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 2048000 | ||
| 325858632 | NortGlG | E | June 24, 2025, 10:53 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 2048000 | ||
| 325850194 | gqf | E | June 24, 2025, 12:54 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 2048000 | ||
| 325943891 | kaiichen | E | June 25, 2025, 1:07 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 62 | 4096000 | ||
| 325851147 | jianjianj | E | June 24, 2025, 1:30 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 77 | 0 | ||
| 325823445 | FzArK | E | June 23, 2025, 5:22 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 77 | 0 | ||
| 325830973 | __ALBION__ | E | June 23, 2025, 6:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 77 | 102400 | ||
| 325917967 | GlidingNinja_ccn | E | June 24, 2025, 6:20 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 8 | 77 | 409600 | ||
| 325831219 | dusty.and.rusty | E | June 23, 2025, 6:22 p.m. | OK | Java 21 | TESTS | 8 | 624 | 20787200 | ||
| 325844756 | ironman263 | E | June 23, 2025, 9:49 p.m. | OK | Java 21 | TESTS | 8 | 780 | 819200 | ||
| 325842550 | dusty.and.rusty | E | June 23, 2025, 8:59 p.m. | OK | Java 21 | TESTS | 8 | 1062 | 43724800 | ||
| 325891123 | dusty.and.rusty | E | June 24, 2025, 3:09 p.m. | OK | Java 21 | TESTS | 8 | 1062 | 44339200 | ||
| 325951659 | man-ray | E | June 25, 2025, 3:31 a.m. | OK | Java 21 | TESTS | 8 | 2546 | 202240000 | ||
| 325820928 | sahasrad | E | June 23, 2025, 5:06 p.m. | OK | Java 21 | TESTS | 8 | 3280 | 220262400 | ||
| 325823412 | Akash_Baidya2005 | E | June 23, 2025, 5:22 p.m. | OK | Java 8 | TESTS | 8 | 1515 | 2969600 | ||
| 325821078 | Akash_Baidya2005 | E | June 23, 2025, 5:07 p.m. | OK | Java 8 | TESTS | 8 | 1515 | 2969600 | ||
| 325843205 | Sumitsingh7 | E | June 23, 2025, 9:13 p.m. | OK | Java 8 | TESTS | 8 | 3843 | 248012800 | ||
| 325895313 | kasiru_69 | E | June 24, 2025, 3:37 p.m. | OK | Java 8 | TESTS | 8 | 3889 | 201420800 | ||
| 325919871 | titia | E | June 24, 2025, 6:37 p.m. | OK | PyPy 3-64 | TESTS | 8 | 202 | 12288000 | ||
| 325962613 | Mischievius | E | June 25, 2025, 5:57 a.m. | OK | PyPy 3-64 | TESTS | 8 | 202 | 12902400 | ||
| 325844830 | samchen123 | E | June 23, 2025, 9:51 p.m. | OK | PyPy 3-64 | TESTS | 8 | 249 | 16998400 | ||
| 325823590 | shash4321 | E | June 23, 2025, 5:23 p.m. | OK | PyPy 3-64 | TESTS | 8 | 265 | 20684800 | ||
| 325849787 | stan23456 | E | June 24, 2025, 12:41 a.m. | OK | PyPy 3-64 | TESTS | 8 | 312 | 15257600 | ||
| 325959322 | Om_Singh_ | E | June 25, 2025, 5:22 a.m. | OK | PyPy 3-64 | TESTS | 8 | 328 | 29593600 | ||
| 325959539 | Om_Singh_ | E | June 25, 2025, 5:24 a.m. | OK | PyPy 3-64 | TESTS | 8 | 343 | 30105600 | ||
| 325960992 | Om_Singh_ | E | June 25, 2025, 5:40 a.m. | OK | PyPy 3-64 | TESTS | 8 | 358 | 31539200 | ||
| 325960703 | Om_Singh_ | E | June 25, 2025, 5:37 a.m. | OK | PyPy 3-64 | TESTS | 8 | 374 | 31948800 | ||
| 325848637 | DeadMan69 | E | June 24, 2025, midnight | OK | PyPy 3-64 | TESTS | 8 | 483 | 28364800 | ||
| 325952280 | ValeriyShiyan | E | June 25, 2025, 3:41 a.m. | OK | Python 3 | TESTS | 8 | 578 | 24883200 | ||
| 325858675 | DanielAnker | E | June 24, 2025, 10:53 a.m. | OK | Rust 2021 | TESTS | 8 | 828 | 97177600 | ||
| 325920099 | DeanMenezes3 | E | June 24, 2025, 6:39 p.m. | OK | Rust 2021 | TESTS | 8 | 1077 | 110284800 |
Back to search problems