Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2)

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
2127 Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) FINISHED False 10800 21828323 Aug. 7, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 565 ) H 23 Rises Again PROGRAMMING brute force data structures dfs and similar dp flows graphs implementation probabilities trees

Kiarash is picking strawberries to take home... A graph is called candy if and only if the degree of every vertex in it is at most (2). You are given a simple, undirected, and connected graph (G) of (n\le 30) vertices, with a special property: each vertex belongs to at most (5) simple cycles(^{\text{∗}}) . What is the maximum number of edges among all subgraphs(^{\text{†}}) of (G) that are candy ? (^{\text{∗}})A simple cycle is a connected subgraph such that each vertex has a degree of exactly (2) (^{\text{†}})A subgraph of (G) is a graph whose vertices and edges are subsets of (G). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 50)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((3 \leq n \leq 30), (n-1 \leq m \leq \frac{n(n-1)}{2})) — the number of vertices and the number of edges. Then (m) lines follow, the (i)-th line containing two integers (u) and (v) ((1 \leq u, v \leq n)) — the two vertices that the (i)-th edge connects. It is guaranteed that the given graph is simple and connected, and each vertex belongs to at most (5) simple cycles. It is guaranteed that the sum of (n^2) over all test cases does not exceed (900). For each test case, output a single integer — the maximum number of edges among all subgraphs that are candy graphs . In the first test case, you can select the edges marked in the image below. On the other hand, you can't select all the edges because the degree of vertex (3) would exceed (2). So the maximum number of edges among all subgraphs that are candy is (3). In the second test case, you can select the edges marked in the image below. It can be proven that any subgraph that is candy has at most (7) edges. In the third test case, the image below shows one of the subgraphs with the maxim

Tutorials

Atto Round 1 (Codeforces Round 1041, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
332959024 Laxia_von_Roswell H Aug. 8, 2025, 5:53 a.m. OK C++17 (GCC 7-32) TESTS 76 62 0
332958914 nikolapesic2802 H Aug. 8, 2025, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 76 62 102400
332954166 fy_23forever H Aug. 8, 2025, 5 a.m. OK C++17 (GCC 7-32) TESTS 76 62 102400
332937455 zhlzt H Aug. 8, 2025, 1:12 a.m. OK C++17 (GCC 7-32) TESTS 76 62 102400
332921941 rifat49 H Aug. 7, 2025, 7:44 p.m. OK C++17 (GCC 7-32) TESTS 76 62 512000
332925693 sheijiashaer H Aug. 7, 2025, 8:31 p.m. OK C++17 (GCC 7-32) TESTS 76 77 102400
332907273 CodingEncoded H Aug. 7, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 76 93 102400
332942133 cjsyc H Aug. 8, 2025, 2:26 a.m. OK C++17 (GCC 7-32) TESTS 76 108 102400
332913615 hos.lyric H Aug. 7, 2025, 6:32 p.m. OK C++17 (GCC 7-32) TESTS 76 108 102400
332898118 ComPhyPark H Aug. 7, 2025, 5:13 p.m. OK C++17 (GCC 7-32) TESTS 76 421 102400
332937864 PandaBlack H Aug. 8, 2025, 1:19 a.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332935314 hitonanode H Aug. 8, 2025, 12:32 a.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332928467 OG_Matveychick1 H Aug. 7, 2025, 9:19 p.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332928441 OG_Matveychick1 H Aug. 7, 2025, 9:19 p.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332928403 OG_Matveychick1 H Aug. 7, 2025, 9:18 p.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332928367 OG_Matveychick1 H Aug. 7, 2025, 9:17 p.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332906661 LeoPro H Aug. 7, 2025, 5:34 p.m. OK C++20 (GCC 13-64) TESTS 76 62 102400
332919613 qiuzx H Aug. 7, 2025, 7:19 p.m. OK C++20 (GCC 13-64) TESTS 76 62 7372800
332928556 OG_Matveychick1 H Aug. 7, 2025, 9:21 p.m. OK C++20 (GCC 13-64) TESTS 76 77 102400
332928494 OG_Matveychick1 H Aug. 7, 2025, 9:20 p.m. OK C++20 (GCC 13-64) TESTS 76 77 102400
332949956 TudorrR H Aug. 8, 2025, 4:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332947950 xcx2010 H Aug. 8, 2025, 3:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332947726 xcx2010 H Aug. 8, 2025, 3:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332928351 Qwerty1412 H Aug. 7, 2025, 9:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332920482 quokka H Aug. 7, 2025, 7:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332918282 Proofy H Aug. 7, 2025, 7:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332916072 macaquedev H Aug. 7, 2025, 6:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332913684 rguy23 H Aug. 7, 2025, 6:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 102400
332906761 cdxcdxcdxcdx H Aug. 7, 2025, 5:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 204800
332913673 SudoXue H Aug. 7, 2025, 6:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 76 62 3174400
332924345 Dominion948 H Aug. 7, 2025, 8:13 p.m. OK Go TESTS 76 77 2457600
332934466 bhagvat_gita H Aug. 8, 2025, 12:15 a.m. OK PyPy 3-64 TESTS 76 1327 9932800
332905158 Firetruck_iretr H Aug. 7, 2025, 5:31 p.m. OK Python 3 TESTS 76 233 1228800
332929768 DanielAnker H Aug. 7, 2025, 9:49 p.m. OK Rust 2021 TESTS 76 77 102400
332900579 Sugar_fan H Aug. 7, 2025, 5:20 p.m. OK Rust 2021 TESTS 76 2515 98406400

remove filters

Back to search problems