Squarepoint Challenge (Codeforces Round 1055, Div. 1 + 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
2152 Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) FINISHED False 10800 16903523 Oct. 3, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 704 ) G Query Jungle PROGRAMMING data structures data structures implementation math math trees

Oner is a jungler — a role where you hunt monsters in a jungle. Given the number of trees he sees in a jungle, it's no surprise that he is addicted to tree query problems. You are given a tree of (n) vertices, rooted at vertex (1). Each vertex either contains a monster or does not. You want to find the minimum integer (k) such that there exist (k) paths that satisfy the following conditions: Each path must start at the root (vertex (1)). Every vertex with a monster must be included in at least one of these paths. A vertex is considered included in a path if it is one of the path's vertices, including its endpoints. To make this problem more challenging, you must also answer (q) queries. For each query, you are given a vertex (v). For each vertex (w) in the subtree of (v), its status is inverted — the one containing a monster starts to not contain one, and the one not containing a monster starts to contain one. After each query, you must solve the original problem again with the updated status. Note that queries are cumulative , so the effects of each query carry on to future queries. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 20\,000)). The description of the test cases follows. The first line contains a single integer (n) ((2 \le n \le 250\,000)) — the number of vertices in the tree. The next line contains (n) integers (a_1, a_2, \ldots, a_n) ((a_i \in \{0, 1\})), representing the initial status. If (a_i = 1), vertex (i) contains a monster; if (a_i = 0), it does not. The next (n-1) lines each contain two integers (u) and (v) ((1 \le u, v \le n, u \ne v)), describing an edge between vertices (u) and (v). It is guaranteed that these edges form a tree. The next line contains a single integer (q) ((0 \le q \le 250\,000)) — the number of queries. The next (q) lines each contain a single

Tutorials

Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
341738116 ggghg G Oct. 3, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 100 843 77516800
341732974 jvsr G Oct. 3, 2025, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 100 874 46694400
341728846 VuhungT05 G Oct. 3, 2025, 5:06 p.m. OK C++17 (GCC 7-32) TESTS 100 874 56524800
341735949 LastMagician G Oct. 3, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 100 890 49664000
341728302 rubbishZ G Oct. 3, 2025, 5:04 p.m. OK C++17 (GCC 7-32) TESTS 100 906 59392000
341738239 jose_mourinho G Oct. 3, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 100 984 48742400
341784304 hswfwkj114 G Oct. 4, 2025, 5:13 a.m. OK C++17 (GCC 7-32) TESTS 100 1062 47104000
341736103 wikzander G Oct. 3, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 100 1155 56217600
341729272 onoco G Oct. 3, 2025, 5:07 p.m. OK C++17 (GCC 7-32) TESTS 100 1218 57548800
341723060 pranas G Oct. 3, 2025, 4:48 p.m. OK C++17 (GCC 7-32) TESTS 100 1483 87142400
341762887 maxplus G Oct. 3, 2025, 10:45 p.m. OK C++20 (GCC 13-64) TESTS 100 437 56217600
341762872 maxplus G Oct. 3, 2025, 10:44 p.m. OK C++20 (GCC 13-64) TESTS 100 468 56217600
341763022 maxplus G Oct. 3, 2025, 10:49 p.m. OK C++20 (GCC 13-64) TESTS 100 515 56217600
341764916 Noobish_Monk G Oct. 3, 2025, 11:56 p.m. OK C++20 (GCC 13-64) TESTS 100 577 63795200
341733738 Flannery G Oct. 3, 2025, 5:21 p.m. OK C++20 (GCC 13-64) TESTS 100 608 49971200
341783104 lsr_czz G Oct. 4, 2025, 4:59 a.m. OK C++20 (GCC 13-64) TESTS 100 640 75468800
341768632 FantasyNumber G Oct. 4, 2025, 1:31 a.m. OK C++20 (GCC 13-64) TESTS 100 671 72601600
341733128 bjcb G Oct. 3, 2025, 5:20 p.m. OK C++20 (GCC 13-64) TESTS 100 702 53862400
341733434 CHATTY-Bebob G Oct. 3, 2025, 5:20 p.m. OK C++20 (GCC 13-64) TESTS 100 718 50892800
341746729 Tlatoani G Oct. 3, 2025, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 100 718 67072000
341737242 yslsj G Oct. 3, 2025, 5:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 452 58470400
341778890 Benq G Oct. 4, 2025, 4:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 100 593 84582400
341733662 LateNighter G Oct. 3, 2025, 5:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 656 48844800
341730353 ckuhn222theend G Oct. 3, 2025, 5:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 671 36761600
341734532 qqwrv G Oct. 3, 2025, 5:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 671 48025600
341724543 Su_Zipei G Oct. 3, 2025, 4:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 687 55500800
341749265 shelbydiz G Oct. 3, 2025, 7:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 687 71987200
341738561 Halzion G Oct. 3, 2025, 5:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 687 98099200
341724325 JDScript0117 G Oct. 3, 2025, 4:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 702 68198400
341748850 jtnydv25 G Oct. 3, 2025, 7:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 100 702 72908800
341729576 artmusicasia G Oct. 3, 2025, 5:08 p.m. OK Java 21 TESTS 100 2046 163225600
341743260 danger0069 G Oct. 3, 2025, 6:31 p.m. OK Java 8 TESTS 100 811 63283200
341746474 arvindf232 G Oct. 3, 2025, 6:53 p.m. OK Kotlin 2.2 TESTS 100 2812 19046400
341736055 sansen G Oct. 3, 2025, 5:28 p.m. OK Rust 2021 TESTS 100 2061 56217600

remove filters

Back to search problems