Educational Codeforces Round 180 (Rated for 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
2112 Educational Codeforces Round 180 (Rated for Div. 2) FINISHED False 7200 25716323 June 23, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 9365 ) D Reachability and Tree PROGRAMMING constructive algorithms dfs and similar dp trees

Let (u) and (v) be two distinct vertices in a directed graph. Let's call the ordered pair ((u, v)) good if there exists a path from vertex (u) to vertex (v) along the edges of the graph. You are given an undirected tree with (n) vertices and (n - 1) edges. Determine whether it is possible to assign a direction to each edge of this tree so that the number of good pairs in it is exactly (n). If it is possible, print any way to direct the edges resulting in exactly (n) good pairs. The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains one integer (n) ((2 \le n \le 2 \cdot 10^5)) — the number of vertices in the tree. The next (n - 1) lines describe the edges. The (i)-th line contains two integers (u_i) and (v_i) ((1 \le u_i, v_i \le n); (u_i \neq v_i)) — the vertices connected by the (i)-th edge. It is guaranteed that the edges in each test case form an undirected tree and that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print " NO " (case-insensitive) if it is impossible to direct all edges of the tree and obtain exactly (n) good pairs of vertices. Otherwise, print " YES " (case-insensitive) and then print (n - 1) pairs of integers (u_i) and (v_i) separated by spaces — the edges directed from (u_i) to (v_i). The edges can be printed in any order. If there are multiple answers, output any. The tree from the first test case and its possible directed version are shown in the legend above. In this version, there are exactly (5) good pairs of vertices: ((3, 5)), ((3, 1)), ((3, 2)), ((1, 2)), and ((4, 2)). One possible directed version of the tree from the second test case is shown below: In the presented answer, there are exactly (5) good pairs of vertices: ((2, 1)), ((3, 1)), ((4, 1)), $$$(5, 4)$$

Tutorials

