Codeforces Round 845 (Div. 2) and ByteRace 2023

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
1777 Codeforces Round 845 (Div. 2) and ByteRace 2023 FINISHED False 7200 62954663 Jan. 21, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1926 ) E Edge Reverse PROGRAMMING binary search dfs and similar ds graphs

B'You will be given a weighted directed graph of n nodes and m directed edges, where the i -th edge has a weight of w_i ( 1 <= i <= m ). You need to reverse some edges of this graph so that there is at least one node in the graph from which every other node is reachable. The cost of these reversals is equal to the maximum weight of all reversed edges. If no edge reversal is required, assume the cost to be 0 . It is guaranteed that no self-loop or duplicate edge exists. Find the minimum cost required for completing the task. If there is no solution, print a single integer -1 . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). The description of the test cases follows. Each test case begins with a line containing two integers n and m ( 2 <= n <= 2 cdot 10^5 , 1 <= m <= 2 cdot 10^5 ) -- the number of nodes in the graph and the number of edges in the graph. The next m lines of each test case contain 3 integers each -- u , v , w ( 1 <= u, v <= n , 1 <= w <= 10^9 ), indicating an edge from u to v with a weight of w . It is guaranteed that no edge connects a vertex to itself, and no pair of edges share the same origin and destination simultaneously. It is guaranteed that the sum of n and the sum of m over all test cases do not exceed 2 cdot 10^5 . For each test case, output the minimum cost. If there is no solution, print -1 . In the first test case, an edge exists from 1 to 2 , so all nodes are reachable (from 1 ). In the second test case, no nodes are reachable from any node no matter what edges we reverse, so the answer is -1 . In the third test case, reversing the 4 -th or 5 -th edge allows all nodes to be reachable from 1 . We choose the 5 -th edge here because its weight is smaller. '...

Tutorials

