Codeforces Round 483 (Div. 1) [Thanks, Botan Investments and Victor Shaburov!]

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
983 Codeforces Round 483 (Div. 1) [Thanks, Botan Investments and Victor Shaburov!] FINISHED False 7200 211130124 May 15, 2018, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 984 ) E NN country PROGRAMMING binary search data structures trees 2700

B'In the NN country, there are n cities, numbered from 1 to n , and n - 1 roads, connecting them. There is a roads path between any two cities. There are m bidirectional bus routes between cities. Buses drive between two cities taking the shortest path with stops in every city they drive through. Travelling by bus, you can travel from any stop on the route to any other. You can travel between cities only by bus. You are interested in q questions: is it possible to get from one city to another and what is the minimum number of buses you need to use for it? The first line contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of cities. The second line contains n - 1 integers p_2, p_3, ldots, p_n ( 1 <= p_i < i ), where p_i means that cities p_i and i are connected by road. The third line contains a single integer m ( 1 <= m <= 2 cdot 10^5 ) -- the number of bus routes. Each of the next m lines contains 2 integers a and b ( 1 <= a, b <= n , a neq b ), meaning that there is a bus route between cities a and b . It is possible that there is more than one route between two cities. The next line contains a single integer q ( 1 <= q <= 2 cdot 10^5 ) -- the number of questions you are interested in. Each of the next q lines contains 2 integers v and u ( 1 <= v, u <= n , v neq u ), meaning that you are interested if it is possible to get from city v to city u and what is the minimum number of buses you need to use for it. Print the answer for each question on a separate line. If there is no way to get from one city to another, print -1 . Otherwise print the minimum number of buses you have to use. '...

Tutorials

Codeforces Round #483 [Thanks, Botan Investments and Victor Shaburov!] Editoral

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
44773740 Philchieh E Oct. 24, 2018, 1:26 p.m. OK FPC TESTS 82 1341 56934400 2700
41154887 PotremZ E Aug. 3, 2018, 11:28 a.m. OK GNU C++ TESTS 82 514 75878400 2700
39951276 shuitiacji E July 4, 2018, 10:27 a.m. OK GNU C++ TESTS 82 592 53657600 2700
41154719 PotremZ E Aug. 3, 2018, 11:21 a.m. OK GNU C++ TESTS 82 608 75878400 2700
40086484 luogu_bot5 E July 8, 2018, 1:32 p.m. OK GNU C++ TESTS 82 624 110284800 2700
40097619 luogu_bot1 E July 9, 2018, 1:29 a.m. OK GNU C++ TESTS 82 701 55193600 2700
39792798 linners E June 30, 2018, 9:10 a.m. OK GNU C++ TESTS 82 701 55193600 2700
39786582 138702366 E June 30, 2018, 3:06 a.m. OK GNU C++ TESTS 82 701 55193600 2700
40704635 Dr_Bit E July 24, 2018, 12:43 p.m. OK GNU C++ TESTS 82 716 123801600 2700
40098016 Wallyssaa E July 9, 2018, 1:54 a.m. OK GNU C++ TESTS 82 732 65331200 2700
38575709 fpdqwq E May 24, 2018, 3:23 a.m. OK GNU C++ TESTS 82 733 72089600 2700
62656540 dqa2020 E Oct. 16, 2019, 2:11 a.m. OK GNU C++11 TESTS 82 358 52940800 2700
44759153 fks20011206 E Oct. 24, 2018, 5:52 a.m. OK GNU C++11 TESTS 82 358 71475200 2700
44679728 fks20011206 E Oct. 22, 2018, 5:23 a.m. OK GNU C++11 TESTS 82 373 70348800 2700
44617851 luogu_bot3 E Oct. 21, 2018, 3:40 a.m. OK GNU C++11 TESTS 82 389 46080000 2700
44592422 vjudge4 E Oct. 20, 2018, 11:30 a.m. OK GNU C++11 TESTS 82 389 125849600 2700
45396476 fks20011206 E Nov. 7, 2018, 5:01 a.m. OK GNU C++11 TESTS 82 405 71475200 2700
44592575 Rye_Catcher E Oct. 20, 2018, 11:33 a.m. OK GNU C++11 TESTS 82 405 130048000 2700
44617863 luogu_bot5 E Oct. 21, 2018, 3:41 a.m. OK GNU C++11 TESTS 82 421 46080000 2700
54264107 mmmod_lqs E May 17, 2019, 4:36 a.m. OK GNU C++11 TESTS 82 421 72704000 2700
51900050 luogu_bot4 E March 27, 2019, 1:10 p.m. OK GNU C++11 TESTS 82 436 66150400 2700
38434586 wh2001_ZY E May 19, 2018, 2:59 p.m. OK GNU C++14 TESTS 82 405 44748800 2700
40932086 ReaLNero1 E July 30, 2018, 1:34 a.m. OK GNU C++14 TESTS 82 451 44748800 2700
44976409 zhzh2001 E Oct. 28, 2018, 5:49 a.m. OK GNU C++14 TESTS 82 529 48230400 2700
45448398 q234rty E Nov. 8, 2018, 2:34 p.m. OK GNU C++14 TESTS 82 561 101785600 2700
49886528 Xi_Jinping E Feb. 13, 2019, 9:56 p.m. OK GNU C++14 TESTS 82 592 65536000 2700
63248306 PhantasmDragon E Oct. 23, 2019, 3:16 p.m. OK GNU C++14 TESTS 82 592 128204800 2700
46909749 w446506278 E Dec. 11, 2018, 4:14 p.m. OK GNU C++14 TESTS 82 639 59494400 2700
38394961 thc E May 18, 2018, 8:38 a.m. OK GNU C++14 TESTS 82 639 77107200 2700
47149651 _Sakits E Dec. 17, 2018, 5:57 a.m. OK GNU C++14 TESTS 82 639 78540800 2700
38313112 linmiaomiao E May 16, 2018, 7:50 a.m. OK GNU C++14 TESTS 82 655 56832000 2700
38391997 kczno1 E May 18, 2018, 6:54 a.m. OK GNU C++17 TESTS 82 483 49664000 2700
51768870 kempusss E March 23, 2019, 5:18 p.m. OK GNU C++17 TESTS 82 670 68096000 2700
51770011 kempusss E March 23, 2019, 5:52 p.m. OK GNU C++17 TESTS 82 685 68096000 2700
47818058 MaGaroo E Jan. 1, 2019, 3:44 p.m. OK GNU C++17 TESTS 82 717 66355200 2700
51768890 kempusss E March 23, 2019, 5:19 p.m. OK GNU C++17 TESTS 82 717 68096000 2700
38302686 Livace E May 15, 2018, 8:44 p.m. OK GNU C++17 TESTS 82 717 68300800 2700
44597015 xianhaoming E Oct. 20, 2018, 12:49 p.m. OK GNU C++17 TESTS 82 732 59494400 2700
38289453 izban E May 15, 2018, 4:01 p.m. OK GNU C++17 TESTS 82 733 80179200 2700
64775039 neal E Nov. 13, 2019, 3:32 a.m. OK GNU C++17 TESTS 82 764 86937600 2700
68585273 user202729_ E Jan. 11, 2020, 11:06 a.m. OK GNU C++17 TESTS 82 779 77414400 2700
38289942 Egor E May 15, 2018, 4:04 p.m. OK Java 8 TESTS 82 1903 181350400 2700
39228735 tri E June 14, 2018, 12:37 a.m. OK Java 8 TESTS 82 2089 187904000 2700

remove filters

Back to search problems