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 |
| 611
|
Good Bye 2015 |
FINISHED |
False |
10800 |
324917723 |
Dec. 30, 2015, 3:05 p.m. |
Problems
A tree is a connected undirected graph with n - 1 edges, where n denotes the number of vertices. Vertices are numbered 1 through n . Limak is a little polar bear. His bear family prepares a New Year tree every year. One year ago their tree was more awesome than usually. Thus, they decided to prepare the same tree in the next year. Limak was responsible for remembering that tree. It would be hard to remember a whole tree. Limak decided to describe it in his notebook instead. He took a pen and wrote n - 1 lines, each with two integers — indices of two vertices connected by an edge. Now, the New Year is just around the corner and Limak is asked to reconstruct that tree. Of course, there is a problem. He was a very little bear a year ago, and he didn't know digits and the alphabet, so he just replaced each digit with a question mark — the only character he knew. That means, for any vertex index in his notes he knows only the number of digits in it. At least he knows there were no leading zeroes. Limak doesn't want to disappoint everyone. Please, take his notes and reconstruct a New Year tree. Find any tree matching Limak's records and print its edges in any order. It's also possible that Limak made a mistake and there is no suitable tree – in this case print " -1 " (without the quotes). The first line contains a single integer n ( 2 ≤ n ≤ 200 000 ) — the number of vertices. Each of the next n - 1 lines contains two space-separated non-empty strings, both consisting of questions marks only. No string has more characters than the number of digits in n . If there is no tree matching Limak's records, print the only line with " -1 " (without the quotes). Otherwise, describe any tree matching Limak's notes. Print n - 1 lines, each with two space-separated integers – indices of vertices connected by an edge. You can print edges in any order. |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
16723920 |
smallling |
H |
March 15, 2016, 6:25 a.m. |
OK |
GNU C++ |
TESTS |
86 |
62 |
3276800 |
|
3000 |
|
40985456 |
ReaLNero1 |
H |
July 30, 2018, 7:57 p.m. |
OK |
GNU C++ |
TESTS |
86 |
62 |
6041600 |
|
3000 |
|
26712131 |
1919810 |
H |
April 28, 2017, 2:50 a.m. |
OK |
GNU C++ |
TESTS |
86 |
62 |
8089600 |
|
3000 |
|
15152625 |
nhho |
H |
Jan. 1, 2016, 8:03 p.m. |
OK |
GNU C++ |
TESTS |
86 |
108 |
0 |
|
3000 |
|
16437310 |
Raindorous |
H |
March 1, 2016, 7:55 a.m. |
OK |
GNU C++ |
TESTS |
86 |
109 |
1536000 |
|
3000 |
|
16723644 |
smallling |
H |
March 15, 2016, 5:32 a.m. |
OK |
GNU C++ |
TESTS |
86 |
109 |
9728000 |
|
3000 |
|
25657661 |
vjudge1 |
H |
March 20, 2017, 1:22 a.m. |
OK |
GNU C++ |
TESTS |
86 |
155 |
177049600 |
|
3000 |
|
22999427 |
jzymts |
H |
Dec. 15, 2016, 7:10 a.m. |
OK |
GNU C++ |
TESTS |
86 |
156 |
0 |
|
3000 |
|
16736750 |
jcvb |
H |
March 16, 2016, 2:10 a.m. |
OK |
GNU C++ |
TESTS |
86 |
156 |
102400 |
|
3000 |
|
16339818 |
wxy_z |
H |
Feb. 26, 2016, 3:33 a.m. |
OK |
GNU C++ |
TESTS |
86 |
156 |
2457600 |
|
3000 |
|
38985482 |
GuYueNa |
H |
June 6, 2018, 6:36 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
62 |
10444800 |
|
3000 |
|
52160460 |
FlashHu |
H |
April 1, 2019, 3:03 p.m. |
OK |
GNU C++11 |
TESTS |
86 |
93 |
512000 |
|
3000 |
|
65302079 |
142857 |
H |
Nov. 18, 2019, 1:36 p.m. |
OK |
GNU C++11 |
TESTS |
86 |
93 |
1126400 |
|
3000 |
|
69601710 |
vjudge5 |
H |
Jan. 27, 2020, 7:57 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
93 |
16384000 |
|
3000 |
|
52146581 |
Itst |
H |
April 1, 2019, 9:39 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
93 |
16384000 |
|
3000 |
|
52142076 |
iotang |
H |
April 1, 2019, 7:22 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
93 |
165580800 |
|
3000 |
|
53485824 |
Isonan |
H |
April 29, 2019, 3:24 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
109 |
921600 |
|
3000 |
|
27293652 |
FizzyDavid |
H |
May 23, 2017, 3:55 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
109 |
4915200 |
|
3000 |
|
54838751 |
qazswedx2 |
H |
May 30, 2019, 11:55 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
109 |
75980800 |
|
3000 |
|
52151710 |
zzy2005 |
H |
April 1, 2019, 11:51 a.m. |
OK |
GNU C++11 |
TESTS |
86 |
124 |
921600 |
|
3000 |
|
64773780 |
Cyanic |
H |
Nov. 13, 2019, 2:27 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
204800 |
|
3000 |
|
52160081 |
yybyyb |
H |
April 1, 2019, 2:53 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
1638400 |
|
3000 |
|
35961063 |
cyz666 |
H |
March 5, 2018, 9:55 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
2867200 |
|
3000 |
|
68059900 |
cz_xuyixuan |
H |
Jan. 2, 2020, 2:33 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
3993600 |
|
3000 |
|
65815613 |
zhongyuwei |
H |
Nov. 27, 2019, 9:12 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
124 |
4403200 |
|
3000 |
|
64773711 |
Cyanic |
H |
Nov. 13, 2019, 2:23 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
139 |
204800 |
|
3000 |
|
68103221 |
251 |
H |
Jan. 3, 2020, 5:18 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
139 |
16384000 |
|
3000 |
|
68424591 |
wucstdio |
H |
Jan. 9, 2020, 2:07 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
140 |
204800 |
|
3000 |
|
69987925 |
apiadu |
H |
Feb. 1, 2020, 6:23 p.m. |
OK |
GNU C++14 |
TESTS |
86 |
140 |
409600 |
|
3000 |
|
68023370 |
nealchen |
H |
Jan. 1, 2020, 2:45 a.m. |
OK |
GNU C++14 |
TESTS |
86 |
140 |
409600 |
|
3000 |
|
47843618 |
perilla_bot |
H |
Jan. 2, 2019, 1:30 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
46 |
307200 |
|
3000 |
|
66206689 |
HirasawaaYui |
H |
Dec. 3, 2019, 3:39 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
93 |
3481600 |
|
3000 |
|
68066502 |
jiangly |
H |
Jan. 2, 2020, 8:04 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
124 |
204800 |
|
3000 |
|
66528622 |
CMXRYNP |
H |
Dec. 9, 2019, 6:31 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
124 |
204800 |
|
3000 |
|
57862534 |
Benq |
H |
July 27, 2019, 6:38 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
140 |
1740800 |
|
3000 |
|
64751760 |
AprilGrimoire |
H |
Nov. 12, 2019, 3:28 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
140 |
2048000 |
|
3000 |
|
66669533 |
vjudge4 |
H |
Dec. 12, 2019, 8:40 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
140 |
2867200 |
|
3000 |
|
66669439 |
LJZ_C |
H |
Dec. 12, 2019, 8:38 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
140 |
2867200 |
|
3000 |
|
65533189 |
Elegia |
H |
Nov. 22, 2019, 1:12 p.m. |
OK |
GNU C++17 |
TESTS |
86 |
140 |
5222400 |
|
3000 |
|
69446354 |
vjudge2 |
H |
Jan. 24, 2020, 3:16 a.m. |
OK |
GNU C++17 |
TESTS |
86 |
155 |
307200 |
|
3000 |
|
15124904 |
Petr |
H |
Dec. 30, 2015, 5:48 p.m. |
OK |
Java 7 |
TESTS |
86 |
218 |
0 |
|
3000 |
|
16265772 |
antonkov |
H |
Feb. 21, 2016, 6:19 p.m. |
OK |
Java 8 |
TESTS |
86 |
233 |
0 |
|
3000 |
|
15123070 |
Egor |
H |
Dec. 30, 2015, 5:26 p.m. |
OK |
Java 8 |
TESTS |
86 |
264 |
0 |
|
3000 |
|
15583179 |
edorundo |
H |
Jan. 25, 2016, 9:51 p.m. |
OK |
Java 8 |
TESTS |
86 |
265 |
0 |
|
3000 |
|
15583160 |
edorundo |
H |
Jan. 25, 2016, 9:48 p.m. |
OK |
Java 8 |
TESTS |
86 |
265 |
0 |
|
3000 |
|
15130463 |
AlexFetisov |
H |
Dec. 30, 2015, 11:55 p.m. |
OK |
Java 8 |
TESTS |
86 |
2573 |
5939200 |
|
3000 |
|
15165417 |
Los_Angelos_Laycurse |
H |
Jan. 3, 2016, 6:54 a.m. |
OK |
MS C++ |
TESTS |
86 |
187 |
38400000 |
|
3000 |
|
15165401 |
Los_Angelos_Laycurse |
H |
Jan. 3, 2016, 6:53 a.m. |
OK |
MS C++ |
TESTS |
86 |
202 |
40755200 |
|
3000 |
|
15165387 |
Los_Angelos_Laycurse |
H |
Jan. 3, 2016, 6:52 a.m. |
OK |
MS C++ |
TESTS |
86 |
202 |
40755200 |
|
3000 |
|
15165315 |
Los_Angelos_Laycurse |
H |
Jan. 3, 2016, 6:43 a.m. |
OK |
MS C++ |
TESTS |
86 |
249 |
131276800 |
|
3000 |
|
15165335 |
Los_Angelos_Laycurse |
H |
Jan. 3, 2016, 6:45 a.m. |
OK |
MS C++ |
TESTS |
86 |
280 |
131276800 |
|
3000 |
|
15151254 |
Taube |
H |
Jan. 1, 2016, 6:08 p.m. |
OK |
MS C++ |
TESTS |
86 |
623 |
4300800 |
|
3000 |
|
15153435 |
Darooha |
H |
Jan. 1, 2016, 9:52 p.m. |
OK |
Ocaml |
TESTS |
86 |
358 |
14131200 |
|
3000 |
remove filters
Back to search problems