Codeforces Global Round 16

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
1566 Codeforces Global Round 16 FINISHED False 9000 100365899 Sept. 12, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 343 ) G Four Vertices PROGRAMMING constructive algorithms data structures graphs greedy implementation shortest paths

B"You are given an undirected weighted graph, consisting of n vertices and m edges. Some queries happen with this graph: At the beginning and after each query, you should find four different vertices a , b , c , d such that there exists a path between a and b , there exists a path between c and d , and the sum of lengths of two shortest paths from a to b and from c to d is minimal. The answer to the query is the sum of the lengths of these two shortest paths. The length of the path is equal to the sum of weights of edges in this path. The first line contains two integers n and m (4 <= n, m <= 10^5) -- the number of vertices and edges in the graph respectively. Each of the next m lines contain three integers v , u , w ( 1 <= v, u <= n, v neq u , 1 <= w <= 10^9 ) -- this triple means that there is an edge between vertices v and u with weight w . The next line contains a single integer q (0 <= q <= 10^5) -- the number of queries. The next q lines contain the queries of two types: It is guaranteed that the initial graph does not contain multiple edges. At the beginning and after each query, the graph doesn't need to be connected. It is guaranteed that at each moment the number of edges will be at least 4 . It can be proven, that at each moment there exist some four vertices a , b , c , d such that there exists a path between vertices a and b , and there exists a path between vertices c and d . Print q + 1 integers -- the minimal sum of lengths of shortest paths between chosen pairs of vertices before the queries and after each of them. Before the queries you can choose vertices (a, b) = (3, 2) and (c, d) = (1, 4) . The sum of lengths of two shortest paths is 3 + 1 = 4 . After the first query you can choose vertices $"...

Tutorials

Codeforces Global Round 16 Editorial

Submissions

No solutions yet.