Codeforces Round 1085 (Div. 1 + Div. 2)

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
2207 Codeforces Round 1085 (Div. 1 + Div. 2) FINISHED False 10800 3425123 March 8, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2041 ) D Boxed Like a Fish PROGRAMMING dfs and similar dp games trees

Let (n, k) be positive integers. You are given a tree(^{\text{∗}}) with (n) vertices numbered (1, \ldots, n). Cyndaquil is traversing this tree and is trying to reach one of its leaves(^{\text{†}}). Initially, he starts at a non-leaf vertex (v), and in one turn, he may either choose to stay still or move from a vertex (v) along an edge to any of its neighbors (u). However, Snorlax is trying to stop Cyndaquil from doing this by sleeping on an edge. When he picks an edge, Cyndaquil is blocked from traversing it until Snorlax moves again. Furthermore, only one edge may be disallowed at a time, so that only the most recently chosen edge is blocked. Of course, Snorlax is slow and needs some time before he can pick a new edge. He has a cooldown timer, initially at (0). He may only choose a new edge when the cooldown is at (0) or lower, but he doesn't have to do it immediately . When he moves to a new edge, the timer is reset to (k). After each of Cyndaquil's turns (even if he stays still), the cooldown timer decreases by (1). They take turns acting as previously described, with Snorlax starting first, and initially, he is not sleeping on any edge. Assuming both of them play optimally, can Cyndaquil always reach a leaf after a finite number of turns? (^{\text{∗}})A tree is a connected graph without cycles. (^{\text{†}})A vertex with degree 1 is called a leaf. 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 three integers (n), (k), and (v) ((3 \leq n \leq 5 \cdot 10^5), (1 \leq k, v \leq n)) — the number of vertices in the tree, Snorlax's cooldown timer, and Cyndaquil's starting vertex. The next (n-1) lines of each test case contain two integers (a) and (b) ((1 \leq a, b \leq n), (a \neq b)), describing an edge b

Tutorials

