Codeforces Round 934 (Div. 1)

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
1943 Codeforces Round 934 (Div. 1) FINISHED False 8700 26580263 March 16, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2198 ) C Tree Compass PROGRAMMING constructive algorithms dfs and similar greedy trees

B'You are given a tree with n vertices numbered 1, 2, ldots, n . Initially, all vertices are colored white. You can perform the following two-step operation: Construct a sequence of operations to color all the nodes in the tree black using the minimum possible number of operations. It can be proven that it is always possible to do so using at most n operations. ^ dagger text{dist}(x, y) denotes the number of edges on the (unique) simple path between vertices x and y on the tree. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 200 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot 10^3 ) -- the number of vertices of the tree. The following n - 1 lines of each test case describe the edges of the tree. The i -th of these lines contains two integers u_i and v_i ( 1 <= u_i, v_i <= n , u_i neq v_i ), the indices of the vertices connected by the i -th edge. 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^3 . For each test case, first output a single integer op (1 <= op <= n) , the minimum number of operations needed to color all vertices of the tree black. Then, output op lines, each containing 2 integers. The i -th line should contain the values of v and d chosen for the i -th operation ( 1 <= v <= n , 0 <= d <= n - 1 ) You must guarantee that at the end of op operations, all vertices are colored black. If there are multiple solutions, you may output any one of them. In the first test case, there is only one possible operation, and performing it gives us a valid answer. In the second test case, the first operation colors vertex 2 black, a'...

Tutorials

Codeforces Round #934 (Div1, Div2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
251788049 mban259 C March 16, 2024, 4:47 p.m. OK C# 10 TESTS 48 187 18022400
251762814 RobertoFirmino C March 16, 2024, 3:55 p.m. OK C++14 (GCC 6-32) TESTS 48 15 102400
251790987 cfhj C March 16, 2024, 4:55 p.m. OK C++14 (GCC 6-32) TESTS 48 15 204800
251776804 JCY_ C March 16, 2024, 4:22 p.m. OK C++14 (GCC 6-32) TESTS 48 15 204800
251747671 LittleBeetle C March 16, 2024, 3:31 p.m. OK C++14 (GCC 6-32) TESTS 48 15 204800
251849891 Celebrate C March 17, 2024, 2:55 a.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251845392 RDFZchenyy C March 17, 2024, 1:45 a.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251790364 HHH666666 C March 16, 2024, 4:54 p.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251786200 syx2567 C March 16, 2024, 4:43 p.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251770619 changle_knh C March 16, 2024, 4:09 p.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251765847 baiABC C March 16, 2024, 4 p.m. OK C++14 (GCC 6-32) TESTS 48 15 307200
251790262 zhouqixuan1 C March 16, 2024, 4:53 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251788633 Gold14526 C March 16, 2024, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251776379 JoesSR_ C March 16, 2024, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251775500 Muelsyse C March 16, 2024, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251774065 CHYYYY C March 16, 2024, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251765551 Tom66 C March 16, 2024, 4 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251739730 fire_water C March 16, 2024, 3:20 p.m. OK C++17 (GCC 7-32) TESTS 48 15 102400
251859613 hzk_cpp C March 17, 2024, 4:53 a.m. OK C++17 (GCC 7-32) TESTS 48 15 204800
251855295 Aicu C March 17, 2024, 4:07 a.m. OK C++17 (GCC 7-32) TESTS 48 15 204800
251853835 sxye C March 17, 2024, 3:50 a.m. OK C++17 (GCC 7-32) TESTS 48 15 204800
251755538 Gassa C March 16, 2024, 3:43 p.m. OK D TESTS 48 31 4505600
251780860 Duldek C March 16, 2024, 4:30 p.m. OK Go TESTS 48 31 819200
251751044 iakovlev.zakhar C March 16, 2024, 3:36 p.m. OK Java 8 TESTS 48 140 0
251792581 SecondThread C March 16, 2024, 4:58 p.m. OK Java 8 TESTS 48 140 38195200
251751713 Tlatoani C March 16, 2024, 3:37 p.m. OK Kotlin 1.9 TESTS 48 171 0
251722773 arvindf232 C March 16, 2024, 2:59 p.m. OK Kotlin 1.9 TESTS 48 249 1331200
251728707 conqueror_of_tourist C March 16, 2024, 3:06 p.m. OK PyPy 3-64 TESTS 48 124 5632000
251740802 toam C March 16, 2024, 3:21 p.m. OK PyPy 3-64 TESTS 48 124 7270400
251749764 dabbler1 C March 16, 2024, 3:34 p.m. OK PyPy 3-64 TESTS 48 155 7270400
251749169 chinerist C March 16, 2024, 3:33 p.m. OK PyPy 3-64 TESTS 48 156 7372800
251779025 yefllower C March 16, 2024, 4:27 p.m. OK PyPy 3-64 TESTS 48 171 9420800
251772018 jonathanpaulson C March 16, 2024, 4:12 p.m. OK PyPy 3-64 TESTS 48 233 10240000
251753290 misorin C March 16, 2024, 3:39 p.m. OK PyPy 3-64 TESTS 48 389 11878400
251739442 Egor C March 16, 2024, 3:19 p.m. OK Rust 2021 TESTS 48 15 204800
251763620 toomer C March 16, 2024, 3:56 p.m. OK Rust 2021 TESTS 48 15 307200
251777435 brown_amaurotis C March 16, 2024, 4:23 p.m. OK Rust 2021 TESTS 48 30 409600
251759371 sansen C March 16, 2024, 3:49 p.m. OK Rust 2021 TESTS 48 31 204800
251774303 ngtkana C March 16, 2024, 4:17 p.m. OK Rust 2021 TESTS 48 31 307200

remove filters

Back to search problems