Codeforces Round 1072 (Div. 3)

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
2184 Codeforces Round 1072 (Div. 3) FINISHED False 8100 8177123 Jan. 12, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3807 ) F Cherry Tree PROGRAMMING dfs and similar dp graphs trees

You are given a rooted tree with (n) vertices(^{\text{∗}}). The vertices of the tree are numbered with integers from (1) to (n). The root of the tree is vertex number (1). In each leaf(^{\text{†}}) of the tree, there grows one cherry. You want to collect all the cherries, and to do this, you perform the following action several times: You choose any vertex of the tree (v) (including the root or a leaf) and "shake" it. After that, cherries fall from all the leaves that are descendants(^{\text{‡}}) of vertex (v) (if vertex (v) itself is a leaf, then a cherry falls from it). If cherries have already fallen from any leaf before, the tree will break, so such a situation must be avoided. According to an ancient legend of the cherry orchard, the number of vertices you shake should be a multiple of three. Is it possible to collect all the cherries in this way? (^{\text{∗}})A tree with (n) vertices is an undirected connected graph with (n) vertices and (n - 1) edges. A rooted tree is a tree in which one of the vertices is special and is called the root. (^{\text{†}})A leaf is a vertex that has no descendants. (^{\text{‡}})The descendants of vertex (v) are all vertices (u \neq v) such that on the shortest path from the root to (u), vertex (v) is encountered. Each test consists of several test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The following lines describe the test cases. The first line of each test case contains a single integer (n) ((2 \leq n \leq 2 \cdot 10^5)). The next (n - 1) lines of each test case contain two integers (u) and (v) ((1 \leq u, v \leq n, u \neq v)) — the vertices connected by the next edge of the tree. It is guaranteed that the graph in each data set is a tree. It is guaranteed that the sum of (n) across all input data sets does not exceed (2 \cdot 10^5). For eac

Tutorials

