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 |
739
|
Codeforces Round 381 (Div. 1) |
FINISHED |
False |
7200 |
257261063 |
Nov. 23, 2016, 4:35 p.m. |
Problems
B"Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edge of the tree (possibly, different integers on different edges). Let's define dist(v, xe2 x80 x89u) as the sum of the integers written on the edges of the simple path from v to u. The vertex v controls the vertex u (v xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89u) if and only if u is in the subtree of v and dist(v, xe2 x80 x89u) xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89au. Alyona wants to settle in some vertex. In order to do this, she wants to know for each vertex v what is the number of vertices u such that v controls u. The first line contains single integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892 xc2 xb7105). The second line contains n integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the integers written in the vertices. The next (n xe2 x80 x89- xe2 x80 x891) lines contain two integers each. The i-th of these lines contains integers pi and wi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89pi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89wi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109) -- the parent of the (i xe2 x80 x89+ xe2 x80 x891)-th vertex in the tree and the number written on the edge between pi and (i xe2 x80 x89+ xe2 x80 x891). It is guaranteed that the given graph is a tree. Print n integers -- the i-th of these numbers should be equal to the number of vertices that the i-th vertex controls. In the example test case the vertex 1 controls the vertex 3, the vertex 3 controls the vertex 5 (note that is doesn't mean the vertex 1 controls the vertex 5). "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
22465199 |
Gassa |
B |
Nov. 24, 2016, 11:50 a.m. |
OK |
D |
TESTS |
126 |
529 |
63283200 |
|
2000 |
22465024 |
Gassa |
B |
Nov. 24, 2016, 11:42 a.m. |
OK |
D |
TESTS |
126 |
748 |
106393600 |
|
2000 |
29455396 |
lkmcfj |
B |
Aug. 14, 2017, 10:10 a.m. |
OK |
FPC |
TESTS |
126 |
545 |
16076800 |
|
2000 |
22486936 |
aspi |
B |
Nov. 25, 2016, 10:46 a.m. |
OK |
FPC |
TESTS |
126 |
685 |
17715200 |
|
2000 |
22667372 |
bzh |
B |
Dec. 2, 2016, 11:54 p.m. |
OK |
FPC |
TESTS |
126 |
702 |
53350400 |
|
2000 |
22606230 |
k2nt |
B |
Nov. 29, 2016, 4:41 p.m. |
OK |
FPC |
TESTS |
126 |
748 |
25804800 |
|
2000 |
40686337 |
vjudge4 |
B |
July 24, 2018, 2:24 a.m. |
OK |
FPC |
TESTS |
126 |
795 |
84172800 |
|
2000 |
64366119 |
luogu_bot3 |
B |
Nov. 6, 2019, 1:05 p.m. |
OK |
FPC |
TESTS |
126 |
842 |
30105600 |
|
2000 |
44549709 |
luogu_bot1 |
B |
Oct. 19, 2018, 2:50 p.m. |
OK |
FPC |
TESTS |
126 |
904 |
37683200 |
|
2000 |
22485140 |
lkmcfj |
B |
Nov. 25, 2016, 8:45 a.m. |
OK |
FPC |
TESTS |
126 |
935 |
14438400 |
|
2000 |
22673113 |
myx12345 |
B |
Dec. 3, 2016, 9:25 a.m. |
OK |
FPC |
TESTS |
126 |
1044 |
39731200 |
|
2000 |
22804059 |
jkxjkx1031 |
B |
Dec. 8, 2016, 7:40 a.m. |
OK |
GNU C |
TESTS |
126 |
343 |
67584000 |
|
2000 |
22442254 |
EKASMA |
B |
Nov. 23, 2016, 5:39 p.m. |
OK |
GNU C |
TESTS |
126 |
390 |
69120000 |
|
2000 |
39517936 |
Siyuan |
B |
June 22, 2018, 1:34 p.m. |
OK |
GNU C++ |
TESTS |
126 |
140 |
22528000 |
|
2000 |
31666584 |
zcyhhh |
B |
Oct. 24, 2017, 2:13 a.m. |
OK |
GNU C++ |
TESTS |
126 |
155 |
35635200 |
|
2000 |
22709497 |
OceanEye_fdc |
B |
Dec. 5, 2016, 10:55 a.m. |
OK |
GNU C++ |
TESTS |
126 |
156 |
24064000 |
|
2000 |
32124859 |
redbag |
B |
Nov. 7, 2017, 4:08 p.m. |
OK |
GNU C++ |
TESTS |
126 |
156 |
34201600 |
|
2000 |
42457959 |
vjudge5 |
B |
Sept. 4, 2018, 12:25 p.m. |
OK |
GNU C++ |
TESTS |
126 |
156 |
34713600 |
|
2000 |
26800148 |
vjudge4 |
B |
May 2, 2017, 10:32 a.m. |
OK |
GNU C++ |
TESTS |
126 |
171 |
19456000 |
|
2000 |
22487252 |
Ajatar |
B |
Nov. 25, 2016, 11:07 a.m. |
OK |
GNU C++ |
TESTS |
126 |
171 |
30412800 |
|
2000 |
32125013 |
redbag |
B |
Nov. 7, 2017, 4:14 p.m. |
OK |
GNU C++ |
TESTS |
126 |
171 |
34201600 |
|
2000 |
28279372 |
hohomu |
B |
July 4, 2017, 11:53 a.m. |
OK |
GNU C++ |
TESTS |
126 |
186 |
19660800 |
|
2000 |
25969859 |
czllgzmzl |
B |
March 31, 2017, 7:05 a.m. |
OK |
GNU C++ |
TESTS |
126 |
187 |
24473600 |
|
2000 |
56367505 |
hovny |
B |
July 1, 2019, 12:40 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
77 |
46489600 |
|
2000 |
56367374 |
hovnySiLenCe |
B |
July 1, 2019, 12:31 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
93 |
12800000 |
|
2000 |
56367355 |
hovny |
B |
July 1, 2019, 12:30 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
93 |
12800000 |
|
2000 |
47868432 |
vjudge2 |
B |
Jan. 3, 2019, 11:22 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
109 |
22425600 |
|
2000 |
45429215 |
prayerhgq |
B |
Nov. 8, 2018, 1:34 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
109 |
23244800 |
|
2000 |
47864599 |
luogu_bot1 |
B |
Jan. 3, 2019, 8:50 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
109 |
25600000 |
|
2000 |
45436119 |
luogu_bot2 |
B |
Nov. 8, 2018, 8:03 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
109 |
27648000 |
|
2000 |
31671862 |
lfyc |
B |
Oct. 24, 2017, 7:16 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
109 |
32460800 |
|
2000 |
49191559 |
luogu_bot3 |
B |
Jan. 30, 2019, 8:27 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
124 |
22425600 |
|
2000 |
47867771 |
luogu_bot2 |
B |
Jan. 3, 2019, 10:57 a.m. |
OK |
GNU C++11 |
TESTS |
126 |
124 |
22425600 |
|
2000 |
41862967 |
Gazelle_ |
B |
Aug. 19, 2018, 3:40 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
124 |
100249600 |
|
2000 |
28896237 |
xehoth |
B |
July 26, 2017, 6:54 a.m. |
OK |
GNU C++14 |
TESTS |
126 |
155 |
30412800 |
|
2000 |
22434366 |
platypus179 |
B |
Nov. 23, 2016, 4:58 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
171 |
55398400 |
|
2000 |
29867443 |
Tabris |
B |
Aug. 29, 2017, 1:47 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
218 |
22425600 |
|
2000 |
27015646 |
subham_singhal |
B |
May 11, 2017, 2:47 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
218 |
27340800 |
|
2000 |
50246147 |
xrox |
B |
Feb. 20, 2019, 3:01 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
218 |
28160000 |
|
2000 |
64436173 |
dhfihasd |
B |
Nov. 7, 2019, 1:27 a.m. |
OK |
GNU C++14 |
TESTS |
126 |
233 |
26624000 |
|
2000 |
23048202 |
penzer27 |
B |
Dec. 17, 2016, 1:20 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
233 |
27340800 |
|
2000 |
50246413 |
xrox |
B |
Feb. 20, 2019, 3:08 p.m. |
OK |
GNU C++14 |
TESTS |
126 |
233 |
28262400 |
|
2000 |
48878058 |
jonathansilver |
B |
Jan. 24, 2019, 9:04 a.m. |
OK |
GNU C++14 |
TESTS |
126 |
233 |
219955200 |
|
2000 |
44527358 |
juandatorr |
B |
Oct. 19, 2018, 3:59 a.m. |
OK |
GNU C++17 |
TESTS |
126 |
202 |
27340800 |
|
2000 |
49767325 |
Holmesee |
B |
Feb. 11, 2019, 12:13 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
218 |
24780800 |
|
2000 |
59574458 |
magdy.hasan |
B |
Aug. 27, 2019, 1:41 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
233 |
23449600 |
|
2000 |
60458010 |
madhusudangm |
B |
Sept. 12, 2019, 6:56 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
233 |
41369600 |
|
2000 |
51389764 |
_J_ |
B |
March 16, 2019, 9:20 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
233 |
43417600 |
|
2000 |
48877480 |
dhuacm3 |
B |
Jan. 24, 2019, 8:50 a.m. |
OK |
GNU C++17 |
TESTS |
126 |
233 |
222515200 |
|
2000 |
54449168 |
G3meux |
B |
May 21, 2019, 12:46 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
234 |
26624000 |
|
2000 |
60028462 |
Fearless_J |
B |
Sept. 4, 2019, 2:45 p.m. |
OK |
GNU C++17 |
TESTS |
126 |
234 |
28262400 |
|
2000 |
56266077 |
quake0 |
B |
June 29, 2019, 9:56 a.m. |
OK |
GNU C++17 |
TESTS |
126 |
249 |
31129600 |
|
2000 |
56265805 |
quake0 |
B |
June 29, 2019, 9:48 a.m. |
OK |
GNU C++17 |
TESTS |
126 |
249 |
31129600 |
|
2000 |
35171293 |
megaspazz |
B |
Feb. 12, 2018, 7:20 a.m. |
OK |
Go |
TESTS |
126 |
670 |
92160000 |
|
2000 |
35171322 |
vjudge5 |
B |
Feb. 12, 2018, 7:22 a.m. |
OK |
Go |
TESTS |
126 |
670 |
92774400 |
|
2000 |
66300927 |
KulikAlex |
B |
Dec. 5, 2019, 7:10 a.m. |
OK |
Java 11 |
TESTS |
126 |
1060 |
202752000 |
|
2000 |
24552457 |
IgorKoval |
B |
Feb. 9, 2017, 3:22 p.m. |
OK |
Java 8 |
TESTS |
126 |
358 |
76902400 |
|
2000 |
22467029 |
hama-du |
B |
Nov. 24, 2016, 1:02 p.m. |
OK |
Java 8 |
TESTS |
126 |
374 |
19660800 |
|
2000 |
22607484 |
AlexFetisov |
B |
Nov. 29, 2016, 5:46 p.m. |
OK |
Java 8 |
TESTS |
126 |
421 |
41574400 |
|
2000 |
22434145 |
uwi |
B |
Nov. 23, 2016, 4:57 p.m. |
OK |
Java 8 |
TESTS |
126 |
467 |
78745600 |
|
2000 |
68874693 |
yaoct |
B |
Jan. 15, 2020, 4:29 p.m. |
OK |
Java 8 |
TESTS |
126 |
576 |
117555200 |
|
2000 |
59948378 |
kocko |
B |
Sept. 3, 2019, 1:42 p.m. |
OK |
Java 8 |
TESTS |
126 |
716 |
68915200 |
|
2000 |
27431695 |
kunalk |
B |
May 29, 2017, 3:45 p.m. |
OK |
Java 8 |
TESTS |
126 |
717 |
76288000 |
|
2000 |
40357778 |
prabhat236218 |
B |
July 14, 2018, 9:15 p.m. |
OK |
Java 8 |
TESTS |
126 |
748 |
90214400 |
|
2000 |
40251333 |
tsumit023 |
B |
July 13, 2018, 6:21 a.m. |
OK |
Java 8 |
TESTS |
126 |
795 |
76800000 |
|
2000 |
63904055 |
FluffyPotato |
B |
Oct. 31, 2019, 5:57 a.m. |
OK |
Java 8 |
TESTS |
126 |
795 |
196812800 |
|
2000 |
22704370 |
vyxaryx |
B |
Dec. 5, 2016, 4:16 a.m. |
OK |
Kotlin |
TESTS |
126 |
1575 |
161075200 |
|
2000 |
22450483 |
riantkb |
B |
Nov. 23, 2016, 7:18 p.m. |
OK |
Mono C# |
TESTS |
126 |
1512 |
102092800 |
|
2000 |
22439297 |
AnatolyTolstobrov |
B |
Nov. 23, 2016, 5:19 p.m. |
OK |
MS C# |
TESTS |
126 |
296 |
49868800 |
|
2000 |
22594535 |
fr0st |
B |
Nov. 29, 2016, 8:52 a.m. |
OK |
MS C# |
TESTS |
126 |
935 |
63385600 |
|
2000 |
49946119 |
vjudge4 |
B |
Feb. 15, 2019, 12:08 p.m. |
OK |
MS C++ |
TESTS |
126 |
186 |
20787200 |
|
2000 |
54250106 |
vjudge5 |
B |
May 16, 2019, 4:47 p.m. |
OK |
MS C++ |
TESTS |
126 |
186 |
28672000 |
|
2000 |
49940966 |
vjudge5 |
B |
Feb. 15, 2019, 9:36 a.m. |
OK |
MS C++ |
TESTS |
126 |
202 |
22630400 |
|
2000 |
52228343 |
vjudge3 |
B |
April 2, 2019, 10:47 a.m. |
OK |
MS C++ |
TESTS |
126 |
218 |
26624000 |
|
2000 |
24445802 |
vjudge5 |
B |
Feb. 5, 2017, 6:19 a.m. |
OK |
MS C++ |
TESTS |
126 |
249 |
24678400 |
|
2000 |
56663570 |
vjudge3 |
B |
July 7, 2019, 10:36 a.m. |
OK |
MS C++ |
TESTS |
126 |
249 |
24883200 |
|
2000 |
49945207 |
vjudge2 |
B |
Feb. 15, 2019, 11:42 a.m. |
OK |
MS C++ |
TESTS |
126 |
264 |
28057600 |
|
2000 |
51604308 |
vjudge1 |
B |
March 21, 2019, 6:30 a.m. |
OK |
MS C++ |
TESTS |
126 |
264 |
29081600 |
|
2000 |
28813200 |
lu925871076 |
B |
July 24, 2017, 3:39 a.m. |
OK |
MS C++ |
TESTS |
126 |
265 |
28467200 |
|
2000 |
22601116 |
Naduxa |
B |
Nov. 29, 2016, 2:46 p.m. |
OK |
MS C++ |
TESTS |
126 |
265 |
32153600 |
|
2000 |
60281248 |
CtrlAlt |
B |
Sept. 8, 2019, 9:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
126 |
311 |
22118400 |
|
2000 |
54406099 |
zhuiyi |
B |
May 20, 2019, 6:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
126 |
343 |
20070400 |
|
2000 |
22478217 |
Darooha |
B |
Nov. 24, 2016, 7:57 p.m. |
OK |
Ocaml |
TESTS |
126 |
1840 |
70656000 |
|
2000 |
remove filters
Back to search problems