Codeforces Round 1060 (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
2154 Codeforces Round 1060 (Div. 2) FINISHED False 7200 15521123 Oct. 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4726 ) D Catshock PROGRAMMING constructive algorithms dfs and similar graphs trees

A cat lives on a tree with (n) nodes. The cat starts on node (1), and you live on node (n). You are going to leave the cat a note written in the parkour language to help it reach you. The parkour language has two types of instructions: (1) — This means that the cat should move to any adjacent node to it, if there are multiple options, it will pick one of them arbitrarily. If there are no adjacent nodes to it, then it will not move. (2\,u) — This means to destroy node (u) and all adjacent edges to it. If the cat is currently on node (u), it will die, so this should be avoided. If node (u) was already destroyed, then nothing will happen. Additionally, there cannot be two consecutive instances of the second instruction. Unfortunately, the parkour language is ambiguous because the cat may have multiple options for each instance of the first instruction. So you should construct a sequence of instructions of length at most (3n) so that if the cat follows them, it will end at node (n), no matter what choices it makes. It can be proven that such a sequence exists for any tree. 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 testcase contains an integer (n) ((2 \le n \le 2 \cdot 10^5)) — the size of the tree. Then (n - 1) lines follow, each of them contains two integers (u) and (v) ((1 \le u,v \le n, u \ne v)) which describe a pair of vertices connected by an edge. It is guaranteed that the given graph is a tree and has no loops or multiple edges. The sum of (n) across all testcases does not exceed (2 \cdot 10^5). For each testcase, output a single integer (k) ((0 \le k \le 3n)) — the number of operations you will perform. Then output (k) lines of either of the following formats: (1) — make the cat move to an adjacent node if there are node

Tutorials

