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
It's the turn of the year, so Bash wants to send presents to his friends. There are n cities in the Himalayan region and they are connected by m bidirectional roads. Bash is living in city s . Bash has exactly one friend in each of the other cities. Since Bash wants to surprise his friends, he decides to send a Pikachu to each of them. Since there may be some cities which are not reachable from Bash's city, he only sends a Pikachu to those friends who live in a city reachable from his own city . He also wants to send it to them as soon as possible. He finds out the minimum time for each of his Pikachus to reach its destination city. Since he is a perfectionist, he informs all his friends with the time their gift will reach them. A Pikachu travels at a speed of 1 meters per second. His friends were excited to hear this and would be unhappy if their presents got delayed. Unfortunately Team Rocket is on the loose and they came to know of Bash's plan. They want to maximize the number of friends who are unhappy with Bash. They do this by destroying exactly one of the other n - 1 cities. This implies that the friend residing in that city dies, so he is unhappy as well . Note that if a city is destroyed, all the roads directly connected to the city are also destroyed and the Pikachu may be forced to take a longer alternate route . Please also note that only friends that are waiting for a gift count as unhappy, even if they die. Since Bash is already a legend, can you help Team Rocket this time and find out the maximum number of Bash's friends who can be made unhappy by destroying exactly one city. The first line contains three space separated integers n , m and s ( 2 ≤ n ≤ 2·10 5 , , 1 ≤ s ≤ n ) — the number of cities and the number of roads in the Himalayan region and the city Bash lives in. Each of the next m lines contain three space-separated integers u , v and w ( 1 ≤ u , v ≤ n , u ≠ v , 1 ≤ w ≤ 10 9 ) denoting that there exists a road between city u and cit |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
35982853 |
__ShaW |
F |
March 6, 2018, 6:25 a.m. |
OK |
FPC |
TESTS |
168 |
842 |
38502400 |
|
2700 |
|
25660059 |
InvUsr |
F |
March 20, 2017, 6:02 a.m. |
OK |
GNU C++ |
TESTS |
168 |
187 |
36147200 |
|
2700 |
|
27405961 |
150420 |
F |
May 28, 2017, 8:59 a.m. |
OK |
GNU C++ |
TESTS |
168 |
218 |
29491200 |
|
2700 |
|
27149220 |
jiyutian |
F |
May 16, 2017, 3:33 a.m. |
OK |
GNU C++ |
TESTS |
168 |
234 |
47206400 |
|
2700 |
|
40982699 |
ReaLNero1 |
F |
July 30, 2018, 6:32 p.m. |
OK |
GNU C++ |
TESTS |
168 |
249 |
29491200 |
|
2700 |
|
27790348 |
GodofTheFallen |
F |
June 15, 2017, 9:21 a.m. |
OK |
GNU C++ |
TESTS |
168 |
264 |
39936000 |
|
2700 |
|
29919349 |
666sb666 |
F |
Aug. 30, 2017, 1:57 p.m. |
OK |
GNU C++ |
TESTS |
168 |
265 |
35020800 |
|
2700 |
|
25496084 |
xzyxzy |
F |
March 15, 2017, 11:17 a.m. |
OK |
GNU C++ |
TESTS |
168 |
280 |
96972800 |
|
2700 |
|
27671487 |
XuYipei |
F |
June 8, 2017, 12:45 p.m. |
OK |
GNU C++ |
TESTS |
168 |
296 |
43520000 |
|
2700 |
|
34196292 |
yasugongshang |
F |
Jan. 15, 2018, 12:19 p.m. |
OK |
GNU C++ |
TESTS |
168 |
311 |
74956800 |
|
2700 |
|
34335716 |
s_circle |
F |
Jan. 20, 2018, 2:35 a.m. |
OK |
GNU C++ |
TESTS |
168 |
312 |
56524800 |
|
2700 |
|
52683818 |
luogu_bot3 |
F |
April 13, 2019, 1:53 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
171 |
36044800 |
|
2700 |
|
61561491 |
Dream-chasing_Juvenile |
F |
Sept. 30, 2019, 3:43 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
171 |
55808000 |
|
2700 |
|
44702051 |
Buzhibujue |
F |
Oct. 22, 2018, 3:12 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
202 |
41881600 |
|
2700 |
|
54803643 |
__23333 |
F |
May 29, 2019, 1:03 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
202 |
51404800 |
|
2700 |
|
54803599 |
__23333 |
F |
May 29, 2019, 1:02 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
202 |
51404800 |
|
2700 |
|
61561701 |
Dream-chasing_Juvenile |
F |
Sept. 30, 2019, 3:47 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
202 |
55808000 |
|
2700 |
|
53613478 |
wcrkonjac |
F |
May 1, 2019, 2:22 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
202 |
108236800 |
|
2700 |
|
44467220 |
__Ressed__ |
F |
Oct. 18, 2018, 3:33 a.m. |
OK |
GNU C++11 |
TESTS |
168 |
217 |
38604800 |
|
2700 |
|
44467233 |
vjudge1 |
F |
Oct. 18, 2018, 3:34 a.m. |
OK |
GNU C++11 |
TESTS |
168 |
217 |
38707200 |
|
2700 |
|
54803919 |
__23333 |
F |
May 29, 2019, 1:10 p.m. |
OK |
GNU C++11 |
TESTS |
168 |
217 |
51404800 |
|
2700 |
|
55565542 |
atoiz |
F |
June 14, 2019, 3:13 p.m. |
OK |
GNU C++14 |
TESTS |
168 |
312 |
28467200 |
|
2700 |
|
24606036 |
Al.Cash |
F |
Feb. 12, 2017, 10:15 a.m. |
OK |
GNU C++14 |
TESTS |
168 |
343 |
43008000 |
|
2700 |
|
58474102 |
cjxj233 |
F |
Aug. 9, 2019, 2:13 a.m. |
OK |
GNU C++14 |
TESTS |
168 |
373 |
99737600 |
|
2700 |
|
54962886 |
bhargav_0085 |
F |
June 2, 2019, 4:53 a.m. |
OK |
GNU C++14 |
TESTS |
168 |
374 |
32051200 |
|
2700 |
|
59331588 |
Scut82 |
F |
Aug. 23, 2019, 1:33 a.m. |
OK |
GNU C++14 |
TESTS |
168 |
390 |
31948800 |
|
2700 |
|
53262683 |
TadijaSebez |
F |
April 24, 2019, 9:27 p.m. |
OK |
GNU C++14 |
TESTS |
168 |
405 |
34816000 |
|
2700 |
|
55568444 |
seven-seas |
F |
June 14, 2019, 5 p.m. |
OK |
GNU C++14 |
TESTS |
168 |
405 |
39321600 |
|
2700 |
|
23921930 |
Al.Cash |
F |
Jan. 18, 2017, 12:42 p.m. |
OK |
GNU C++14 |
TESTS |
168 |
405 |
43008000 |
|
2700 |
|
51200448 |
tymo |
F |
March 11, 2019, 10:24 p.m. |
OK |
GNU C++14 |
TESTS |
168 |
405 |
47616000 |
|
2700 |
|
46014660 |
Yoyoball |
F |
Nov. 21, 2018, 1:15 a.m. |
OK |
GNU C++14 |
TESTS |
168 |
420 |
47718400 |
|
2700 |
|
52267352 |
fcwww |
F |
April 3, 2019, 11:52 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
327 |
43212800 |
|
2700 |
|
58113911 |
nerve_ending |
F |
Aug. 1, 2019, 8:13 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
405 |
167731200 |
|
2700 |
|
52290839 |
Fulisike |
F |
April 4, 2019, 1:26 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
420 |
47104000 |
|
2700 |
|
62082685 |
ivan100sic |
F |
Oct. 7, 2019, 10:01 p.m. |
OK |
GNU C++17 |
TESTS |
168 |
420 |
54988800 |
|
2700 |
|
56982340 |
Benq |
F |
July 13, 2019, 2:25 p.m. |
OK |
GNU C++17 |
TESTS |
168 |
421 |
36659200 |
|
2700 |
|
49302482 |
vjudge3 |
F |
Feb. 1, 2019, 4:02 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
421 |
47308800 |
|
2700 |
|
64732291 |
user202729_ |
F |
Nov. 12, 2019, 8:54 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
436 |
35737600 |
|
2700 |
|
58895918 |
Slaaava |
F |
Aug. 16, 2019, 7:31 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
436 |
52019200 |
|
2700 |
|
62416367 |
Anachor |
F |
Oct. 12, 2019, 11:43 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
451 |
59801600 |
|
2700 |
|
51361390 |
long10024070 |
F |
March 16, 2019, 7:29 a.m. |
OK |
GNU C++17 |
TESTS |
168 |
452 |
43008000 |
|
2700 |
|
24112299 |
IgorKoval |
F |
Jan. 25, 2017, 1:22 p.m. |
OK |
Java 8 |
TESTS |
168 |
530 |
65228800 |
|
2700 |
|
24111761 |
IgorKoval |
F |
Jan. 25, 2017, 12:57 p.m. |
OK |
Java 8 |
TESTS |
168 |
561 |
42598400 |
|
2700 |
|
23796361 |
uwi |
F |
Jan. 14, 2017, 2:45 a.m. |
OK |
Java 8 |
TESTS |
168 |
841 |
75366400 |
|
2700 |
|
23778977 |
uwi |
F |
Jan. 13, 2017, 7:29 a.m. |
OK |
Java 8 |
TESTS |
168 |
857 |
84377600 |
|
2700 |
|
37112437 |
happybelly |
F |
April 9, 2018, 3:06 a.m. |
OK |
Java 8 |
TESTS |
168 |
998 |
99225600 |
|
2700 |
|
37114020 |
happybelly |
F |
April 9, 2018, 5:45 a.m. |
OK |
Java 8 |
TESTS |
168 |
1138 |
102912000 |
|
2700 |
|
37113967 |
happybelly |
F |
April 9, 2018, 5:41 a.m. |
OK |
Java 8 |
TESTS |
168 |
1138 |
103014400 |
|
2700 |
|
23769263 |
mmaxio |
F |
Jan. 12, 2017, 7:52 p.m. |
OK |
Java 8 |
TESTS |
168 |
1169 |
101888000 |
|
2700 |
|
31044692 |
alexrcoleman |
F |
Oct. 5, 2017, 6:50 p.m. |
OK |
Java 8 |
TESTS |
168 |
1357 |
150937600 |
|
2700 |
|
37112275 |
happybelly |
F |
April 9, 2018, 2:46 a.m. |
OK |
Java 8 |
TESTS |
168 |
1403 |
155955200 |
|
2700 |
|
43922891 |
vjudge1 |
F |
Oct. 7, 2018, 2:15 a.m. |
OK |
MS C++ |
TESTS |
168 |
997 |
331059200 |
|
2700 |
|
44103488 |
vjudge2 |
F |
Oct. 11, 2018, 7:40 a.m. |
OK |
MS C++ |
TESTS |
168 |
1092 |
62464000 |
|
2700 |
|
44039021 |
vjudge4 |
F |
Oct. 9, 2018, 2 p.m. |
OK |
MS C++ |
TESTS |
168 |
1092 |
62464000 |
|
2700 |
remove filters
Back to search problems