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.
Problems
B'An undirected graph is called k-regular, if the degrees of all its vertices are equal k. An edge of a connected graph is called a bridge, if after removing it the graph is being split into two connected components. Build a connected undirected k-regular graph containing at least one bridge, or else state that such graph doesn 't exist. The single line of the input contains integer k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100) -- the required degree of the vertices of the regular graph. Print "NO" (without quotes), if such graph doesn 't exist. Otherwise, print "YES" in the first line and the description of any suitable graph in the next lines. The description of the made graph must start with numbers n and m -- the number of vertices and edges respectively. Each of the next m lines must contain two integers, a and b (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89a, xe2 x80 x89b xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, a xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89b), that mean that there is an edge connecting the vertices a and b. A graph shouldn 't contain multiple edges and edges that lead from a vertex to itself. A graph must be connected, the degrees of all vertices of the graph must be equal k. At least one edge of the graph must be a bridge. You can print the edges of the graph in any order. You can print the ends of each edge in any order. The constructed graph must contain at most 106 vertices and 106 edges (it is guaranteed that if at least one graph that meets the requirements exists, then there also exists the graph with at most 106 vertices and at most 106 edges). In the sample from the statement there is a suitable graph consisting of two vertices, connected by a single edge.'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
37540569 |
EthanITargaryen |
D |
April 22, 2018, 8:29 p.m. |
OK |
GNU C |
TESTS |
100 |
31 |
3379200 |
|
2000 |
34190048 |
OHCCHO |
D |
Jan. 15, 2018, 6:39 a.m. |
OK |
GNU C++ |
TESTS |
100 |
15 |
2048000 |
|
2000 |
41449407 |
jangjie |
D |
Aug. 11, 2018, 2:48 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40460953 |
vjudge5 |
D |
July 17, 2018, 3:55 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40254027 |
ymz |
D |
July 13, 2018, 7:58 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40253991 |
vjudge3 |
D |
July 13, 2018, 7:56 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40083003 |
vjudge5 |
D |
July 8, 2018, 11:08 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40082946 |
CaptainSlow |
D |
July 8, 2018, 11:07 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40016037 |
vjudge1 |
D |
July 6, 2018, 2:18 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
40016028 |
psc233 |
D |
July 6, 2018, 2:18 a.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
42061133 |
vjudge5 |
D |
Aug. 24, 2018, 5:16 p.m. |
OK |
GNU C++ |
TESTS |
100 |
31 |
0 |
|
2000 |
57291424 |
rainboy |
D |
July 18, 2019, 4:55 p.m. |
OK |
GNU C11 |
TESTS |
100 |
46 |
0 |
|
2000 |
35460501 |
shpsi |
D |
Feb. 19, 2018, 2:26 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
30 |
2048000 |
|
2000 |
57314020 |
skyping |
D |
July 19, 2019, 7:35 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
57300590 |
vjudge4 |
D |
July 18, 2019, 11:01 p.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
56753965 |
rego97 |
D |
July 9, 2019, 1:05 p.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
54875542 |
ShafinKhadem |
D |
May 31, 2019, 11:38 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
53940962 |
Black_Chen |
D |
May 10, 2019, 2:58 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
52472113 |
Prince_Kassad |
D |
April 7, 2019, 7:16 p.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
61978994 |
LEMH |
D |
Oct. 6, 2019, 11:24 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
61979137 |
LEMH |
D |
Oct. 6, 2019, 11:26 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
57885449 |
lopare |
D |
July 28, 2019, 9:39 a.m. |
OK |
GNU C++11 |
TESTS |
100 |
31 |
0 |
|
2000 |
33599122 |
mjguru |
D |
Dec. 24, 2017, 6:31 p.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
1945600 |
|
2000 |
34641571 |
baghead |
D |
Jan. 28, 2018, 6:55 p.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
1945600 |
|
2000 |
34298193 |
0ogway |
D |
Jan. 19, 2018, 9:40 a.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
1945600 |
|
2000 |
35081841 |
Mamaly |
D |
Feb. 9, 2018, 7:40 a.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2048000 |
|
2000 |
35449111 |
iaojnh |
D |
Feb. 18, 2018, 2:50 p.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2048000 |
|
2000 |
34081569 |
drastogi21 |
D |
Jan. 11, 2018, 5:31 a.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2150400 |
|
2000 |
33615706 |
Ancient_Kid |
D |
Dec. 25, 2017, 11:53 a.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2252800 |
|
2000 |
33464528 |
Dsingh_24 |
D |
Dec. 20, 2017, 7:13 p.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2457600 |
|
2000 |
36219064 |
step_by_step |
D |
March 12, 2018, 9:29 a.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
2457600 |
|
2000 |
37252506 |
SYCstudio |
D |
April 12, 2018, 2:01 p.m. |
OK |
GNU C++14 |
TESTS |
100 |
15 |
3379200 |
|
2000 |
39134457 |
Growth |
D |
June 11, 2018, 1:47 a.m. |
OK |
GNU C++17 |
TESTS |
100 |
30 |
0 |
|
2000 |
39045435 |
Shivansh_257 |
D |
June 8, 2018, 12:08 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
30 |
0 |
|
2000 |
59383019 |
viethuy99 |
D |
Aug. 24, 2019, 4:42 a.m. |
OK |
GNU C++17 |
TESTS |
100 |
30 |
614400 |
|
2000 |
64799307 |
dontquit |
D |
Nov. 13, 2019, 2:01 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
69582245 |
sm1ley |
D |
Jan. 26, 2020, 5:51 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
60963619 |
mahsa_m |
D |
Sept. 21, 2019, 6:17 a.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
60868672 |
Mahdi_Shokoufi |
D |
Sept. 19, 2019, 3:15 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
60269883 |
Hypik |
D |
Sept. 8, 2019, 2:59 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
60269733 |
Hypik |
D |
Sept. 8, 2019, 2:55 p.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
60151724 |
noob77777 |
D |
Sept. 6, 2019, 4:27 a.m. |
OK |
GNU C++17 |
TESTS |
100 |
31 |
0 |
|
2000 |
53786694 |
mufaddalnaya |
D |
May 5, 2019, 10:33 a.m. |
OK |
Java 8 |
TESTS |
100 |
124 |
0 |
|
2000 |
42450738 |
Abhinav9297 |
D |
Sept. 4, 2018, 7:51 a.m. |
OK |
Java 8 |
TESTS |
100 |
124 |
0 |
|
2000 |
57291423 |
Dukkha |
D |
July 18, 2019, 4:55 p.m. |
OK |
Java 8 |
TESTS |
100 |
140 |
0 |
|
2000 |
48655372 |
Hoda_Hisham |
D |
Jan. 21, 2019, 2:13 a.m. |
OK |
Java 8 |
TESTS |
100 |
140 |
0 |
|
2000 |
36142045 |
Codeforce_123 |
D |
March 10, 2018, 7:41 a.m. |
OK |
Java 8 |
TESTS |
100 |
140 |
20684800 |
|
2000 |
54998397 |
alphacarrot |
D |
June 3, 2019, 2:13 a.m. |
OK |
Java 8 |
TESTS |
100 |
155 |
0 |
|
2000 |
54998351 |
alphacarrot |
D |
June 3, 2019, 2:11 a.m. |
OK |
Java 8 |
TESTS |
100 |
155 |
0 |
|
2000 |
39323833 |
dipankar12 |
D |
June 17, 2018, 3:39 a.m. |
OK |
Java 8 |
TESTS |
100 |
155 |
0 |
|
2000 |
34529582 |
jwozniak |
D |
Jan. 24, 2018, 9:24 p.m. |
OK |
Java 8 |
TESTS |
100 |
155 |
21094400 |
|
2000 |
42409817 |
rajatjain |
D |
Sept. 2, 2018, 11:16 p.m. |
OK |
Java 8 |
TESTS |
100 |
170 |
0 |
|
2000 |
41076415 |
vjudge4 |
D |
Aug. 1, 2018, 8:34 a.m. |
OK |
MS C++ |
TESTS |
100 |
31 |
307200 |
|
2000 |
63982919 |
vjudge3 |
D |
Nov. 1, 2019, 10:53 a.m. |
OK |
MS C++ |
TESTS |
100 |
31 |
409600 |
|
2000 |
61631590 |
CtrlAlt |
D |
Oct. 1, 2019, 3:08 p.m. |
OK |
MS C++ 2017 |
TESTS |
100 |
46 |
204800 |
|
2000 |
58902033 |
Sevlll |
D |
Aug. 16, 2019, 9:34 a.m. |
OK |
PyPy 3 |
TESTS |
100 |
202 |
7987200 |
|
2000 |
58880022 |
Sevlll |
D |
Aug. 15, 2019, 8:16 p.m. |
OK |
PyPy 3 |
TESTS |
100 |
202 |
7987200 |
|
2000 |
66020001 |
augurar |
D |
Nov. 30, 2019, 7:01 a.m. |
OK |
PyPy 3 |
TESTS |
100 |
358 |
10035200 |
|
2000 |
35887552 |
______u______ |
D |
March 3, 2018, 2:06 p.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35887544 |
______n______ |
D |
March 3, 2018, 2:06 p.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35887142 |
_____k_____ |
D |
March 3, 2018, 1:59 p.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35886184 |
_____i_____ |
D |
March 3, 2018, 1:42 p.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35875328 |
______h______ |
D |
March 3, 2018, 8:15 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35875091 |
______k______ |
D |
March 3, 2018, 8:08 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35874626 |
______i______ |
D |
March 3, 2018, 7:57 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
35872974 |
______M______ |
D |
March 3, 2018, 7:22 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
34272389 |
ytz123 |
D |
Jan. 18, 2018, 9:49 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
33860349 |
bastin |
D |
Jan. 2, 2018, 8:48 a.m. |
OK |
Python 2 |
TESTS |
100 |
62 |
4608000 |
|
2000 |
67048609 |
NocturneBflat |
D |
Dec. 17, 2019, 1:55 a.m. |
OK |
Python 3 |
TESTS |
100 |
124 |
1945600 |
|
2000 |
53490385 |
LeiviniaBirdway |
D |
April 29, 2019, 8:11 a.m. |
OK |
Python 3 |
TESTS |
100 |
171 |
614400 |
|
2000 |
remove filters
Back to search problems