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'You are given a sequence of n positive integers d1, xe2 x80 x89d2, xe2 x80 x89..., xe2 x80 x89dn (d1 xe2 x80 x89< xe2 x80 x89d2 xe2 x80 x89< xe2 x80 x89... xe2 x80 x89< xe2 x80 x89dn). Your task is to construct an undirected graph such that: Vertices should be numbered 1 through (dn xe2 x80 x89+ xe2 x80 x891). Degree sequence is an array a with length equal to the number of vertices in a graph such that ai is the number of vertices adjacent to i-th vertex. Degree set is a sorted in increasing order sequence of all distinct values from the degree sequence. It is guaranteed that there exists such a graph that all the conditions hold, and it contains no more than 106 edges. Print the resulting graph. The first line contains one integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89300) -- the size of the degree set. The second line contains n integers d1, xe2 x80 x89d2, xe2 x80 x89..., xe2 x80 x89dn (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89di xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891000, d1 xe2 x80 x89< xe2 x80 x89d2 xe2 x80 x89< xe2 x80 x89... xe2 x80 x89< xe2 x80 x89dn) -- the degree set. In the first line print one integer m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106) -- the number of edges in the resulting graph. It is guaranteed that there exists such a graph that all the conditions hold and it contains no more than 106 edges. Each of the next m lines should contain two integers vi and ui (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89vi, xe2 x80 x89ui xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89dn xe2 x80 x89+ xe2 x80 x891) -- the description of the i-th edge. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
57555926 |
spiderbatman |
D |
July 22, 2019, 7:43 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
20 |
405 |
13209600 |
|
2400 |
38103992 |
agibson |
D |
May 11, 2018, 2:30 a.m. |
OK |
D |
TESTS |
20 |
327 |
16179200 |
|
2400 |
37840833 |
OrangeLee |
D |
May 2, 2018, 1:03 p.m. |
OK |
GNU C++ |
TESTS |
20 |
46 |
9830400 |
|
2400 |
37925513 |
fxt |
D |
May 6, 2018, 10:02 a.m. |
OK |
GNU C++ |
TESTS |
20 |
124 |
3481600 |
|
2400 |
37907205 |
vjudge2 |
D |
May 5, 2018, 1:16 p.m. |
OK |
GNU C++ |
TESTS |
20 |
124 |
7782400 |
|
2400 |
38060797 |
vjudge4 |
D |
May 9, 2018, 4:53 a.m. |
OK |
GNU C++ |
TESTS |
20 |
124 |
9113600 |
|
2400 |
37846016 |
force123 |
D |
May 2, 2018, 5:03 p.m. |
OK |
GNU C++ |
TESTS |
20 |
139 |
7782400 |
|
2400 |
37875123 |
170104100115 |
D |
May 4, 2018, 5:04 a.m. |
OK |
GNU C++ |
TESTS |
20 |
139 |
9113600 |
|
2400 |
37789265 |
caoyang1123 |
D |
May 1, 2018, 5:49 a.m. |
OK |
GNU C++ |
TESTS |
19 |
139 |
9830400 |
|
2400 |
37831492 |
bestFy |
D |
May 2, 2018, 5:29 a.m. |
OK |
GNU C++ |
TESTS |
20 |
139 |
11571200 |
|
2400 |
37787113 |
nansns |
D |
May 1, 2018, 3:50 a.m. |
OK |
GNU C++ |
TESTS |
19 |
139 |
11571200 |
|
2400 |
37777378 |
__stdcall |
D |
April 30, 2018, 5:13 p.m. |
OK |
GNU C++ |
TESTS |
19 |
139 |
13926400 |
|
2400 |
55314893 |
rainboy |
D |
June 8, 2019, 8:40 p.m. |
OK |
GNU C11 |
TESTS |
20 |
1699 |
7987200 |
|
2400 |
38082783 |
Kananix |
D |
May 10, 2018, 1:17 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
46 |
9830400 |
|
2400 |
40932286 |
ReaLNero1 |
D |
July 30, 2018, 1:42 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
46 |
11980800 |
|
2400 |
37828899 |
yukuai26 |
D |
May 2, 2018, 2:22 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
46 |
15564800 |
|
2400 |
37833584 |
yasugongshang |
D |
May 2, 2018, 7:53 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
77 |
9830400 |
|
2400 |
51248962 |
Jessie01 |
D |
March 13, 2019, 7:20 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
109 |
12083200 |
|
2400 |
69425952 |
He_Ren |
D |
Jan. 23, 2020, 3:48 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
124 |
3891200 |
|
2400 |
57869874 |
lopare |
D |
July 28, 2019, 12:45 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
124 |
4096000 |
|
2400 |
37791744 |
KMAASZRAA |
D |
May 1, 2018, 7:42 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
124 |
4505600 |
|
2400 |
52156910 |
xielinhan |
D |
April 1, 2019, 1:44 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
124 |
5529600 |
|
2400 |
64506878 |
qinding |
D |
Nov. 8, 2019, 7:15 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
124 |
5529600 |
|
2400 |
37787047 |
Marco_L_T |
D |
May 1, 2018, 3:45 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
62 |
12800000 |
|
2400 |
56012614 |
LanaDelRey |
D |
June 24, 2019, 6:58 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
93 |
6348800 |
|
2400 |
61800732 |
dnpshuser |
D |
Oct. 3, 2019, 6:52 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
93 |
16076800 |
|
2400 |
37778478 |
upobir |
D |
April 30, 2018, 5:49 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
108 |
3379200 |
|
2400 |
37839333 |
destinys |
D |
May 2, 2018, 12:14 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
108 |
7475200 |
|
2400 |
37792147 |
yzyyylx |
D |
May 1, 2018, 7:59 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
108 |
8908800 |
|
2400 |
37996584 |
Radon12 |
D |
May 7, 2018, 1:26 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
108 |
9728000 |
|
2400 |
38095057 |
bibibibi |
D |
May 10, 2018, 3:10 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
108 |
9728000 |
|
2400 |
37820259 |
Cmise |
D |
May 1, 2018, 4:23 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
108 |
9728000 |
|
2400 |
37820106 |
walht |
D |
May 1, 2018, 4:11 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
108 |
9728000 |
|
2400 |
41002784 |
CrazyDave |
D |
July 31, 2018, 8:01 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
93 |
16998400 |
|
2400 |
48598429 |
vjudge4 |
D |
Jan. 20, 2019, 7:15 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
3379200 |
|
2400 |
51257234 |
JiangYutong |
D |
March 13, 2019, 11:50 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
4096000 |
|
2400 |
64506871 |
luogu_bot4 |
D |
Nov. 8, 2019, 7:15 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
5632000 |
|
2400 |
53458945 |
Mohammad_Yasser |
D |
April 28, 2019, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
6348800 |
|
2400 |
51408874 |
vjudge1 |
D |
March 17, 2019, 11:10 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
6451200 |
|
2400 |
40399360 |
zhysora |
D |
July 16, 2018, 6:55 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
108 |
8192000 |
|
2400 |
37793780 |
fsociety00 |
D |
May 1, 2018, 9:30 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
108 |
9728000 |
|
2400 |
37786798 |
tusikalanse |
D |
May 1, 2018, 3:29 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
108 |
9728000 |
|
2400 |
37773710 |
Megumi_ |
D |
April 30, 2018, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
108 |
9728000 |
|
2400 |
55314894 |
Dukkha |
D |
June 8, 2019, 8:40 p.m. |
OK |
Java 8 |
TESTS |
20 |
202 |
3072000 |
|
2400 |
37802496 |
Aemon |
D |
May 1, 2018, 2:13 p.m. |
OK |
Java 8 |
TESTS |
20 |
217 |
37785600 |
|
2400 |
59243008 |
aakashjaiswal |
D |
Aug. 21, 2019, 8:53 p.m. |
OK |
Java 8 |
TESTS |
20 |
233 |
15872000 |
|
2400 |
37762494 |
uwi |
D |
April 30, 2018, 3:29 p.m. |
OK |
Java 8 |
TESTS |
19 |
265 |
39526400 |
|
2400 |
37790496 |
realDonaldTrunp |
D |
May 1, 2018, 6:48 a.m. |
OK |
Java 8 |
TESTS |
19 |
280 |
39526400 |
|
2400 |
42837942 |
PrakharJain |
D |
Sept. 13, 2018, 4:47 p.m. |
OK |
Java 8 |
TESTS |
20 |
311 |
10854400 |
|
2400 |
38056852 |
OMGTallMonster |
D |
May 8, 2018, 11:51 p.m. |
OK |
Java 8 |
TESTS |
20 |
358 |
22323200 |
|
2400 |
38197125 |
baobab |
D |
May 13, 2018, 4:52 p.m. |
OK |
Java 8 |
TESTS |
20 |
358 |
43827200 |
|
2400 |
37795819 |
tanzaku |
D |
May 1, 2018, 10:53 a.m. |
OK |
Java 8 |
TESTS |
20 |
389 |
36556800 |
|
2400 |
37794945 |
tanzaku |
D |
May 1, 2018, 10:18 a.m. |
OK |
Java 8 |
TESTS |
20 |
405 |
36556800 |
|
2400 |
38151045 |
achudov89 |
D |
May 13, 2018, 2:45 a.m. |
OK |
MS C++ |
TESTS |
20 |
1668 |
13414400 |
|
2400 |
37858575 |
neverwin |
D |
May 3, 2018, 10:06 a.m. |
OK |
PyPy 3 |
TESTS |
20 |
764 |
45465600 |
|
2400 |
37843258 |
neverwin |
D |
May 2, 2018, 2:44 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
904 |
63692800 |
|
2400 |
38632816 |
belkka |
D |
May 26, 2018, 12:02 p.m. |
OK |
Python 3 |
TESTS |
20 |
499 |
53248000 |
|
2400 |
55852337 |
linkRs |
D |
June 21, 2019, 4:50 a.m. |
OK |
Python 3 |
TESTS |
20 |
1091 |
36044800 |
|
2400 |
37913685 |
kichi |
D |
May 5, 2018, 7:28 p.m. |
OK |
Rust |
TESTS |
20 |
77 |
9216000 |
|
2400 |
remove filters
Back to search problems