Codeforces Round 1060 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
344790553 mban259 D Oct. 20, 2025, 1:20 a.m. OK C# 10 TESTS 23 264 44953600
344798720 Lh.Dt D Oct. 20, 2025, 3:29 a.m. OK C++17 (GCC 7-32) TESTS 23 250 20377600
344775758 mateuszmj D Oct. 19, 2025, 8:30 p.m. OK C++17 (GCC 7-32) TESTS 22 265 11673600
344790495 FPoly_log D Oct. 20, 2025, 1:19 a.m. OK C++17 (GCC 7-32) TESTS 23 265 21401600
344785319 joelchaconcastillo D Oct. 19, 2025, 11:12 p.m. OK C++17 (GCC 7-32) TESTS 22 280 23347200
344785177 joelchaconcastillo D Oct. 19, 2025, 11:08 p.m. OK C++17 (GCC 7-32) TESTS 22 280 23449600
344745939 WangTianzhuo D Oct. 19, 2025, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 22 281 14950400
344792224 oYo D Oct. 20, 2025, 1:52 a.m. OK C++17 (GCC 7-32) TESTS 23 296 9625600
344781402 thenotsoboring D Oct. 19, 2025, 9:48 p.m. OK C++17 (GCC 7-32) TESTS 22 296 18432000
344803900 getwin D Oct. 20, 2025, 4:40 a.m. OK C++17 (GCC 7-32) TESTS 23 296 19046400
344790692 cube_escape D Oct. 20, 2025, 1:22 a.m. OK C++17 (GCC 7-32) TESTS 23 296 36249600
344795744 nbwnd2010 D Oct. 20, 2025, 2:48 a.m. OK C++20 (GCC 13-64) TESTS 23 93 39219200
344798695 q1uple D Oct. 20, 2025, 3:28 a.m. OK C++20 (GCC 13-64) TESTS 23 171 59289600
344792214 sllh_dog D Oct. 20, 2025, 1:52 a.m. OK C++20 (GCC 13-64) TESTS 23 186 25497600
344789748 cfsunhaolan D Oct. 20, 2025, 1:04 a.m. OK C++20 (GCC 13-64) TESTS 23 187 23961600
344793844 odt03 D Oct. 20, 2025, 2:19 a.m. OK C++20 (GCC 13-64) TESTS 23 187 25088000
344798940 The_fastest_one D Oct. 20, 2025, 3:31 a.m. OK C++20 (GCC 13-64) TESTS 23 202 29491200
344768517 NaraFluorine D Oct. 19, 2025, 7:20 p.m. OK C++20 (GCC 13-64) TESTS 22 202 32153600
344789913 volcano_2025 D Oct. 20, 2025, 1:07 a.m. OK C++20 (GCC 13-64) TESTS 23 218 15360000
344792762 Damofeilang D Oct. 20, 2025, 2:02 a.m. OK C++20 (GCC 13-64) TESTS 23 218 16896000
344790220 lijunze12 D Oct. 20, 2025, 1:14 a.m. OK C++20 (GCC 13-64) TESTS 23 218 28876800
344791189 LittleFoxFairy D Oct. 20, 2025, 1:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 171 22425600
344796432 Eous D Oct. 20, 2025, 2:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 171 28672000
344792672 piantouqu D Oct. 20, 2025, 2 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 186 41574400
344797659 xzyNOIP D Oct. 20, 2025, 3:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 29081600
344795461 NYdry D Oct. 20, 2025, 2:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 29491200
344794923 lumen310 D Oct. 20, 2025, 2:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 202 45568000
344795406 _10060710 D Oct. 20, 2025, 2:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 218 24064000
344794958 CeHang D Oct. 20, 2025, 2:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 218 34099200
344802249 Mindmaster48 D Oct. 20, 2025, 4:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 218 39014400
344755221 vikas_h D Oct. 19, 2025, 5:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 22 233 21196800
344797469 uffhottie D Oct. 20, 2025, 3:12 a.m. OK Go TESTS 23 312 56934400
344770448 Balu2907 D Oct. 19, 2025, 7:35 p.m. OK Java 21 TESTS 22 905 53350400
344745195 Narendrab D Oct. 19, 2025, 4:34 p.m. OK Java 21 TESTS 22 1078 86016000
344790309 1091857051 D Oct. 20, 2025, 1:16 a.m. OK Java 21 TESTS 23 1186 104652800
344763093 wenbozh D Oct. 19, 2025, 6:40 p.m. OK Java 21 TESTS 22 1249 104550400
344807705 flashinglight333 D Oct. 20, 2025, 5:23 a.m. OK Java 21 TESTS 23 1421 45977600
344775090 toryinside D Oct. 19, 2025, 8:22 p.m. OK PyPy 3 TESTS 22 1921 52224000
344777249 gardengnome D Oct. 19, 2025, 8:48 p.m. OK PyPy 3-64 TESTS 22 452 84172800
344771425 gardengnome D Oct. 19, 2025, 7:45 p.m. OK PyPy 3-64 TESTS 22 483 84787200
344781332 pajenegod D Oct. 19, 2025, 9:47 p.m. OK PyPy 3-64 TESTS 22 577 75878400
344753578 ericshen19555 D Oct. 19, 2025, 5:46 p.m. OK PyPy 3-64 TESTS 22 702 75264000
344787625 alexwice D Oct. 20, 2025, 12:16 a.m. OK PyPy 3-64 TESTS 23 703 79667200
344765678 monocrap D Oct. 19, 2025, 6:57 p.m. OK PyPy 3-64 TESTS 22 796 74035200
344760022 helltractor D Oct. 19, 2025, 6:21 p.m. OK PyPy 3-64 TESTS 22 827 83353600
344769418 once_and_again D Oct. 19, 2025, 7:27 p.m. OK PyPy 3-64 TESTS 22 874 100556800
344766761 kibr D Oct. 19, 2025, 7:06 p.m. OK PyPy 3-64 TESTS 22 936 128000000
344766747 jiangxian D Oct. 19, 2025, 7:06 p.m. OK PyPy 3-64 TESTS 22 953 79974400
344806272 ummenoor D Oct. 20, 2025, 5:08 a.m. OK Python 3 TESTS 23 1952 98099200
344802074 Spheniscine D Oct. 20, 2025, 4:15 a.m. OK Rust 2021 TESTS 23 202 30720000
344758160 NagisaF D Oct. 19, 2025, 6:10 p.m. OK Rust 2021 TESTS 22 234 50688000
344754354 Maverick027 D Oct. 19, 2025, 5:50 p.m. OK Rust 2024 TESTS 22 312 68710400
344751975 123gjweq2 D Oct. 19, 2025, 5:38 p.m. OK Rust 2024 TESTS 22 1187 56217600
344750607 123gjweq2 D Oct. 19, 2025, 5:32 p.m. OK Rust 2024 TESTS 22 1265 56217600

remove filters

Back to search problems