Codeforces Round 1044 (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
2133 Codeforces Round 1044 (Div. 2) FINISHED False 7200 20359523 Aug. 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1663 ) E I Yearned For The Mines PROGRAMMING constructive algorithms dfs and similar trees

As a child, Steve yearned for the mines! His mine can be represented as a tree(^{\text{∗}}) of (n) nodes. Unfortunately, Steve's mine has been infiltrated by his greatest nemesis, Herobrine! At any time, Herobrine is hiding in exactly one node; initially, he may be in any of them. Steve can perform the following operations: (1\,\,x) — Check if Herobrine is currently in node (x). If he is, Steve catches him. Otherwise, Herobrine may or may not move to any adjacent node ( except the one you just checked). (2\,\,x) — Destroy all edges connected to node (x); Herobrine will no longer be able to use them. Afterwards, Herobrine may or may not move to any adjacent node. Find a sequence of at most (\left\lfloor \frac{5}{4} \cdot n \right\rfloor) operations that will guarantee Steve catches Herobrine, regardless of Herobrine's initial location and moves. We have a proof that, under the given constraints, this is always possible. (^{\text{∗}})A tree is a connected graph without cycles. 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 a single integer (n) ((2 \le n \le 2 \cdot 10^5)) — the number of nodes. Each of the next (n − 1) lines contains two integers (u) and (v) ((1 \le u, v \le n)), describing an edge between nodes (u) and (v). It is guaranteed that the given edges form a tree. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, first output a single integer (k) ((1 \le k \le \left\lfloor \frac{5}{4} \cdot n \right\rfloor)) — the number of operations you wish to perform. Then output (k) lines. Line (i) ((1 \le i \le k)) should contain two integers (t_i) and (x_i) ((1 \le t_i \le 2), (1 \le x_i \le n)), indicating that the (i)-th operatio

Tutorials

Codeforces Round 1044 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
335429650 qjm E Aug. 25, 2025, 12:58 a.m. OK C++17 (GCC 7-32) TESTS 30 234 7270400
335403436 MCPlayer542 E Aug. 24, 2025, 5:48 p.m. OK C++17 (GCC 7-32) TESTS 30 249 17305600
335397715 hdkkk E Aug. 24, 2025, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 30 249 18739200
335392999 huangxubin E Aug. 24, 2025, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 30 280 20684800
335407497 errorr371 E Aug. 24, 2025, 6:16 p.m. OK C++17 (GCC 7-32) TESTS 30 296 20070400
335424856 happy_node E Aug. 24, 2025, 10:18 p.m. OK C++17 (GCC 7-32) TESTS 30 311 14438400
335428101 max0000561 E Aug. 25, 2025, 12:10 a.m. OK C++17 (GCC 7-32) TESTS 30 311 16281600
335441911 incra E Aug. 25, 2025, 4:12 a.m. OK C++17 (GCC 7-32) TESTS 30 311 20070400
335402072 doraji_muchim E Aug. 24, 2025, 5:39 p.m. OK C++17 (GCC 7-32) TESTS 30 312 18329600
335449417 shubham2204 E Aug. 25, 2025, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 30 327 44236800
335403080 uuku E Aug. 24, 2025, 5:45 p.m. OK C++20 (GCC 13-64) TESTS 30 202 29081600
335388550 outfinity E Aug. 24, 2025, 4:14 p.m. OK C++20 (GCC 13-64) TESTS 30 265 26112000
335424150 MEDAA E Aug. 24, 2025, 9:59 p.m. OK C++20 (GCC 13-64) TESTS 30 265 33484800
335433284 Carucao E Aug. 25, 2025, 2:13 a.m. OK C++20 (GCC 13-64) TESTS 30 280 30515200
335392549 Kude E Aug. 24, 2025, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 30 280 33689600
335441514 TimurKul E Aug. 25, 2025, 4:05 a.m. OK C++20 (GCC 13-64) TESTS 30 281 37580800
335401743 too_rusty E Aug. 24, 2025, 5:38 p.m. OK C++20 (GCC 13-64) TESTS 30 296 16896000
335425384 monkey8 E Aug. 24, 2025, 10:33 p.m. OK C++20 (GCC 13-64) TESTS 30 296 25804800
335389691 syh123bc E Aug. 24, 2025, 4:17 p.m. OK C++20 (GCC 13-64) TESTS 30 311 26726400
335416731 _WD_ E Aug. 24, 2025, 7:48 p.m. OK C++20 (GCC 13-64) TESTS 30 311 30924800
335445484 424479543 E Aug. 25, 2025, 5:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 156 35737600
335445421 maspy E Aug. 25, 2025, 5:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 186 44339200
335392030 Vsg21 E Aug. 24, 2025, 4:22 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 249 32665600
335423968 Proofy E Aug. 24, 2025, 9:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 10342400
335436842 WTXwang E Aug. 25, 2025, 2:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 32051200
335445595 wandasd E Aug. 25, 2025, 5:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 32153600
335443225 ttamx E Aug. 25, 2025, 4:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 33894400
335439301 L2ngg E Aug. 25, 2025, 3:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 30 265 33996800
335424059 Proofy E Aug. 24, 2025, 9:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 280 10342400
335423290 Proofy E Aug. 24, 2025, 9:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 280 11161600
335391972 James_bond_9089 E Aug. 24, 2025, 4:22 p.m. OK C# 8 TESTS 30 1906 81100800
335390907 rainboy E Aug. 24, 2025, 4:20 p.m. OK GNU C11 TESTS 30 1249 15667200
335393637 LordAlpha E Aug. 24, 2025, 4:26 p.m. OK GNU C11 TESTS 30 1311 58265600
335396897 ryuk_baba E Aug. 24, 2025, 4:33 p.m. OK Java 21 TESTS 30 1233 100966400
335395712 mrunaltarwatkar018 E Aug. 24, 2025, 4:31 p.m. OK Java 21 TESTS 30 1374 85401600
335393457 aniketz E Aug. 24, 2025, 4:26 p.m. OK Java 21 TESTS 30 1374 120934400
335431758 wenbozh E Aug. 25, 2025, 1:45 a.m. OK Java 21 TESTS 30 1796 177049600
335398029 ironspec E Aug. 24, 2025, 4:34 p.m. OK Java 8 TESTS 30 1390 80281600
335392285 Sincerely_yours E Aug. 24, 2025, 4:23 p.m. OK Kotlin 1.9 TESTS 30 1874 86220800
335393808 Muhamadd_9 E Aug. 24, 2025, 4:26 p.m. OK OCaml TESTS 30 671 47001600
335417090 DarkTemplarDrop E Aug. 24, 2025, 7:53 p.m. OK PyPy 3-64 TESTS 30 1546 141004800
335414683 czjnbb E Aug. 24, 2025, 7:22 p.m. OK PyPy 3-64 TESTS 30 1577 111411200
335449925 V3k0r E Aug. 25, 2025, 6:02 a.m. OK PyPy 3-64 TESTS 30 1749 152064000
335393983 shade34 E Aug. 24, 2025, 4:27 p.m. OK PyPy 3-64 TESTS 30 1796 98816000
335396977 golomb E Aug. 24, 2025, 4:33 p.m. OK PyPy 3-64 TESTS 30 1890 94617600
335402926 HeptaCube E Aug. 24, 2025, 5:44 p.m. OK PyPy 3-64 TESTS 30 1906 180121600
335391684 samanddeanus E Aug. 24, 2025, 4:22 p.m. OK Rust 2024 TESTS 30 264 67174400

remove filters

Back to search problems