Codeforces Round 1020 (Div. 3)

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
2106 Codeforces Round 1020 (Div. 3) FINISHED False 8100 30900323 April 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1606 ) G1 Baudelaire (easy version) PROGRAMMING binary search interactive trees

This is the easy version of the problem. The only difference between the two versions is that in this version, it is guaranteed that every node is adjacent to node (1). This problem is interactive. Baudelaire is very rich, so he bought a tree of size (n) that is rooted at some arbitrary node. Additionally, every node has a value of (1) or (-1). In this version, every node is adjacent to node (1). However, please note that node (1) is not necessarily the root. Cow the Nerd saw the tree and fell in love with it. However, computer science doesn't pay him enough, so he can't afford to buy it. Baudelaire decided to play a game with Cow the Nerd, and if he won, he would gift him the tree. Cow the Nerd does not know which node is the root, and he doesn't know the values of the nodes either. However, he can ask Baudelaire queries of two types: (1) (k) (u_1) (u_2) (...) (u_k): Let (f(u)) be the sum of the values of all nodes in the path from the root of the tree to node (u). Cow the Nerd may choose an integer (k) ((1 \le k \le n)) and (k) nodes (u_1, u_2, ..., u_k), and he will receive the value (f(u_1) + f(u_2) + ... + f(u_k)). (2) (u): Baudelaire will toggle the value of node (u). Specifically, if the value of (u) is (1) it will become (-1), and vice versa. Cow the Nerd wins if he guesses the value of every node correctly (the values of the final tree, after performing the queries) within (n + 200) total queries. Can you help him win? The first line of the input contains a single integer (t) ((1 \le t \le 100)), the number of test cases. The first line of each test case contains a single integer (n) ((2 \le n \le 10^3)), the size of the tree. Each of the next (n-1) lines contains two integers (u) and (v) ((1 \le u, v \le n, u \neq v)), denoting an edge between nodes (u) and (v) in the tree. In this version, it is guarante

Tutorials

Codeforces Round 1020 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317129844 Adilkhan855 G1 April 25, 2025, 5:02 a.m. OK C++17 (GCC 7-32) TESTS 22 62 0
317090202 b_man123 G1 April 24, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 22 62 0
317082951 slave_owner_1012 G1 April 24, 2025, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 22 62 0
317081408 Phantom_Dreams G1 April 24, 2025, 5:09 p.m. OK C++17 (GCC 7-32) TESTS 22 62 0
317076132 Chaitu_128 G1 April 24, 2025, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 22 62 0
317116031 happyssorigami G1 April 25, 2025, 12:33 a.m. OK C++17 (GCC 7-32) TESTS 22 62 102400
317114329 11490DX G1 April 24, 2025, 11:47 p.m. OK C++17 (GCC 7-32) TESTS 22 62 102400
317074178 Sir-Ahmed-Imran G1 April 24, 2025, 4:43 p.m. OK C++17 (GCC 7-32) TESTS 22 62 102400
317081962 asaltfish G1 April 24, 2025, 5:12 p.m. OK C++17 (GCC 7-32) TESTS 22 62 1638400
317127983 005-Baurzhan-Sh-2028 G1 April 25, 2025, 4:33 a.m. OK C++17 (GCC 7-32) TESTS 22 62 3276800

remove filters

Back to search problems