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
( 196 ) H2 Victorious Coloring (Hard Version) PROGRAMMING data structures data structures data structures data structures

This is the hard version of the problem. The difference between the versions is that in this version, (q \le 250\,000). You can hack only if you solved all versions of this problem. You are given a tree with (n) vertices, where each vertex is numbered from (1) to (n). Each edge is assigned a positive integer weight (w_1, w_2, \ldots, w_{n-1}) as well. A victorious coloring is a coloring of each vertex into two colors: red and yellow , where there should be at least one vertex colored in red (corresponding to the symbol of team T1). Suppose that there is a nonnegative integer weight (x_1, x_2, \ldots, x_n) assigned to each vertex. The cost of the victorious coloring is defined as the sum of the weights of all red vertices, plus the sum of the weights of all edges that connect vertices of different colors (between red and yellow). We define (f(x_1, x_2, \ldots, x_n)) as the minimum possible cost for all victorious colorings. Gumayusi considered the problem of computing (f(x_1, x_2, \ldots, x_n)), given the sequence (x_1, x_2, \ldots, x_n). However, this problem was too easy for him, so he devised a variation: Given an integer (l), find a sequence of nonnegative integer vertex weights (x_1, x_2, \ldots, x_n) such that (f(x_1, x_2, \ldots, x_n) \ge l) and the total sum (\sum_{i=1}^n x_i) is minimized. Gumayusi was satisfied, but there was a serious issue — this problem doesn't have any queries, which is a necessary component for any problem that isn't bad. So, he added queries to this problem. For each (l) given as a query, you must find the corresponding minimum possible sum of vertex weights. 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 contains an integer (n) ((2 \le n \le 250\,000)) — the number of vertices. The following (n-1) lines contain three

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
341758982 LastMagician H2 Oct. 3, 2025, 9:15 p.m. OK C++17 (GCC 7-32) TESTS 33 999 108646400
341762716 Maverick027 H2 Oct. 3, 2025, 10:39 p.m. OK C++17 (GCC 7-32) TESTS 33 1015 108953600
341776757 qiuzx H2 Oct. 4, 2025, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 33 1233 126976000
341735725 BurnedChicken H2 Oct. 3, 2025, 5:27 p.m. OK C++20 (GCC 13-64) TESTS 33 1436 47923200
341786230 ecnerwala H2 Oct. 4, 2025, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 484 41369600
341767846 ibr-abd H2 Oct. 4, 2025, 1:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 593 47308800
341729562 Nachia H2 Oct. 3, 2025, 5:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 593 47308800
341781750 Codeabhi836 H2 Oct. 4, 2025, 4:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 608 112025600
341771176 DangHoaNguyen H2 Oct. 4, 2025, 2:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 624 118476800
341761022 rainboy H2 Oct. 3, 2025, 9:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 1030 60211200

remove filters

Back to search problems