Codeforces Round #845 (Div. 2) and ByteRace 2023 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
190019255 I_am_not_good_at_CP E Jan. 21, 2023, 4:16 p.m. OK GNU C++14 TESTS 70 514 12902400
190052417 greatpaul E Jan. 22, 2023, 1:32 a.m. OK GNU C++14 TESTS 70 623 29081600
190050882 XG0000 E Jan. 22, 2023, 12:28 a.m. OK GNU C++14 TESTS 70 639 23347200
190056251 XG0000 E Jan. 22, 2023, 3:42 a.m. OK GNU C++14 TESTS 70 639 23449600
190020614 whm123 E Jan. 21, 2023, 4:21 p.m. OK GNU C++14 TESTS 70 654 29798400
190018984 genius_kgq E Jan. 21, 2023, 4:15 p.m. OK GNU C++14 TESTS 70 732 24473600
190051996 zltzlt E Jan. 22, 2023, 1:11 a.m. OK GNU C++14 TESTS 70 763 28262400
190019127 ironz E Jan. 21, 2023, 4:16 p.m. OK GNU C++14 TESTS 70 763 28262400
190037674 liympanda E Jan. 21, 2023, 7:16 p.m. OK GNU C++14 TESTS 70 795 33177600
190021437 antguz E Jan. 21, 2023, 4:24 p.m. OK GNU C++14 TESTS 70 811 19558400
190040465 Azimjonm0012 E Jan. 21, 2023, 7:51 p.m. OK GNU C++17 TESTS 70 561 24678400
190023495 s_jaskaran_s E Jan. 21, 2023, 4:30 p.m. OK GNU C++17 TESTS 70 732 24166400
190054746 Remask_588_handles E Jan. 22, 2023, 3:01 a.m. OK GNU C++17 TESTS 70 811 36659200
190054762 Remask_588_handles E Jan. 22, 2023, 3:01 a.m. OK GNU C++17 TESTS 70 857 36659200
190057001 Qsauce E Jan. 22, 2023, 4:05 a.m. OK GNU C++17 TESTS 70 873 36659200
190016489 sempav E Jan. 21, 2023, 4:07 p.m. OK GNU C++17 TESTS 70 904 24371200
190019180 guitar_hero E Jan. 21, 2023, 4:16 p.m. OK GNU C++17 TESTS 70 982 29491200
190023525 vlatko E Jan. 21, 2023, 4:30 p.m. OK GNU C++17 TESTS 70 982 32256000
190016233 RDDCCD E Jan. 21, 2023, 4:06 p.m. OK GNU C++17 TESTS 70 998 23347200
190034120 lxyb E Jan. 21, 2023, 6:47 p.m. OK GNU C++17 TESTS 70 1013 14745600
190019717 _akasi E Jan. 21, 2023, 4:18 p.m. OK GNU C++17 (64) TESTS 70 358 50176000
190024767 yamate11 E Jan. 21, 2023, 4:33 p.m. OK GNU C++17 (64) TESTS 70 685 52121600
190063229 cjk041212 E Jan. 22, 2023, 5:53 a.m. OK GNU C++17 (64) TESTS 70 733 93696000
190017028 used-fft E Jan. 21, 2023, 4:09 p.m. OK GNU C++17 (64) TESTS 70 982 59596800
190013627 E_huan E Jan. 21, 2023, 3:57 p.m. OK GNU C++17 (64) TESTS 70 1091 46899200
190015036 YocyCraft E Jan. 21, 2023, 4:02 p.m. OK GNU C++17 (64) TESTS 70 1216 50790400
190054972 Once_I_Liked_AGirl E Jan. 22, 2023, 3:07 a.m. OK GNU C++17 (64) TESTS 70 1248 37785600
190035477 I_HATE_GEOMETRY E Jan. 21, 2023, 6:55 p.m. OK GNU C++17 (64) TESTS 70 1262 43110400
190059871 ExplodingKonjac E Jan. 22, 2023, 5:04 a.m. OK GNU C++17 (64) TESTS 70 1466 37068800
190052806 dogignore E Jan. 22, 2023, 1:46 a.m. OK GNU C++17 (64) TESTS 70 1496 77926400
190053607 ac2u E Jan. 22, 2023, 2:13 a.m. OK GNU C++20 (64) TESTS 70 467 44851200
190054112 kcudcigam E Jan. 22, 2023, 2:34 a.m. OK GNU C++20 (64) TESTS 70 576 45670400
190063079 nifeshe E Jan. 22, 2023, 5:51 a.m. OK GNU C++20 (64) TESTS 70 624 64409600
190063320 jiajieshi E Jan. 22, 2023, 5:54 a.m. OK GNU C++20 (64) TESTS 70 639 83046400
190034139 propane E Jan. 21, 2023, 6:47 p.m. OK GNU C++20 (64) TESTS 70 748 83558400
190062065 Rinors E Jan. 22, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 70 779 53145600
190039778 raresmihai E Jan. 21, 2023, 7:42 p.m. OK GNU C++20 (64) TESTS 70 810 55296000
190046762 physics0523 E Jan. 21, 2023, 9:49 p.m. OK GNU C++20 (64) TESTS 70 826 65945600
190040065 A_G E Jan. 21, 2023, 7:46 p.m. OK GNU C++20 (64) TESTS 70 857 15769600
190016311 buidangnguyen05 E Jan. 21, 2023, 4:06 p.m. OK GNU C++20 (64) TESTS 70 857 38912000
190034724 Dukkha E Jan. 21, 2023, 6:50 p.m. OK Java 17 TESTS 70 2198 24576000
190022206 MagentaCobra E Jan. 21, 2023, 4:26 p.m. OK Java 8 TESTS 70 3306 43622400
190058906 misorin E Jan. 22, 2023, 4:47 a.m. OK PyPy 3 TESTS 70 1154 36659200
190058877 misorin E Jan. 22, 2023, 4:46 a.m. OK PyPy 3-64 TESTS 70 1434 53043200

remove filters

Back to search problems