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'A group of researchers are studying fish population in a natural system of lakes and rivers. The system contains n lakes connected by n - 1 rivers. Each river has integer length (in kilometers) and can be traversed in both directions. It is possible to travel between any pair of lakes by traversing the rivers (that is, the network of lakes and rivers form a tree). There is an unknown number of indistinguishable fish living in the lakes. On day 1 , fish can be at arbitrary lakes. Fish can travel between lakes by swimming the rivers. Each fish can swim a river l kilometers long in any direction in l days. Further, each fish can stay any number of days in any particular lake it visits. No fish ever appear or disappear from the lake system. Each lake can accomodate any number of fish at any time. The researchers made several observations. The j -th of these observations is "on day d_j there were at least f_j distinct fish in the lake p_j ". Help the researchers in determining the smallest possible total number of fish living in the lake system that doesn 't contradict the observations. The first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the number of lakes in the system. The next n - 1 lines describe the rivers. The i -th of these lines contains three integers u_i , v_i , l_i ( 1 <= q u_i, v_i <= q n , u_i neq v_i , 1 <= q l_i <= q 10^3 ) -- 1 -based indices of lakes connected by the i -th river, and the length of this river. The next line contains a single integer k ( 1 <= q k <= q 10^5 ) -- the number of observations. The next k lines describe the observations. The j -th of these lines contains three integers d_j , f_j , p_j ( 1 <= q d_j <= q 10^8 , 1 <= q f_j <= q 10^4 , 1 <= q p_j <= q n ) -- the day, the number of fish, and the lake index of the j -th observation. N'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
43711339 |
tritanngo99 |
G |
Oct. 3, 2018, 3:55 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
499 |
28467200 |
|
3300 |
45450515 |
zyqhxmd |
G |
Nov. 8, 2018, 3:46 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
499 |
77107200 |
|
3300 |
57868962 |
lopare |
G |
July 27, 2019, 11:49 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
592 |
101888000 |
|
3300 |
57737919 |
py_ultron |
G |
July 25, 2019, 10:31 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
592 |
101888000 |
|
3300 |
46583960 |
yutaka1999 |
G |
Dec. 4, 2018, 12:24 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
592 |
101888000 |
|
3300 |
42072225 |
krijgertje |
G |
Aug. 25, 2018, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
1107 |
98304000 |
|
3300 |
43175440 |
Emma194 |
G |
Sept. 21, 2018, 11:03 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
1154 |
113152000 |
|
3300 |
42108140 |
dragonslayerintraining |
G |
Aug. 26, 2018, 3:17 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
1590 |
161792000 |
|
3300 |
42516622 |
FizzyDavid |
G |
Sept. 5, 2018, 5:45 p.m. |
OK |
GNU C++11 |
TESTS |
51 |
1621 |
181350400 |
|
3300 |
41750341 |
Magic_Alien |
G |
Aug. 18, 2018, 9:18 a.m. |
OK |
GNU C++11 |
TESTS |
51 |
1684 |
148787200 |
|
3300 |
49396995 |
Samurai_ |
G |
Feb. 3, 2019, 12:50 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
546 |
28672000 |
|
3300 |
41908179 |
consecutivelimit |
G |
Aug. 20, 2018, 3:49 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
577 |
28672000 |
|
3300 |
42721520 |
ReaLNero1 |
G |
Sept. 10, 2018, 2:09 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
623 |
28672000 |
|
3300 |
42167073 |
Ghaffargang |
G |
Aug. 27, 2018, 5:05 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
623 |
28672000 |
|
3300 |
49890752 |
H.D.T |
G |
Feb. 14, 2019, 3:24 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
623 |
101888000 |
|
3300 |
51618511 |
mayaohua2003 |
G |
March 21, 2019, 1:23 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
935 |
103424000 |
|
3300 |
42609540 |
cz_xuyixuan |
G |
Sept. 7, 2018, 10:08 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
1232 |
113356800 |
|
3300 |
42546293 |
apiadu |
G |
Sept. 6, 2018, 9:15 a.m. |
OK |
GNU C++14 |
TESTS |
51 |
1325 |
113356800 |
|
3300 |
41757162 |
DEMOPON |
G |
Aug. 18, 2018, 12:40 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
1684 |
146227200 |
|
3300 |
41760393 |
Shahram |
G |
Aug. 18, 2018, 2:16 p.m. |
OK |
GNU C++14 |
TESTS |
51 |
1793 |
146227200 |
|
3300 |
48502404 |
matthew99 |
G |
Jan. 17, 2019, 3:50 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
764 |
47820800 |
|
3300 |
42888067 |
DZYO |
G |
Sept. 15, 2018, 11:06 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
858 |
31232000 |
|
3300 |
46716538 |
cxt |
G |
Dec. 7, 2018, 11:32 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
919 |
104345600 |
|
3300 |
65920065 |
maroonrk |
G |
Nov. 28, 2019, 4:01 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
919 |
113254400 |
|
3300 |
41936437 |
KAN |
G |
Aug. 21, 2018, 1:15 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
935 |
90316800 |
|
3300 |
44466855 |
Nakagawa.Kanon |
G |
Oct. 18, 2018, 3:13 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1154 |
113664000 |
|
3300 |
42886343 |
DZYO |
G |
Sept. 15, 2018, 10:10 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1201 |
44032000 |
|
3300 |
66008609 |
gongsuidashen |
G |
Nov. 30, 2019, 12:34 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1247 |
113356800 |
|
3300 |
55938906 |
Benq |
G |
June 22, 2019, 3:27 p.m. |
OK |
GNU C++17 |
TESTS |
51 |
1310 |
100864000 |
|
3300 |
41933898 |
lixinyue |
G |
Aug. 21, 2018, 11:54 a.m. |
OK |
GNU C++17 |
TESTS |
51 |
1699 |
146227200 |
|
3300 |
41779819 |
Lewin |
G |
Aug. 18, 2018, 3:42 p.m. |
OK |
Java 8 |
TESTS |
51 |
2292 |
127180800 |
|
3300 |
remove filters
Back to search problems