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"Arseny likes to organize parties and invite people to it. However, not only friends come to his parties, but friends of his friends, friends of friends of his friends and so on. That's why some of Arseny's guests can be unknown to him. He decided to fix this issue using the following procedure. At each step he selects one of his guests A, who pairwise introduces all of his friends to each other. After this action any two friends of A become friends. This process is run until all pairs of guests are friends. Arseny doesn't want to spend much time doing it, so he wants to finish this process using the minimum number of steps. Help Arseny to do it. The first line contains two integers n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8922; ) -- the number of guests at the party (including Arseny) and the number of pairs of people which are friends. Each of the next m lines contains two integers u and v (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89u, xe2 x80 x89v xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; u xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89v), which means that people with numbers u and v are friends initially. It's guaranteed that each pair of friends is described not more than once and the graph of friendship is connected. In the first line print the minimum number of steps required to make all pairs of guests friends. In the second line print the ids of guests, who are selected at each step. If there are multiple solutions, you can output any of them. In the first test case there is no guest who is friend of all other guests, so at least two steps are required to perform the task. After second guest pairwise introduces all his friends, only pairs of guests (4, xe2 x80 x891) and (4, xe2 x80 x892) are not friends. Guest 3 or 5 can introduce them. In the second test case guest number 1 is a friend of all guests, so he can pairwise introduce all guests in one step. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
50309566 |
chaorenhaha |
C |
Feb. 22, 2019, 8:31 a.m. |
OK |
FPC |
TESTS |
78 |
795 |
100249600 |
|
2300 |
33556697 |
sgtlaugh |
C |
Dec. 23, 2017, 2:59 p.m. |
OK |
GNU C |
TESTS |
78 |
296 |
18739200 |
|
2300 |
33902009 |
TsReaper |
C |
Jan. 4, 2018, 11:40 a.m. |
OK |
GNU C |
TESTS |
78 |
592 |
18636800 |
|
2300 |
33576726 |
khatribiru |
C |
Dec. 23, 2017, 7:19 p.m. |
OK |
GNU C++ |
TESTS |
78 |
15 |
22118400 |
|
2300 |
35512931 |
vjudge2 |
C |
Feb. 20, 2018, 6:27 a.m. |
OK |
GNU C++ |
TESTS |
78 |
15 |
52531200 |
|
2300 |
33560984 |
Andrew_Makar |
C |
Dec. 23, 2017, 3:19 p.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
27136000 |
|
2300 |
34287473 |
KrK |
C |
Jan. 18, 2018, 10:50 p.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
52531200 |
|
2300 |
35754505 |
lujiaju |
C |
Feb. 27, 2018, 7:38 a.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
52633600 |
|
2300 |
33605532 |
vjudge2 |
C |
Dec. 25, 2017, 1:04 a.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
53555200 |
|
2300 |
33605529 |
Landia |
C |
Dec. 25, 2017, 1:04 a.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
53555200 |
|
2300 |
38770955 |
ILoveFancyRay |
C |
May 30, 2018, 11:36 a.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
54272000 |
|
2300 |
34714265 |
vjudge3 |
C |
Jan. 30, 2018, 3:45 p.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
62156800 |
|
2300 |
34728620 |
vjudge4 |
C |
Jan. 31, 2018, 6:48 a.m. |
OK |
GNU C++ |
TESTS |
78 |
31 |
86016000 |
|
2300 |
33760198 |
yakitori |
C |
Dec. 29, 2017, 1:01 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
15 |
6041600 |
|
2300 |
33644796 |
zadrga |
C |
Dec. 26, 2017, 11:12 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
15 |
18841600 |
|
2300 |
33574397 |
wiwitrifai |
C |
Dec. 23, 2017, 5:38 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
15 |
18841600 |
|
2300 |
33599219 |
Noureldin |
C |
Dec. 24, 2017, 6:38 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
15 |
35737600 |
|
2300 |
33580704 |
memset123 |
C |
Dec. 23, 2017, 11:12 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
15 |
35737600 |
|
2300 |
35456579 |
bill_kondo |
C |
Feb. 18, 2018, 8:28 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
30 |
35737600 |
|
2300 |
33615725 |
txingml |
C |
Dec. 25, 2017, 11:54 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
30 |
39936000 |
|
2300 |
49990180 |
Love_zyd |
C |
Feb. 16, 2019, 12:25 p.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
0 |
|
2300 |
58896055 |
vjudge1 |
C |
Aug. 16, 2019, 7:34 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
16691200 |
|
2300 |
33664924 |
lawyerphx |
C |
Dec. 27, 2017, 9:13 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
35737600 |
|
2300 |
35761090 |
lllllllllllllllllllllll |
C |
Feb. 27, 2018, 12:11 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
1945600 |
|
2300 |
33657655 |
Jubair_2147483647 |
C |
Dec. 26, 2017, 9:24 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
18739200 |
|
2300 |
33577287 |
ec24 |
C |
Dec. 23, 2017, 7:45 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
18739200 |
|
2300 |
33564514 |
mjhun |
C |
Dec. 23, 2017, 3:36 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
18739200 |
|
2300 |
33597620 |
Mezbaur |
C |
Dec. 24, 2017, 4:45 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
18841600 |
|
2300 |
33637320 |
Shivram |
C |
Dec. 26, 2017, 6:06 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
23040000 |
|
2300 |
33637341 |
Shivram |
C |
Dec. 26, 2017, 6:07 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
23142400 |
|
2300 |
34206365 |
sggutier |
C |
Jan. 15, 2018, 8:03 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
35532800 |
|
2300 |
33618114 |
mengrao |
C |
Dec. 25, 2017, 1:35 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
35532800 |
|
2300 |
35511470 |
ztx |
C |
Feb. 20, 2018, 4:51 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
15 |
52326400 |
|
2300 |
49990252 |
vjudge5 |
C |
Feb. 16, 2019, 12:27 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
0 |
|
2300 |
59186670 |
notanymore |
C |
Aug. 20, 2019, 6:52 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
204800 |
|
2300 |
47621880 |
luogu_bot1 |
C |
Dec. 28, 2018, 1:11 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
20070400 |
|
2300 |
57020536 |
congmingyige |
C |
July 14, 2019, 1:50 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
84070400 |
|
2300 |
50083808 |
F.J |
C |
Feb. 18, 2019, 6:15 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
20070400 |
|
2300 |
50082878 |
vjudge4 |
C |
Feb. 18, 2019, 5:39 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
20070400 |
|
2300 |
59884044 |
vjudge1 |
C |
Sept. 2, 2019, 6:52 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
33792000 |
|
2300 |
58892216 |
vjudge3 |
C |
Aug. 16, 2019, 6:08 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57797980 |
vjudge4 |
C |
July 26, 2019, 12:10 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57282187 |
luogu_bot5 |
C |
July 18, 2019, 1:10 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57165133 |
7dan |
C |
July 16, 2019, 9:54 p.m. |
OK |
Java 8 |
TESTS |
78 |
155 |
40857600 |
|
2300 |
33697048 |
JialinOuyang |
C |
Dec. 27, 2017, 10:12 p.m. |
OK |
Java 8 |
TESTS |
78 |
218 |
114073600 |
|
2300 |
33602779 |
Kharouba |
C |
Dec. 25, 2017, 12:02 a.m. |
OK |
Java 8 |
TESTS |
78 |
326 |
20684800 |
|
2300 |
34167070 |
tri |
C |
Jan. 14, 2018, 5:20 a.m. |
OK |
Java 8 |
TESTS |
78 |
608 |
63692800 |
|
2300 |
34211241 |
FriendToDino |
C |
Jan. 16, 2018, 2:44 a.m. |
OK |
Java 8 |
TESTS |
78 |
670 |
172851200 |
|
2300 |
33696488 |
aabdelzaher |
C |
Dec. 27, 2017, 9:25 p.m. |
OK |
Java 8 |
TESTS |
78 |
685 |
20684800 |
|
2300 |
33670439 |
-turo |
C |
Dec. 27, 2017, 1:58 p.m. |
OK |
Java 8 |
TESTS |
78 |
732 |
21094400 |
|
2300 |
34786082 |
wangck1998 |
C |
Feb. 1, 2018, 2:15 a.m. |
OK |
Java 8 |
TESTS |
78 |
733 |
21094400 |
|
2300 |
33651294 |
Aidos |
C |
Dec. 26, 2017, 3:58 p.m. |
OK |
Java 8 |
TESTS |
78 |
873 |
20684800 |
|
2300 |
34061502 |
RCG |
C |
Jan. 10, 2018, 4:01 a.m. |
OK |
MS C++ |
TESTS |
78 |
30 |
20275200 |
|
2300 |
58896717 |
vjudge4 |
C |
Aug. 16, 2019, 7:48 a.m. |
OK |
MS C++ |
TESTS |
78 |
31 |
168140800 |
|
2300 |
57354689 |
vjudge2 |
C |
July 20, 2019, 5:42 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50380800 |
|
2300 |
58889223 |
vjudge2 |
C |
Aug. 16, 2019, 4:26 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57200192 |
vjudge1 |
C |
July 17, 2019, 1:29 p.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57188096 |
vjudge1 |
C |
July 17, 2019, 9:25 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57187035 |
vjudge1 |
C |
July 17, 2019, 9 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57186591 |
vjudge4 |
C |
July 17, 2019, 8:53 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57186489 |
vjudge5 |
C |
July 17, 2019, 8:51 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
57178850 |
vjudge4 |
C |
July 17, 2019, 6:33 a.m. |
OK |
MS C++ |
TESTS |
78 |
46 |
50483200 |
|
2300 |
64487474 |
MotaSanyal |
C |
Nov. 7, 2019, 6:22 p.m. |
OK |
PyPy 3 |
TESTS |
78 |
218 |
36044800 |
|
2300 |
remove filters
Back to search problems