Educational Codeforces Round 180 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
325962333 og.kostya D June 25, 2025, 5:55 a.m. OK C# 13 TESTS 14 296 34713600
325822301 sinhatushar334 D June 23, 2025, 5:15 p.m. OK C# 13 TESTS 14 437 51609600
325849339 XiaoJuRuoUP D June 24, 2025, 12:27 a.m. OK C++17 (GCC 7-32) TESTS 14 202 4915200
325944682 qianxinyu D June 25, 2025, 1:28 a.m. OK C++17 (GCC 7-32) TESTS 14 202 11161600
325937034 Anonymous_HF D June 24, 2025, 9:34 p.m. OK C++17 (GCC 7-32) TESTS 14 218 6144000
325857045 hbhz_zcy D June 24, 2025, 10:39 a.m. OK C++17 (GCC 7-32) TESTS 14 218 6451200
325941357 kicika D June 24, 2025, 11:43 p.m. OK C++17 (GCC 7-32) TESTS 14 234 7782400
325890140 peteza D June 24, 2025, 3:03 p.m. OK C++17 (GCC 7-32) TESTS 14 234 8704000
325841188 NoPressureAgain D June 23, 2025, 8:34 p.m. OK C++17 (GCC 7-32) TESTS 14 234 9420800
325828582 labmem007 D June 23, 2025, 6:01 p.m. OK C++17 (GCC 7-32) TESTS 14 234 10854400
325841700 dejzi_rose D June 23, 2025, 8:44 p.m. OK C++17 (GCC 7-32) TESTS 14 249 5734400
325854681 samved58117 D June 24, 2025, 10:13 a.m. OK C++17 (GCC 7-32) TESTS 14 249 6041600
325821010 hotcocoa D June 23, 2025, 5:06 p.m. OK C++20 (GCC 13-64) TESTS 14 155 8396800
325867921 kusacster D June 24, 2025, 11:56 a.m. OK C++20 (GCC 13-64) TESTS 14 155 10240000
325842391 Mtaylor D June 23, 2025, 8:56 p.m. OK C++20 (GCC 13-64) TESTS 14 155 29798400
325909263 MMamun D June 24, 2025, 5:15 p.m. OK C++20 (GCC 13-64) TESTS 14 187 11366400
325848358 ChengyunSun D June 23, 2025, 11:48 p.m. OK C++20 (GCC 13-64) TESTS 14 187 18329600
325939210 NeverSpot D June 24, 2025, 10:29 p.m. OK C++20 (GCC 13-64) TESTS 14 202 10854400
325827641 Arkhell D June 23, 2025, 5:54 p.m. OK C++20 (GCC 13-64) TESTS 14 202 11673600
325945424 Stillswarm D June 25, 2025, 1:48 a.m. OK C++20 (GCC 13-64) TESTS 14 202 12185600
325854984 andonis D June 24, 2025, 10:17 a.m. OK C++20 (GCC 13-64) TESTS 14 202 12902400
325951401 Ace_18 D June 25, 2025, 3:28 a.m. OK C++20 (GCC 13-64) TESTS 14 202 17612800
325856320 bnsczr D June 24, 2025, 10:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 186 48537600
325854329 bnsczr D June 24, 2025, 10:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 186 48537600
325941994 CodeC. D June 25, 2025, 12:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 187 8601600
325891311 Atlansesrt D June 24, 2025, 3:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 187 10854400
325850215 arduino060 D June 24, 2025, 12:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 187 20480000
325948507 Aryan_007 D June 25, 2025, 2:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 202 13004800
325941265 Halberd_Cease D June 24, 2025, 11:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 202 16998400
325850467 M_L_K D June 24, 2025, 1:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 202 17715200
325858716 ywertydfghncvbwsertvb D June 24, 2025, 10:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 202 25907200
325906159 tooourist D June 24, 2025, 4:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 203 9011200
325851901 tranquyetthang281 D June 24, 2025, 9:23 a.m. OK Go TESTS 14 249 42598400
325934273 debyet D June 24, 2025, 8:43 p.m. OK Java 21 TESTS 14 733 46592000
325839939 vineetiwari D June 23, 2025, 8:11 p.m. OK Java 21 TESTS 14 811 52224000
325830401 sahasrad D June 23, 2025, 6:16 p.m. OK Java 21 TESTS 14 812 48742400
325830714 sahasrad D June 23, 2025, 6:18 p.m. OK Java 21 TESTS 14 812 53350400
325839953 vineetiwari D June 23, 2025, 8:12 p.m. OK Java 21 TESTS 14 827 51200000
325898375 THEarchitect D June 24, 2025, 3:57 p.m. OK Java 21 TESTS 14 842 37478400
325820085 kartik__sethi D June 23, 2025, 5:01 p.m. OK Java 21 TESTS 14 859 60108800
325902757 vanshgoel1 D June 24, 2025, 4:27 p.m. OK Java 21 TESTS 14 874 61849600
325946453 man-ray D June 25, 2025, 2:14 a.m. OK Java 21 TESTS 14 874 62259200
325822683 Bogys D June 23, 2025, 5:17 p.m. OK Java 21 TESTS 14 889 81408000
325903985 Pranav_45 D June 24, 2025, 4:36 p.m. OK Java 8 TESTS 14 655 40960000
325825427 dhruvil_8803 D June 23, 2025, 5:37 p.m. OK Java 8 TESTS 14 796 55500800
325825633 dhruvil_8803 D June 23, 2025, 5:39 p.m. OK Java 8 TESTS 14 843 55705600
325833916 adibhai0845R D June 23, 2025, 6:47 p.m. OK Java 8 TESTS 14 1077 35737600
325842794 Sumitsingh7 D June 23, 2025, 9:04 p.m. OK Java 8 TESTS 14 1281 132300800
325960909 Rahul_Malowa D June 25, 2025, 5:39 a.m. OK Java 8 TESTS 14 1796 33996800
325856794 y_a_s D June 24, 2025, 10:36 a.m. OK Java 8 TESTS 14 1796 80588800
325828938 blazevfx D June 23, 2025, 6:04 p.m. OK PyPy 3 TESTS 14 1733 32051200
325840326 gardengnome D June 23, 2025, 8:19 p.m. OK PyPy 3-64 TESTS 14 390 42905600
325837975 gardengnome D June 23, 2025, 7:39 p.m. OK PyPy 3-64 TESTS 14 390 43520000
325828239 Skyblock127 D June 23, 2025, 5:59 p.m. OK PyPy 3-64 TESTS 14 530 88985600
325828020 Skyblock127 D June 23, 2025, 5:57 p.m. OK PyPy 3-64 TESTS 14 561 114892800
325939384 ezwithgpt D June 24, 2025, 10:36 p.m. OK PyPy 3-64 TESTS 14 577 75161600
325834929 Om_Singh_ D June 23, 2025, 6:58 p.m. OK PyPy 3-64 TESTS 14 608 54988800
325844274 ChickenTamer D June 23, 2025, 9:37 p.m. OK PyPy 3-64 TESTS 14 608 67584000
325922895 anton57 D June 24, 2025, 7:09 p.m. OK PyPy 3-64 TESTS 14 608 71782400
325902740 Deecey01 D June 24, 2025, 4:27 p.m. OK PyPy 3-64 TESTS 14 609 95232000
325895781 zuba37 D June 24, 2025, 3:40 p.m. OK PyPy 3-64 TESTS 14 624 71270400
325952231 ValeriyShiyan D June 25, 2025, 3:40 a.m. OK Python 3 TESTS 14 577 77312000
325921701 kishan9487 D June 24, 2025, 6:55 p.m. OK Python 3 TESTS 14 999 67891200
325824464 Akash_Baidya2005 D June 23, 2025, 5:30 p.m. OK Python 3 TESTS 14 999 75571200
325845211 AnanasClassic D June 23, 2025, 10 p.m. OK Python 3 TESTS 14 1046 54988800
325914016 svrmalaviya D June 24, 2025, 5:50 p.m. OK Python 3 TESTS 14 1062 44953600
325899444 uwu12 D June 24, 2025, 4:05 p.m. OK Python 3 TESTS 14 1062 44953600
325849068 renyancheng D June 24, 2025, 12:17 a.m. OK Python 3 TESTS 14 1171 57651200
325907668 pranprocodes D June 24, 2025, 5:02 p.m. OK Python 3 TESTS 14 1217 91955200
325919908 DeanMenezes3 D June 24, 2025, 6:37 p.m. OK Rust 2021 TESTS 14 499 37273600
325853706 DanielAnker D June 24, 2025, 9:56 a.m. OK Rust 2021 TESTS 14 531 29593600
325822708 davidmiheev D June 23, 2025, 5:17 p.m. OK Rust 2021 TESTS 14 561 21913600

remove filters

Back to search problems