Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022

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
1726 Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 FINISHED False 8100 81617093 Sept. 6, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3859 ) D Edge Split PROGRAMMING brute force constructive algorithms dfs and similar graphs probabilities trees

B"You are given a connected, undirected and unweighted graph with n vertices and m edges. Notice the limit on the number of edges: m <= n + 2 . Let's say we color some of the edges red and the remaining edges blue. Now consider only the red edges and count the number of connected components in the graph. Let this value be c_1 . Similarly, consider only the blue edges and count the number of connected components in the graph. Let this value be c_2 . Find an assignment of colors to the edges such that the quantity c_1+c_2 is minimised. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. Description of the test cases follows. The first line of each test case contains two integers n and m ( 2 <= n <= 2 cdot 10^5 ; n-1 <= q m <= q min{ <= ft(n+2, frac{n cdot (n-1)}{2} right)} ) -- the number of vertices and the number of edges respectively. m lines follow. The i -th line contains two integers u_i and v_i ( 1 <= u_i,v_i <= n , u_i ne v_i ) denoting that the i -th edge goes between vertices u_i and v_i . The input is guaranteed to have no multiple edges or self loops. The graph is also guaranteed to be connected. It is guaranteed that the sum of n over all test cases does not exceed 10^6 . It is guaranteed that the sum of m over all test cases does not exceed 2 cdot 10^6 . For each test case, output a binary string of length m . The i -th character of the string should be 1 if the i -th edge should be colored red, and 0 if it should be colored blue. If there are multiple ways to assign colors to edges that give the minimum answer, you may output any. c_1 + c_2 = 1 + 2 = 3 c_1 + c_2 = 2 + 2 = 4 "...

Tutorials