Codeforces Round 1072 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
357700162 arch_coder F Jan. 13, 2026, 12:43 p.m. OK C++17 (GCC 7-32) TESTS 22 187 21094400
357763748 echoingVoid F Jan. 13, 2026, 9:07 p.m. OK C++17 (GCC 7-32) TESTS 22 203 8806400
357741078 Harigton F Jan. 13, 2026, 5:35 p.m. OK C++17 (GCC 7-32) TESTS 22 203 14745600
357757673 MaiEzz F Jan. 13, 2026, 7:37 p.m. OK C++17 (GCC 7-32) TESTS 22 203 17100800
357735822 Tk0195 F Jan. 13, 2026, 5:03 p.m. OK C++17 (GCC 7-32) TESTS 22 203 27443200
357750716 khaali.khopadi F Jan. 13, 2026, 6:36 p.m. OK C++17 (GCC 7-32) TESTS 22 218 7270400
357682959 Njasoo F Jan. 13, 2026, 10:15 a.m. OK C++17 (GCC 7-32) TESTS 22 218 17100800
357729746 UpperHand F Jan. 13, 2026, 4:23 p.m. OK C++17 (GCC 7-32) TESTS 22 218 17817600
357727498 vdntnyk F Jan. 13, 2026, 4:08 p.m. OK C++17 (GCC 7-32) TESTS 22 218 17920000
357765169 skyy_05 F Jan. 13, 2026, 9:40 p.m. OK C++17 (GCC 7-32) TESTS 22 218 18432000
357703434 www_bilibili_com F Jan. 13, 2026, 1:07 p.m. OK C++20 (GCC 13-64) TESTS 22 171 31641600
357701697 Vansh_Sohal F Jan. 13, 2026, 12:54 p.m. OK C++20 (GCC 13-64) TESTS 22 187 5632000
357762207 Zeyad_3BcarenO F Jan. 13, 2026, 8:40 p.m. OK C++20 (GCC 13-64) TESTS 22 187 33587200
357772488 LHaooo F Jan. 14, 2026, 1:58 a.m. OK C++20 (GCC 13-64) TESTS 22 203 15052800
357677776 hangz F Jan. 13, 2026, 9:30 a.m. OK C++20 (GCC 13-64) TESTS 22 203 27238400
357784043 Hayashi F Jan. 14, 2026, 5:36 a.m. OK C++20 (GCC 13-64) TESTS 22 203 27545600
357699687 Seriously_Its_Sameer F Jan. 13, 2026, 12:39 p.m. OK C++20 (GCC 13-64) TESTS 22 203 30822400
357782531 chaynflow F Jan. 14, 2026, 5:15 a.m. OK C++20 (GCC 13-64) TESTS 22 203 35737600
357677691 LGjian F Jan. 13, 2026, 9:30 a.m. OK C++20 (GCC 13-64) TESTS 22 203 38297600
357745636 Dewaweiliumaun F Jan. 13, 2026, 6:03 p.m. OK C++20 (GCC 13-64) TESTS 22 203 45465600
357784003 maspy F Jan. 14, 2026, 5:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 78 19763200
357781885 poxiao019 F Jan. 14, 2026, 5:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 125 26419200
357771237 _Deer_Peach_ F Jan. 14, 2026, 1:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 125 26419200
357762345 Youssefproof F Jan. 13, 2026, 8:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 187 9830400
357691636 Isla F Jan. 13, 2026, 11:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 187 13619200
357690792 becaido F Jan. 13, 2026, 11:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 187 30822400
357720096 Code_Attempt_2 F Jan. 13, 2026, 3:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 187 39116800
357751016 Movazed F Jan. 13, 2026, 6:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 187 124416000
357655170 dooglius F Jan. 13, 2026, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 203 11059200
357690098 Treow F Jan. 13, 2026, 11:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 22 203 14643200
357731690 Dipak_45 F Jan. 13, 2026, 4:36 p.m. OK Go TESTS 22 296 24473600
357685332 LittleGopher F Jan. 13, 2026, 10:37 a.m. OK Go TESTS 22 296 151142400
357783394 minibin F Jan. 14, 2026, 5:27 a.m. OK Java 21 TESTS 22 609 70348800
357768844 cpp10 F Jan. 13, 2026, 11:57 p.m. OK Java 21 TESTS 22 656 72704000
357768815 cpp10 F Jan. 13, 2026, 11:55 p.m. OK Java 21 TESTS 22 687 72806400
357673875 sourabh19278 F Jan. 13, 2026, 8:56 a.m. OK Java 21 TESTS 22 734 60723200
357756486 Sudip809 F Jan. 13, 2026, 7:26 p.m. OK Java 21 TESTS 22 734 91238400
357760442 Satyasarthi F Jan. 13, 2026, 8:12 p.m. OK Java 21 TESTS 22 828 90112000
357760554 Satyasarthi F Jan. 13, 2026, 8:14 p.m. OK Java 21 TESTS 22 875 90316800
357745927 keshav_.agg F Jan. 13, 2026, 6:05 p.m. OK Java 21 TESTS 22 890 99430400
357785645 minhkhoajapan0701 F Jan. 14, 2026, 5:58 a.m. OK Java 21 TESTS 22 921 111513600
357673646 sourabh19278 F Jan. 13, 2026, 8:54 a.m. OK Java 21 TESTS 22 953 106291200
357653066 kevin_0911 F Jan. 13, 2026, 4:45 a.m. OK Java 8 TESTS 22 562 38092800
357653027 kevin_0911 F Jan. 13, 2026, 4:45 a.m. OK Java 8 TESTS 22 578 38092800
357744562 Roy-Soumik F Jan. 13, 2026, 5:57 p.m. OK Java 8 TESTS 22 609 48435200
357765870 arvindf232 F Jan. 13, 2026, 9:59 p.m. OK Kotlin 2.2 TESTS 22 281 26931200
357727642 chinesedfan F Jan. 13, 2026, 4:09 p.m. OK Node.js TESTS 22 781 110182400
357743072 gardengnome F Jan. 13, 2026, 5:48 p.m. OK PyPy 3-64 TESTS 22 375 33484800
357700641 MohamedAdel_2025 F Jan. 13, 2026, 12:46 p.m. OK PyPy 3-64 TESTS 22 484 61644800
357700939 LilyAlthea F Jan. 13, 2026, 12:49 p.m. OK PyPy 3-64 TESTS 22 546 64921600
357729887 Hyder1102 F Jan. 13, 2026, 4:24 p.m. OK PyPy 3-64 TESTS 22 578 52326400
357683963 Eikyu F Jan. 13, 2026, 10:24 a.m. OK PyPy 3-64 TESTS 22 734 56422400
357759429 kazu_tech F Jan. 13, 2026, 7:59 p.m. OK PyPy 3-64 TESTS 22 921 78950400
357656447 chierin F Jan. 13, 2026, 5:31 a.m. OK PyPy 3-64 TESTS 22 937 84480000
357691278 hugoback01 F Jan. 13, 2026, 11:28 a.m. OK PyPy 3-64 TESTS 22 1000 111206400
357676639 luciferstern F Jan. 13, 2026, 9:21 a.m. OK PyPy 3-64 TESTS 22 1000 159539200
357696645 mooIi F Jan. 13, 2026, 12:14 p.m. OK PyPy 3-64 TESTS 22 1046 72192000
357783507 Abhi_Dex F Jan. 14, 2026, 5:29 a.m. OK Python 3 TESTS 22 750 110387200
357756412 bruhbruhbruhboom F Jan. 13, 2026, 7:25 p.m. OK Python 3 TESTS 22 843 54681600
357783631 Vivekkaushik2022 F Jan. 14, 2026, 5:31 a.m. OK Python 3 TESTS 22 1078 201625600
357777706 MadhavPeddi F Jan. 14, 2026, 3:54 a.m. OK Python 3 TESTS 22 1359 132096000
357765105 kushagra2468 F Jan. 13, 2026, 9:38 p.m. OK Python 3 TESTS 22 1468 83456000
357771955 KinaRight F Jan. 14, 2026, 1:42 a.m. OK Python 3 TESTS 22 1890 143974400
357771902 KinaRight F Jan. 14, 2026, 1:40 a.m. OK Python 3 TESTS 22 1890 143974400
357771917 KinaRight F Jan. 14, 2026, 1:41 a.m. OK Python 3 TESTS 22 1921 143974400
357735277 GUAIKATTO F Jan. 13, 2026, 4:59 p.m. OK Rust 2024 TESTS 22 265 99328000

remove filters

Back to search problems