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"Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of wires into one network (a wire directly connects two nodes). Exactly k of the nodes should be exit-nodes, that means that each of them should be connected to exactly one other node of the network, while all other nodes should be connected to at least two nodes in order to increase the system stability. Arkady wants to make the system as fast as possible, so he wants to minimize the maximum distance between two exit-nodes. The distance between two nodes is the number of wires a package needs to go through between those two nodes. Help Arkady to find such a way to build the network that the distance between the two most distant exit-nodes is as small as possible. The first line contains two integers n and k (3 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892 xc2 xb7105, 2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89- xe2 x80 x891) -- the total number of nodes and the number of exit-nodes. Note that it is always possible to build at least one network with n nodes and k exit-nodes within the given constraints. In the first line print the minimum possible distance between the two most distant exit-nodes. In each of the next n xe2 x80 x89- xe2 x80 x891 lines print two integers: the ids of the nodes connected by a wire. The description of each wire should be printed exactly once. You can print wires and wires' ends in arbitrary order. The nodes should be numbered from 1 to n. Exit-nodes can have any ids. If there are multiple answers, print any of them. In the first example the only network is shown on the left picture. In the second example one of optimal networks is shown on the right picture. Exit-nodes are highlighted. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
51807550 |
rr_ |
B |
March 25, 2019, 12:13 a.m. |
OK |
D |
TESTS |
68 |
109 |
4198400 |
|
1800 |
51807555 |
rr_ |
B |
March 25, 2019, 12:14 a.m. |
OK |
D |
TESTS |
68 |
124 |
4198400 |
|
1800 |
31097548 |
vjudge1 |
B |
Oct. 7, 2017, 2:55 a.m. |
OK |
GNU C |
TESTS |
68 |
78 |
0 |
|
1800 |
28441747 |
tjandra |
B |
July 11, 2017, 5:42 p.m. |
OK |
GNU C |
TESTS |
68 |
78 |
3686400 |
|
1800 |
28585488 |
jkxjkx1031 |
B |
July 16, 2017, 2:56 a.m. |
OK |
GNU C |
TESTS |
68 |
93 |
2662400 |
|
1800 |
28433987 |
1919810 |
B |
July 11, 2017, 4:58 p.m. |
OK |
GNU C++ |
TESTS |
68 |
46 |
2150400 |
|
1800 |
29602302 |
qph-Jeremy |
B |
Aug. 19, 2017, 3:30 p.m. |
OK |
GNU C++ |
TESTS |
68 |
62 |
0 |
|
1800 |
28543512 |
hld67890 |
B |
July 14, 2017, 8:55 a.m. |
OK |
GNU C++ |
TESTS |
68 |
77 |
1945600 |
|
1800 |
28437163 |
Eclipse |
B |
July 11, 2017, 5:14 p.m. |
OK |
GNU C++ |
TESTS |
68 |
77 |
2867200 |
|
1800 |
32184858 |
peehs_moorhsum |
B |
Nov. 10, 2017, 3:19 a.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
0 |
|
1800 |
30969037 |
vjudge5 |
B |
Oct. 3, 2017, 1:48 p.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
0 |
|
1800 |
30968255 |
vjudge2 |
B |
Oct. 3, 2017, 1:18 p.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
0 |
|
1800 |
30957068 |
vjudge2 |
B |
Oct. 3, 2017, 3:44 a.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
0 |
|
1800 |
29536864 |
KrK |
B |
Aug. 17, 2017, 8:31 p.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
0 |
|
1800 |
30288543 |
vjudge1 |
B |
Sept. 12, 2017, 2:19 p.m. |
OK |
GNU C++ |
TESTS |
68 |
78 |
102400 |
|
1800 |
28456387 |
FizzyDavid |
B |
July 12, 2017, 12:25 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
31 |
3686400 |
|
1800 |
65800664 |
Zory |
B |
Nov. 27, 2019, 7:16 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
61 |
7987200 |
|
1800 |
58700953 |
XZ20220135 |
B |
Aug. 13, 2019, 7:48 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
62 |
0 |
|
1800 |
28438836 |
tqyaaaaang |
B |
July 11, 2017, 5:24 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
62 |
3686400 |
|
1800 |
57874029 |
lopare |
B |
July 28, 2019, 4 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
0 |
|
1800 |
46225797 |
kokarev |
B |
Nov. 25, 2018, 6:48 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
0 |
|
1800 |
45309047 |
luogu_bot1 |
B |
Nov. 5, 2018, 1:37 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
0 |
|
1800 |
51265756 |
Gloid |
B |
March 13, 2019, 3:28 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
204800 |
|
1800 |
59080415 |
WsSyx |
B |
Aug. 19, 2019, 8:52 a.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
819200 |
|
1800 |
29132491 |
eliteeliteelite |
B |
Aug. 2, 2017, 2:07 p.m. |
OK |
GNU C++11 |
TESTS |
68 |
77 |
2150400 |
|
1800 |
40980561 |
ReaLNero1 |
B |
July 30, 2018, 5:35 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
31 |
0 |
|
1800 |
28435865 |
Egor.Lifar |
B |
July 11, 2017, 5:07 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
31 |
1945600 |
|
1800 |
49132914 |
wleung_bvg |
B |
Jan. 29, 2019, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
46 |
921600 |
|
1800 |
28444492 |
I_hate_PWN |
B |
July 11, 2017, 6:01 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
46 |
1945600 |
|
1800 |
28438149 |
platypus179 |
B |
July 11, 2017, 5:19 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
46 |
28364800 |
|
1800 |
33825153 |
AayushAC1998 |
B |
Dec. 31, 2017, 5:24 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
61 |
1945600 |
|
1800 |
28444302 |
shadowatyy |
B |
July 11, 2017, 6 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
61 |
2764800 |
|
1800 |
28439959 |
overlord |
B |
July 11, 2017, 5:31 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
61 |
8806400 |
|
1800 |
58144139 |
foreverdiv3 |
B |
Aug. 1, 2019, 7:48 p.m. |
OK |
GNU C++14 |
TESTS |
68 |
62 |
0 |
|
1800 |
47157480 |
3015218054 |
B |
Dec. 17, 2018, 7:47 a.m. |
OK |
GNU C++14 |
TESTS |
68 |
62 |
0 |
|
1800 |
56181541 |
m1sch3f |
B |
June 28, 2019, 12:15 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
61 |
8396800 |
|
1800 |
59078273 |
luogu_bot4 |
B |
Aug. 19, 2019, 8:03 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
62 |
0 |
|
1800 |
48787353 |
Nooby_lol |
B |
Jan. 23, 2019, 9:37 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
62 |
204800 |
|
1800 |
56504049 |
Als123 |
B |
July 4, 2019, 7:38 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
62 |
819200 |
|
1800 |
51779781 |
oToToT |
B |
March 24, 2019, 3:29 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
62 |
5017600 |
|
1800 |
69082021 |
Arpa |
B |
Jan. 19, 2020, 6:49 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
77 |
0 |
|
1800 |
65409982 |
yuhta |
B |
Nov. 20, 2019, 3:27 a.m. |
OK |
GNU C++17 |
TESTS |
68 |
77 |
0 |
|
1800 |
55220481 |
cxsy |
B |
June 6, 2019, 7:15 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
77 |
0 |
|
1800 |
55220435 |
cxsy |
B |
June 6, 2019, 7:13 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
77 |
0 |
|
1800 |
55219811 |
cxsy |
B |
June 6, 2019, 6:51 p.m. |
OK |
GNU C++17 |
TESTS |
68 |
77 |
0 |
|
1800 |
remove filters
Back to search problems