Codeforces Round 1079 (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
2196 Codeforces Round 1079 (Div. 1) FINISHED False 10800 5585123 Feb. 11, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 97 ) F Indivisible PROGRAMMING constructive algorithms graphs

You are given two numbers (n) and (m). An undirected graph is called beautiful if it satisfies the following conditions: It has no loops or multiple edges. It has exactly (n) vertices and (m) edges. Its vertices cannot be divided into (2) sets such that the sums of the degrees of all vertices in the first set and the sums of the degrees of all vertices in the second set are equal. You need to either report that a beautiful undirected graph with the given (n, m) does not exist, or provide one. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The only line of each test case contains two integers (n, m) ((12 \leq n \leq 10^5, 1 \leq m \leq \min(2 \cdot 10^5, \frac{n(n-1)}{2}))) — the number of vertices and edges in the graph. It is guaranteed that the sum of (n) across all test cases does not exceed (10^5), and the sum of (m) across all test cases does not exceed (2 \cdot 10^5). For each test case, output "No" if such a graph does not exist. Otherwise, output "Yes" , and then, in the following (m) lines — the edges of the beautiful graph in arbitrary order. If there are multiple answers, you may output any of them. In the first test case, the graph is a simple cycle of (7) vertices. The degrees of the vertices are (\{2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0\}). It is easy to see that in such a graph, it is impossible to divide the vertices into (2) parts with equal sums of degrees. In the second test case, since (m = 1), it is easy to see that the vertices can always be divided into (2) parts with equal sums of degrees. Therefore, no solution exists.

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
362538510 tourist F Feb. 11, 2026, 7:03 p.m. OK C++20 (GCC 13-64) TESTS 92 562 48128000
362537146 tourist F Feb. 11, 2026, 6:53 p.m. OK C++20 (GCC 13-64) TESTS 92 593 48128000
362578898 veyis_112 F Feb. 12, 2026, 5:56 a.m. OK C++20 (GCC 13-64) TESTS 92 656 48128000
362537224 tourist F Feb. 11, 2026, 6:54 p.m. OK C++20 (GCC 13-64) TESTS 92 734 48128000
362561121 A_G F Feb. 12, 2026, 1:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 92 78 102400
362557526 CasseShimada F Feb. 11, 2026, 11:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 93 512000
362523872 Dalek_of_Rivia F Feb. 11, 2026, 5:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 93 5632000
362535887 VivaciousAubergine F Feb. 11, 2026, 6:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 359 4915200
362557853 hungchi17 F Feb. 11, 2026, 11:53 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 625 48230400
362543697 kevinxiehk F Feb. 11, 2026, 7:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 687 77926400
362557726 hungchi17 F Feb. 11, 2026, 11:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 734 48230400
362534778 VivaciousAubergine F Feb. 11, 2026, 6:37 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 890 4915200
362535345 VivaciousAubergine F Feb. 11, 2026, 6:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 984 4915200
362521122 VivaciousAubergine F Feb. 11, 2026, 5:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 92 1046 204800
362569006 DP_Once F Feb. 12, 2026, 3:56 a.m. OK Java 8 TESTS 92 156 4505600

remove filters

Back to search problems