Codeforces Global Round 25

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
1951 Codeforces Global Round 25 FINISHED False 10800 19409099 April 6, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 76 ) I Growing Trees PROGRAMMING constructive algorithms flows graphs greedy

B"You are given an undirected connected simple graph with n nodes and m edges, where edge i connects node u_i and v_i , with two positive parameters a_i and b_i attached to it. Additionally, you are also given an integer k . A non-negative array x with size m is called a k -spanning-tree generator if it satisfies the following: The cost of such array x is defined as sum_{i = 1}^m a_i x_i^2 + b_i x_i . Find the minimum cost of a k -spanning-tree generator. ^ dagger A spanning tree of a (multi)graph is a subset of the graph's edges that form a tree connecting all vertices of the graph. Each test contains multiple test cases. The first line contains an integer t ( 1 <= t <= 500 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains three integers n , m , and k ( 2 <= n <= 50, n - 1 <= m <= min(50, frac{n(n - 1)}{2}), 1 <= k <= 10^7 ) -- the number of nodes in the graph, the number of edges in the graph, and the parameter for the k -spanning-tree generator. Each of the next m lines of each test case contains four integers u_i , v_i , a_i , and b_i ( 1 <= u_i, v_i <= n, u_i neq v_i, 1 <= a_i, b_i <= 1000 ) -- the endpoints of the edge i and its two parameters. It is guaranteed that the graph is simple and connected. It is guaranteed that the sum of n^2 and the sum of m^2 over all test cases does not exceed 2500 . For each test case, output a single integer: the minimum cost of a k -spanning-tree generator. In the first test case, a valid 1 -spanning-tree generator is x = [1, 1, 1, 1, 0] , as indicated by the following figure. The cost of this generator is (1^2 cdot 5 + 1 cdot 5) + (1^2 cdot 5 + 1 cdot 7) + (1^2 cdot 6 + 1 cdot 2) + (1^2 cdot 3 + 1 cdot 5) + (0^2 cdot 4 + 0 cdot 9) ="...

Tutorials

Codeforces Global Round 25 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
255365546 EgorGandziy I April 6, 2024, 6:29 p.m. OK C++17 (GCC 7-32) TESTS 188 390 1740800
255363996 singhprajjawal87 I April 6, 2024, 6:21 p.m. OK C++17 (GCC 7-32) TESTS 188 390 1740800
255422614 Crystally I April 7, 2024, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 188 437 194457600
255370564 Benq I April 6, 2024, 7:05 p.m. OK C++17 (GCC 7-32) TESTS 188 2187 102400
255365386 ecnerwala I April 6, 2024, 6:28 p.m. OK C++20 (GCC 13-64) TESTS 188 328 102400
255419807 ecnerwala I April 7, 2024, 5:48 a.m. OK C++20 (GCC 13-64) TESTS 188 375 102400
255366284 ecnerwala I April 6, 2024, 6:33 p.m. OK C++20 (GCC 13-64) TESTS 188 390 102400
255374113 hitonanode I April 6, 2024, 7:34 p.m. OK C++20 (GCC 13-64) TESTS 188 859 102400
255383770 Sana I April 6, 2024, 9:03 p.m. OK C++20 (GCC 13-64) TESTS 188 874 102400
255373441 hitonanode I April 6, 2024, 7:29 p.m. OK C++20 (GCC 13-64) TESTS 188 874 102400
255372952 hitonanode I April 6, 2024, 7:25 p.m. OK C++20 (GCC 13-64) TESTS 188 890 102400
255363986 ecnerwala I April 6, 2024, 6:20 p.m. OK C++20 (GCC 13-64) TESTS 188 952 102400
255369322 Benq I April 6, 2024, 6:55 p.m. OK C++20 (GCC 13-64) TESTS 188 1062 102400
255371862 Kuroni I April 6, 2024, 7:16 p.m. OK C++20 (GCC 13-64) TESTS 188 1155 102400

remove filters

Back to search problems