Codeforces Round 865 (Div. 1)

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
1815 Codeforces Round 865 (Div. 1) FINISHED False 8100 50771699 April 9, 2023, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 241 ) F OH NO1 (-2-3-4) PROGRAMMING constructive algorithms graphs math shortest paths 3500

B'You are given an undirected graph with n vertices and 3m edges. The graph may contain multi-edges, but does not contain self-loops. The graph satisfies the following property: the given edges can be divided into m groups of 3 , such that each group is a triangle. A triangle is defined as three edges (a,b) , (b,c) and (c,a) for some three distinct vertices a,b,c ( 1 <= q a,b,c <= q n ). Initially, each vertex v has a non-negative integer weight a_v . For every edge (u,v) in the graph, you should perform the following operation exactly once: After performing all operations, the following requirement should be satisfied: if u and v are connected by an edge, then a_u ne a_v . It can be proven this is always possible under the constraints of the task. Output a way to do so, by outputting the choice of x for each edge. It is easy to see that the order of operations does not matter. If there are multiple valid answers, output any. The first line contains a single integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains two integers n and m ( 3 <= n <= 10^6 , 1 <= m <= 4 cdot 10^5 ) -- denoting the graph have n vertices and 3m edges. The second line of each test case contains n integers a_1,a_2, ldots,a_n ( 0 <= q a_i <= q 10^6 ) -- the initial weights of each vertex. Then m lines follow. The i -th line contains three integers a_i , b_i , c_i ( 1 <= q a_i < b_i < c_i <= q n ) -- denotes that three edges (a_i,b_i) , (b_i,c_i) and (c_i,a_i) . Note that the graph may contain multi-edges: a pair (x,y) may appear in multiple triangles. It is guaranteed that the sum of n over all test cases does not exceed 10^6 and the sum of m over all test cases does '...

Tutorials

Editorial of Codeforces Round #865

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
201599238 JohnVictor F April 10, 2023, 12:21 a.m. OK GNU C++14 TESTS 143 3665 183296000 3500
201578121 UNIXBAS F April 9, 2023, 7:11 p.m. OK GNU C++17 TESTS 143 920 133529600 3500
201617956 usacoiron F April 10, 2023, 5:47 a.m. OK GNU C++17 TESTS 143 1029 204492800 3500
201568206 BehruzbekRahimboyev F April 9, 2023, 5:48 p.m. OK GNU C++17 TESTS 143 1326 55705600 3500
201576430 rainboy F April 9, 2023, 6:55 p.m. OK GNU C++17 (64) TESTS 143 1310 53760000 3500
201585873 A_G F April 9, 2023, 8:36 p.m. OK GNU C++20 (64) TESTS 143 717 56832000 3500
201597315 ahmed.gamal007 F April 9, 2023, 11:38 p.m. OK GNU C++20 (64) TESTS 143 1169 70553600 3500
201569831 Aaeria F April 9, 2023, 5:58 p.m. OK GNU C++20 (64) TESTS 143 1404 181350400 3500
201558612 jiangly F April 9, 2023, 4:49 p.m. OK GNU C++20 (64) TESTS 143 1419 70553600 3500
201561386 maroonrk F April 9, 2023, 4:56 p.m. OK GNU C++20 (64) TESTS 143 1715 95436800 3500
201566757 -0.5 F April 9, 2023, 5:41 p.m. OK GNU C++20 (64) TESTS 143 2495 195788800 3500
201567730 -0.5 F April 9, 2023, 5:45 p.m. OK GNU C++20 (64) TESTS 143 2511 200601600 3500
201568243 Ormlis F April 9, 2023, 5:48 p.m. OK GNU C++20 (64) TESTS 143 2886 108236800 3500
201611263 RiuMaster F April 10, 2023, 4:10 a.m. OK GNU C++20 (64) TESTS 143 3025 146022400 3500
201613897 Hritik12 F April 10, 2023, 4:50 a.m. OK GNU C++20 (64) TESTS 143 3197 146022400 3500

remove filters

Back to search problems