Codeforces Round 1085 (Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365891990 refiningheaven D March 8, 2026, 4:37 p.m. OK C++17 (GCC 7-32) TESTS 30 390 16281600
365904802 catandcode D March 8, 2026, 6:07 p.m. OK C++17 (GCC 7-32) TESTS 30 390 20787200
365887412 W_Franklin D March 8, 2026, 4:13 p.m. OK C++17 (GCC 7-32) TESTS 30 421 19353600
365897606 xiaoxiaolue D March 8, 2026, 5:10 p.m. OK C++17 (GCC 7-32) TESTS 30 421 20172800
365904562 zzpower D March 8, 2026, 6:04 p.m. OK C++17 (GCC 7-32) TESTS 30 437 69222400
365891216 xingtiankai2023 D March 8, 2026, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 30 453 20275200
365886153 under1oop D March 8, 2026, 4:07 p.m. OK C++17 (GCC 7-32) TESTS 30 468 68300800
365930138 nguyengiabach1201 D March 9, 2026, 1:37 a.m. OK C++17 (GCC 7-32) TESTS 30 546 33075200
365915071 AntiBsayer D March 8, 2026, 8:12 p.m. OK C++17 (GCC 7-32) TESTS 30 562 21913600
365927385 zja601 D March 9, 2026, 12:11 a.m. OK C++17 (GCC 7-32) TESTS 30 562 33075200
365898792 yangchang D March 8, 2026, 5:16 p.m. OK C++20 (GCC 13-64) TESTS 30 359 26726400
365879678 tanmuling0429 D March 8, 2026, 3:36 p.m. OK C++20 (GCC 13-64) TESTS 30 375 130764800
365941651 AdisFDinBed D March 9, 2026, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 30 390 34611200
365925460 yangchang D March 8, 2026, 11:18 p.m. OK C++20 (GCC 13-64) TESTS 30 437 26726400
365907009 crispy-tofu D March 8, 2026, 6:29 p.m. OK C++20 (GCC 13-64) TESTS 30 515 27955200
365907672 swehoneycodes D March 8, 2026, 6:38 p.m. OK C++20 (GCC 13-64) TESTS 30 515 30003200
365939471 fatman87878 D March 9, 2026, 5:06 a.m. OK C++20 (GCC 13-64) TESTS 30 515 37683200
365901438 kaichou243 D March 8, 2026, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 30 515 44339200
365921512 CatsAreCool D March 8, 2026, 9:48 p.m. OK C++20 (GCC 13-64) TESTS 30 531 38400000
365931025 ________a____ D March 9, 2026, 2:05 a.m. OK C++20 (GCC 13-64) TESTS 30 531 39628800
365882088 maspy D March 8, 2026, 3:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 250 46284800
365895262 XDEv11 D March 8, 2026, 4:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 328 23040000
365932676 TheSunrise D March 9, 2026, 2:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 328 42598400
365888633 ProjectCF D March 8, 2026, 4:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 359 32460800
365900007 Brilliance_2 D March 8, 2026, 5:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 390 26521600
365895642 viggil D March 8, 2026, 4:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 390 38502400
365940533 Zaria D March 9, 2026, 5:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 406 43212800
365915345 asherlau D March 8, 2026, 8:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 484 28160000
365882434 Sulfox D March 8, 2026, 3:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 484 43417600
365907116 yuugureyuu D March 8, 2026, 6:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 500 24268800
365899188 actualtsg D March 8, 2026, 5:19 p.m. OK GNU C11 TESTS 30 578 36864000
365884866 knightL D March 8, 2026, 4 p.m. OK Java 21 TESTS 30 468 18124800
365910505 jdltc D March 8, 2026, 7:15 p.m. OK Java 21 TESTS 30 625 14131200
365910443 Codingismepassion D March 8, 2026, 7:15 p.m. OK Java 21 TESTS 30 625 14131200
365908617 kevin_0911 D March 8, 2026, 6:52 p.m. OK Java 21 TESTS 30 1578 117452800
365940966 ironman263 D March 9, 2026, 5:30 a.m. OK Java 21 TESTS 30 1640 101580800
365891419 codebuzz0001 D March 8, 2026, 4:34 p.m. OK Java 21 TESTS 30 1640 118784000
365894155 vinamrat4 D March 8, 2026, 4:50 p.m. OK Java 21 TESTS 30 1703 118169600
365907508 NeelmaniPandey09 D March 8, 2026, 6:36 p.m. OK Java 8 TESTS 30 250 18739200
365888910 malachi_toney_goat D March 8, 2026, 4:21 p.m. OK Java 8 TESTS 30 1437 125030400
365897068 nullbrain_ D March 8, 2026, 5:07 p.m. OK Kotlin 2.2 TESTS 30 625 52838400
365922737 VulcanForge D March 8, 2026, 10:12 p.m. OK PyPy 3-64 TESTS 30 1156 172134400
365933899 WatPz D March 9, 2026, 3:16 a.m. OK PyPy 3-64 TESTS 30 1421 106393600
365887869 x3x3 D March 8, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 30 1437 125337600
365901829 ossau D March 8, 2026, 5:33 p.m. OK PyPy 3-64 TESTS 30 1484 103321600
365888420 kdy8128 D March 8, 2026, 4:18 p.m. OK PyPy 3-64 TESTS 30 1500 101171200
365900075 Hyder1102 D March 8, 2026, 5:24 p.m. OK PyPy 3-64 TESTS 30 1515 96768000
365888054 tyuyu_62 D March 8, 2026, 4:16 p.m. OK PyPy 3-64 TESTS 30 1625 122675200
365898988 bronze_coder D March 8, 2026, 5:17 p.m. OK PyPy 3-64 TESTS 30 1718 113664000
365906821 omkaar D March 8, 2026, 6:27 p.m. OK PyPy 3-64 TESTS 30 1718 221388800
365884918 toam D March 8, 2026, 4:01 p.m. OK PyPy 3-64 TESTS 30 1781 145920000
365908188 Nikrien D March 8, 2026, 6:45 p.m. OK Python 3 TESTS 30 1625 108339200
365883303 anirudh_08 D March 8, 2026, 3:53 p.m. OK Python 3 TESTS 30 1640 120832000
365912591 mmaraltanan D March 8, 2026, 7:41 p.m. OK Python 3 TESTS 30 1953 224665600
365879464 Sugar_fan D March 8, 2026, 3:35 p.m. OK Rust 2024 TESTS 30 421 71168000
365885592 DanielAnker D March 8, 2026, 4:04 p.m. OK Rust 2024 TESTS 30 531 62054400
365899319 Darknef D March 8, 2026, 5:19 p.m. OK Rust 2024 TESTS 30 812 107827200

remove filters

Back to search problems