Codeforces Round #819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
171180906 chdyFZH D Sept. 7, 2022, 12:34 a.m. OK GNU C++14 TESTS 74 156 12288000
171148902 Viiiiictor D Sept. 6, 2022, 4:46 p.m. OK GNU C++14 TESTS 73 233 15155200
171181688 wumeibanfa D Sept. 7, 2022, 12:54 a.m. OK GNU C++14 TESTS 74 468 31948800
171186335 yqaqaqy D Sept. 7, 2022, 2:38 a.m. OK GNU C++14 TESTS 76 483 19251200
171145282 HakuroKawashiro D Sept. 6, 2022, 4:37 p.m. OK GNU C++14 TESTS 73 499 3379200
171181659 JoesSR D Sept. 7, 2022, 12:53 a.m. OK GNU C++14 TESTS 74 499 52633600
171150245 CK2021 D Sept. 6, 2022, 4:48 p.m. OK GNU C++14 TESTS 73 499 100249600
171180924 QQH D Sept. 7, 2022, 12:35 a.m. OK GNU C++14 TESTS 74 514 14950400
171142519 Physics07 D Sept. 6, 2022, 4:30 p.m. OK GNU C++14 TESTS 73 530 3993600
171162846 anhng D Sept. 6, 2022, 6:50 p.m. OK GNU C++14 TESTS 73 530 6246400
171147236 SwordFlame D Sept. 6, 2022, 4:42 p.m. OK GNU C++17 TESTS 73 202 11264000
171187337 dargoncat D Sept. 7, 2022, 3 a.m. OK GNU C++17 TESTS 76 436 8089600
171195402 Chichoo D Sept. 7, 2022, 5:32 a.m. OK GNU C++17 TESTS 76 483 24576000
171190253 LiAnG24 D Sept. 7, 2022, 4:01 a.m. OK GNU C++17 TESTS 76 483 29900800
171146656 punitg8 D Sept. 6, 2022, 4:40 p.m. OK GNU C++17 TESTS 73 483 32768000
171156417 cxk_jr D Sept. 6, 2022, 5:58 p.m. OK GNU C++17 TESTS 73 498 11161600
171148218 hututu-7 D Sept. 6, 2022, 4:44 p.m. OK GNU C++17 TESTS 73 499 4096000
171182492 lizh1 D Sept. 7, 2022, 1:12 a.m. OK GNU C++17 TESTS 74 499 14233600
171163844 thunopro D Sept. 6, 2022, 7 p.m. OK GNU C++17 TESTS 73 499 17817600
171147800 m_patel D Sept. 6, 2022, 4:43 p.m. OK GNU C++17 TESTS 73 514 5427200
171168975 bashkort D Sept. 6, 2022, 8:02 p.m. OK GNU C++17 (64) TESTS 74 109 5836800
171169089 bashkort D Sept. 6, 2022, 8:04 p.m. OK GNU C++17 (64) TESTS 74 124 5836800
171169072 bashkort D Sept. 6, 2022, 8:04 p.m. OK GNU C++17 (64) TESTS 74 124 5836800
171168994 bashkort D Sept. 6, 2022, 8:03 p.m. OK GNU C++17 (64) TESTS 74 124 5836800
171150808 BoaHancock D Sept. 6, 2022, 4:49 p.m. OK GNU C++17 (64) TESTS 73 187 21299200
171182030 yaoveil D Sept. 7, 2022, 1:01 a.m. OK GNU C++17 (64) TESTS 74 327 3379200
171182584 yaoveil D Sept. 7, 2022, 1:15 a.m. OK GNU C++17 (64) TESTS 74 358 5222400
171168803 bashkort D Sept. 6, 2022, 8 p.m. OK GNU C++17 (64) TESTS 74 358 5836800
171168779 bashkort D Sept. 6, 2022, 8 p.m. OK GNU C++17 (64) TESTS 74 358 5836800
171168556 bashkort D Sept. 6, 2022, 7:57 p.m. OK GNU C++17 (64) TESTS 74 358 5836800
171155208 huangxiaohua D Sept. 6, 2022, 5:51 p.m. OK GNU C++20 (64) TESTS 73 124 59084800
171196738 jianguolinyun D Sept. 7, 2022, 5:52 a.m. OK GNU C++20 (64) TESTS 76 140 79257600
171158837 N_z_ D Sept. 6, 2022, 6:16 p.m. OK GNU C++20 (64) TESTS 73 202 7475200
171174639 TooNewbie D Sept. 6, 2022, 9:50 p.m. OK GNU C++20 (64) TESTS 74 265 31232000
171155007 kaiboy D Sept. 6, 2022, 5:50 p.m. OK GNU C++20 (64) TESTS 73 280 6656000
171175752 NintsiChkhaidze D Sept. 6, 2022, 10:17 p.m. OK GNU C++20 (64) TESTS 74 311 11776000
171147620 dayuanx D Sept. 6, 2022, 4:42 p.m. OK GNU C++20 (64) TESTS 73 327 2662400
171149748 _dlbm17 D Sept. 6, 2022, 4:47 p.m. OK GNU C++20 (64) TESTS 73 327 3379200
171165127 IsaacMoris D Sept. 6, 2022, 7:14 p.m. OK GNU C++20 (64) TESTS 73 327 3686400
171163809 jeroenodb D Sept. 6, 2022, 6:59 p.m. OK GNU C++20 (64) TESTS 73 327 5836800
171145693 profchi D Sept. 6, 2022, 4:38 p.m. OK Java 11 TESTS 73 1419 5017600
171160442 Dukkha D Sept. 6, 2022, 6:29 p.m. OK Java 17 TESTS 73 561 9523200
171174886 Mamimi D Sept. 6, 2022, 9:56 p.m. OK Java 17 TESTS 74 1981 104857600
171161359 serndipty_ D Sept. 6, 2022, 6:36 p.m. OK Java 8 TESTS 73 1154 0
171147518 fetetriste D Sept. 6, 2022, 4:42 p.m. OK Java 8 TESTS 73 1357 2969600
171157498 invincible777 D Sept. 6, 2022, 6:06 p.m. OK Java 8 TESTS 73 1466 32460800
171179075 Omar_Mohammad D Sept. 6, 2022, 11:45 p.m. OK Java 8 TESTS 74 1840 56934400
171154612 stgatilov D Sept. 6, 2022, 5:48 p.m. OK MS C++ 2017 TESTS 73 1045 18022400
171170065 plevande D Sept. 6, 2022, 8:19 p.m. OK PyPy 3 TESTS 74 1497 46796800
171181687 Young_Sean D Sept. 7, 2022, 12:54 a.m. OK PyPy 3-64 TESTS 74 904 116633600
171146642 SophieHatter D Sept. 6, 2022, 4:40 p.m. OK PyPy 3-64 TESTS 73 1294 76595200
171192211 Young_Sean D Sept. 7, 2022, 4:39 a.m. OK PyPy 3-64 TESTS 76 1606 227328000
171193188 Young_Sean D Sept. 7, 2022, 4:56 a.m. OK PyPy 3-64 TESTS 76 1637 226304000
171155813 toam D Sept. 6, 2022, 5:54 p.m. OK PyPy 3-64 TESTS 73 1762 61849600
171192079 Young_Sean D Sept. 7, 2022, 4:37 a.m. OK PyPy 3-64 TESTS 76 1778 226816000
171189126 huikang D Sept. 7, 2022, 3:39 a.m. OK PyPy 3-64 TESTS 76 1856 77414400
171183777 Young_Sean D Sept. 7, 2022, 1:42 a.m. OK PyPy 3-64 TESTS 74 1903 170393600
171192513 ahmedsiad D Sept. 7, 2022, 4:44 a.m. OK PyPy 3-64 TESTS 76 1996 159948800
171161404 xttt D Sept. 6, 2022, 6:37 p.m. OK Rust 2021 TESTS 73 156 4812800
171157241 sansen D Sept. 6, 2022, 6:04 p.m. OK Rust 2021 TESTS 73 171 26316800
171159320 sansen D Sept. 6, 2022, 6:20 p.m. OK Rust 2021 TESTS 73 218 26316800
171145497 kena0ki D Sept. 6, 2022, 4:37 p.m. OK Rust 2021 TESTS 73 451 12492800
171143195 LittleFall D Sept. 6, 2022, 4:31 p.m. OK Rust 2021 TESTS 73 561 29798400
171145399 robostac D Sept. 6, 2022, 4:37 p.m. OK Rust 2021 TESTS 73 1060 222003200
171144956 katand D Sept. 6, 2022, 4:36 p.m. OK Rust 2021 TESTS 73 1294 57344000

remove filters

Back to search problems