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'Polycarp has decided to decorate his room because the New Year is soon. One of the main decorations that Polycarp will install is the garland he is going to solder himself. Simple garlands consisting of several lamps connected by one wire are too boring for Polycarp. He is going to solder a garland consisting of n lamps and n - 1 wires. Exactly one lamp will be connected to power grid, and power will be transmitted from it to other lamps by the wires. Each wire connectes exactly two lamps; one lamp is called the main lamp for this wire (the one that gets power from some other wire and transmits it to this wire), the other one is called the auxiliary lamp (the one that gets power from this wire). Obviously, each lamp has at most one wire that brings power to it (and this lamp is the auxiliary lamp for this wire, and the main lamp for all other wires connected directly to it). Each lamp has a brightness value associated with it, the i -th lamp has brightness 2^i . We define the importance of the wire as the sum of brightness values over all lamps that become disconnected from the grid if the wire is cut (and all other wires are still working). Polycarp has drawn the scheme of the garland he wants to make (the scheme depicts all n lamp and n - 1 wires, and the lamp that will be connected directly to the grid is marked; the wires are placed in such a way that the power can be transmitted to each lamp). After that, Polycarp calculated the importance of each wire, enumerated them from 1 to n - 1 in descending order of their importance, and then wrote the index of the main lamp for each wire (in the order from the first wire to the last one). The following day Polycarp bought all required components of the garland and decided to solder it -- but he could not find the scheme. Fortunately, Polycarp found the list of indices of main lamps for all wires. Can you help him restore the original scheme? The first line contai'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
67845948 |
rainboy |
F |
Dec. 28, 2019, 9:37 p.m. |
OK |
GNU C11 |
TESTS |
75 |
826 |
204800 |
|
2400 |
68200720 |
mohana-256 |
F |
Jan. 4, 2020, 3:38 p.m. |
OK |
GNU C11 |
TESTS |
75 |
841 |
204800 |
|
2400 |
68200466 |
kavya246 |
F |
Jan. 4, 2020, 3:31 p.m. |
OK |
GNU C11 |
TESTS |
75 |
841 |
204800 |
|
2400 |
67851612 |
Frame233 |
F |
Dec. 29, 2019, 3:31 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
93 |
1024000 |
|
2400 |
68036564 |
Frame233 |
F |
Jan. 1, 2020, 12:21 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
93 |
1024000 |
|
2400 |
69297631 |
wasa855 |
F |
Jan. 22, 2020, 12:47 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
93 |
3379200 |
|
2400 |
68080512 |
FangZeLi |
F |
Jan. 2, 2020, 2:12 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
819200 |
|
2400 |
68061315 |
FangZeLi |
F |
Jan. 2, 2020, 4:18 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
819200 |
|
2400 |
68026150 |
sumit99 |
F |
Jan. 1, 2020, 5:55 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
1638400 |
|
2400 |
68963247 |
scimoon |
F |
Jan. 17, 2020, 2:57 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
1638400 |
|
2400 |
68056337 |
Vanquish23 |
F |
Jan. 1, 2020, 11:06 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
1638400 |
|
2400 |
69296499 |
Leidaxxb |
F |
Jan. 22, 2020, 12:24 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
3174400 |
|
2400 |
68709720 |
luogu_bot2 |
F |
Jan. 13, 2020, 12:34 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
109 |
7270400 |
|
2400 |
67990925 |
ybtcl |
F |
Dec. 31, 2019, 4:45 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
124 |
1024000 |
|
2400 |
67960834 |
banrovegrie |
F |
Dec. 30, 2019, 11:29 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
124 |
1638400 |
|
2400 |
68729029 |
iamrakeshri28 |
F |
Jan. 13, 2020, 7:07 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
124 |
2252800 |
|
2400 |
67945589 |
vjudge2 |
F |
Dec. 30, 2019, 5:04 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
124 |
2662400 |
|
2400 |
67947611 |
S_Aditya |
F |
Dec. 30, 2019, 6:11 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
124 |
4198400 |
|
2400 |
68116295 |
JUSSIAR |
F |
Jan. 3, 2020, 11:34 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
139 |
819200 |
|
2400 |
68161516 |
_MGH_ |
F |
Jan. 4, 2020, 11:04 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
139 |
4198400 |
|
2400 |
67824385 |
kotatsugame |
F |
Dec. 28, 2019, 6:11 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
139 |
4505600 |
|
2400 |
68033170 |
EvGen1u5 |
F |
Jan. 1, 2020, 10:31 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
140 |
0 |
|
2400 |
68033198 |
EvGen1u5 |
F |
Jan. 1, 2020, 10:32 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
140 |
0 |
|
2400 |
68218998 |
nickluo |
F |
Jan. 5, 2020, 3:05 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
93 |
4710400 |
|
2400 |
68394398 |
Skybytskyi.Nikita |
F |
Jan. 8, 2020, 10:18 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
124 |
819200 |
|
2400 |
67854490 |
ZephaniahWang |
F |
Dec. 29, 2019, 5:25 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
124 |
1024000 |
|
2400 |
68013424 |
Tariqul |
F |
Dec. 31, 2019, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
124 |
1638400 |
|
2400 |
67932114 |
just_soso |
F |
Dec. 29, 2019, 6:24 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
124 |
1740800 |
|
2400 |
68095965 |
eblabrada_ |
F |
Jan. 2, 2020, 8:48 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
139 |
1024000 |
|
2400 |
67843307 |
kiritan |
F |
Dec. 28, 2019, 8:17 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
139 |
3993600 |
|
2400 |
68156636 |
RUSH_D_CAT |
F |
Jan. 4, 2020, 9:11 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
139 |
3993600 |
|
2400 |
67830214 |
julianfernando |
F |
Dec. 28, 2019, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
140 |
204800 |
|
2400 |
67855310 |
ZephaniahWang |
F |
Dec. 29, 2019, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
140 |
204800 |
|
2400 |
68234801 |
Taube |
F |
Jan. 5, 2020, 10:32 a.m. |
OK |
Go |
TESTS |
75 |
234 |
4505600 |
|
2400 |
67968067 |
luchy0120 |
F |
Dec. 30, 2019, 2:01 p.m. |
OK |
Java 11 |
TESTS |
75 |
249 |
0 |
|
2400 |
67968380 |
luchy0120 |
F |
Dec. 30, 2019, 2:07 p.m. |
OK |
Java 11 |
TESTS |
75 |
265 |
4300800 |
|
2400 |
68053126 |
about |
F |
Jan. 1, 2020, 8:06 p.m. |
OK |
Java 11 |
TESTS |
75 |
296 |
0 |
|
2400 |
67843346 |
lightseba |
F |
Dec. 28, 2019, 8:18 p.m. |
OK |
Java 11 |
TESTS |
75 |
421 |
9728000 |
|
2400 |
67841726 |
lightseba |
F |
Dec. 28, 2019, 7:43 p.m. |
OK |
Java 11 |
TESTS |
75 |
436 |
14233600 |
|
2400 |
68038013 |
TheSawan |
F |
Jan. 1, 2020, 1:02 p.m. |
OK |
Java 11 |
TESTS |
75 |
514 |
20377600 |
|
2400 |
67845947 |
Dukkha |
F |
Dec. 28, 2019, 9:37 p.m. |
OK |
Java 11 |
TESTS |
75 |
561 |
0 |
|
2400 |
67970397 |
ojbbbbk |
F |
Dec. 30, 2019, 2:48 p.m. |
OK |
Java 11 |
TESTS |
75 |
1996 |
11776000 |
|
2400 |
67967999 |
luchy0120 |
F |
Dec. 30, 2019, 1:59 p.m. |
OK |
Java 8 |
TESTS |
75 |
171 |
0 |
|
2400 |
67968336 |
luchy0120 |
F |
Dec. 30, 2019, 2:06 p.m. |
OK |
Java 8 |
TESTS |
75 |
171 |
14950400 |
|
2400 |
67875680 |
nopre |
F |
Dec. 29, 2019, 1:12 p.m. |
OK |
Java 8 |
TESTS |
75 |
202 |
3072000 |
|
2400 |
67940755 |
nopre |
F |
Dec. 30, 2019, 12:32 a.m. |
OK |
Java 8 |
TESTS |
75 |
217 |
2969600 |
|
2400 |
67876789 |
basheer97 |
F |
Dec. 29, 2019, 1:36 p.m. |
OK |
Java 8 |
TESTS |
75 |
249 |
2252800 |
|
2400 |
67967920 |
luchy0120 |
F |
Dec. 30, 2019, 1:58 p.m. |
OK |
Java 8 |
TESTS |
75 |
280 |
15667200 |
|
2400 |
67854129 |
KharYusuf |
F |
Dec. 29, 2019, 5:14 a.m. |
OK |
Java 8 |
TESTS |
75 |
296 |
15360000 |
|
2400 |
67845180 |
Suzukaze |
F |
Dec. 28, 2019, 9:09 p.m. |
OK |
Java 8 |
TESTS |
75 |
311 |
11776000 |
|
2400 |
68300255 |
bluesky111 |
F |
Jan. 6, 2020, 6:08 a.m. |
OK |
Java 8 |
TESTS |
75 |
311 |
37171200 |
|
2400 |
67818043 |
Taran_1407 |
F |
Dec. 28, 2019, 5:49 p.m. |
OK |
Java 8 |
TESTS |
75 |
312 |
17817600 |
|
2400 |
67822198 |
Kenb |
F |
Dec. 28, 2019, 6:04 p.m. |
OK |
Kotlin |
TESTS |
75 |
467 |
17612800 |
|
2400 |
69288065 |
mban259 |
F |
Jan. 22, 2020, 9:03 a.m. |
OK |
Mono C# |
TESTS |
75 |
296 |
28467200 |
|
2400 |
67808039 |
riantkb |
F |
Dec. 28, 2019, 5:21 p.m. |
OK |
Mono C# |
TESTS |
75 |
514 |
37580800 |
|
2400 |
67841831 |
r57shell |
F |
Dec. 28, 2019, 7:46 p.m. |
OK |
MS C++ |
TESTS |
75 |
218 |
12390400 |
|
2400 |
68665199 |
vjudge2 |
F |
Jan. 12, 2020, 2:53 p.m. |
OK |
MS C++ |
TESTS |
75 |
374 |
3072000 |
|
2400 |
68742969 |
kwfumou1242 |
F |
Jan. 14, 2020, 2:37 a.m. |
OK |
MS C++ |
TESTS |
75 |
1075 |
25702400 |
|
2400 |
68145870 |
mrudula24 |
F |
Jan. 4, 2020, 4:20 a.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
156 |
1638400 |
|
2400 |
67833384 |
pichulia |
F |
Dec. 28, 2019, 6:47 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
218 |
12800000 |
|
2400 |
67972649 |
forestlightelf |
F |
Dec. 30, 2019, 3:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
405 |
1228800 |
|
2400 |
68286115 |
onipp |
F |
Jan. 5, 2020, 6:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
436 |
6144000 |
|
2400 |
68111554 |
klswkkj |
F |
Jan. 3, 2020, 9:44 a.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
451 |
3379200 |
|
2400 |
67999122 |
beemax |
F |
Dec. 31, 2019, 9:50 a.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
452 |
19456000 |
|
2400 |
68336614 |
mandinga |
F |
Jan. 6, 2020, 10:36 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
1044 |
3584000 |
|
2400 |
68422214 |
omerb.zeybek |
F |
Jan. 8, 2020, 11:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
1154 |
12390400 |
|
2400 |
67839324 |
Koropok |
F |
Dec. 28, 2019, 7:13 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
1263 |
11571200 |
|
2400 |
67839587 |
Koropok |
F |
Dec. 28, 2019, 7:16 p.m. |
OK |
MS C++ 2017 |
TESTS |
75 |
1263 |
11571200 |
|
2400 |
67842956 |
pajenegod |
F |
Dec. 28, 2019, 8:09 p.m. |
OK |
PyPy 2 |
TESTS |
75 |
436 |
30003200 |
|
2400 |
67834756 |
pajenegod |
F |
Dec. 28, 2019, 6:53 p.m. |
OK |
PyPy 2 |
TESTS |
75 |
654 |
45875200 |
|
2400 |
68143134 |
addammy |
F |
Jan. 4, 2020, 1:27 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
639 |
17203200 |
|
2400 |
68661980 |
smart_hard |
F |
Jan. 12, 2020, 1:56 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
654 |
19660800 |
|
2400 |
67828043 |
h25io |
F |
Dec. 28, 2019, 6:25 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
701 |
29491200 |
|
2400 |
67837787 |
Stelutzu |
F |
Dec. 28, 2019, 7:03 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
779 |
27340800 |
|
2400 |
69560641 |
aberent |
F |
Jan. 26, 2020, 10:28 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
889 |
33689600 |
|
2400 |
69561086 |
aberent |
F |
Jan. 26, 2020, 10:38 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
967 |
28160000 |
|
2400 |
68083148 |
reshma_reddy464 |
F |
Jan. 2, 2020, 3:09 p.m. |
OK |
Python 3 |
TESTS |
75 |
779 |
14643200 |
|
2400 |
67962136 |
romanysik |
F |
Dec. 30, 2019, 11:59 a.m. |
OK |
Python 3 |
TESTS |
75 |
779 |
14643200 |
|
2400 |
68049620 |
nayanraj210401 |
F |
Jan. 1, 2020, 6:08 p.m. |
OK |
Python 3 |
TESTS |
75 |
794 |
14643200 |
|
2400 |
67950509 |
shreya_dhanala |
F |
Dec. 30, 2019, 7:26 a.m. |
OK |
Python 3 |
TESTS |
75 |
920 |
26624000 |
|
2400 |
67855901 |
munir1 |
F |
Dec. 29, 2019, 6:04 a.m. |
OK |
Python 3 |
TESTS |
75 |
920 |
26624000 |
|
2400 |
67833179 |
SPD_9X2 |
F |
Dec. 28, 2019, 6:46 p.m. |
OK |
Python 3 |
TESTS |
75 |
998 |
26624000 |
|
2400 |
68073741 |
mahir01 |
F |
Jan. 2, 2020, 11:35 a.m. |
OK |
Python 3 |
TESTS |
75 |
998 |
27340800 |
|
2400 |
68014277 |
phamminhquang |
F |
Dec. 31, 2019, 5:32 p.m. |
OK |
Python 3 |
TESTS |
75 |
1060 |
14643200 |
|
2400 |
69593252 |
NocturneBflat |
F |
Jan. 27, 2020, 2:28 a.m. |
OK |
Python 3 |
TESTS |
75 |
1247 |
40243200 |
|
2400 |
67841800 |
r57shell |
F |
Dec. 28, 2019, 7:45 p.m. |
OK |
Python 3 |
TESTS |
75 |
1279 |
49868800 |
|
2400 |
69257444 |
sansen |
F |
Jan. 21, 2020, 4:03 p.m. |
OK |
Rust |
TESTS |
75 |
78 |
9011200 |
|
2400 |
remove filters
Back to search problems