8VC Venture Cup 2016 - Final Round

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
627 8VC Venture Cup 2016 - Final Round FINISHED False 7200 319722623 Feb. 28, 2016, 6:10 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 251 ) F Island Puzzle PROGRAMMING dfs and similar dsu graphs trees 3400

A remote island chain contains n islands, with some bidirectional bridges between them. The current bridge network forms a tree. In other words, a total of n - 1 bridges connect pairs of islands in a way that it's possible to reach any island from any other island using the bridge network. The center of each island contains an identical pedestal, and all but one of the islands has a fragile, uniquely colored statue currently held on the pedestal. The remaining island holds only an empty pedestal. The islanders want to rearrange the statues in a new order. To do this, they repeat the following process: first, they choose an island directly adjacent to the island containing an empty pedestal. Then, they painstakingly carry the statue on this island across the adjoining bridge and place it on the empty pedestal. It is often impossible to rearrange statues in the desired order using only the operation described above. The islanders would like to build one additional bridge in order to make this achievable in the fewest number of movements possible. Find the bridge to construct and the minimum number of statue movements necessary to arrange the statues in the desired position. The first line contains a single integer n ( 2 ≤ n ≤ 200 000 ) — the total number of islands. The second line contains n space-separated integers a i ( 0 ≤ a i ≤ n - 1 ) — the statue currently located on the i -th island. If a i = 0 , then the island has no statue. It is guaranteed that the a i are distinct. The third line contains n space-separated integers b i ( 0 ≤ b i ≤ n - 1 ) — the desired statues of the i -th island. Once again, b i = 0 indicates the island desires no statue. It is guaranteed that the b i are distinct. The next n - 1 lines each contain two distinct space-separated integers u i and v i ( 1 ≤ u i , v i ≤ n ) — the endpoints of the i -th bridge. Bridges form a tree, and it is guaranteed that no bridge is listed twice in the input. Print a single line of integers: If t

Tutorials

8VC Venture Cup 2016 — Final Round Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
40985141 ReaLNero1 F July 30, 2018, 7:46 p.m. OK GNU C++ TESTS 90 62 14643200 3400
26350599 tlzmybm F April 14, 2017, 5:13 a.m. OK GNU C++ TESTS 90 62 27136000 3400
26096625 Jin_Haonan F April 3, 2017, 10:20 a.m. OK GNU C++ TESTS 90 77 16691200 3400
26351631 Manchery F April 14, 2017, 7:01 a.m. OK GNU C++ TESTS 90 93 19763200 3400
16686487 jcvb F March 13, 2016, 6:33 a.m. OK GNU C++ TESTS 90 139 16076800 3400
37512162 DCXDCX F April 21, 2018, 11:16 a.m. OK GNU C++ TESTS 90 140 15769600 3400
37512852 DCXDCX F April 21, 2018, 11:47 a.m. OK GNU C++ TESTS 90 155 15769600 3400
17185600 feski F April 6, 2016, 11:46 a.m. OK GNU C++ TESTS 90 156 15667200 3400
17012922 lgs10086 F March 29, 2016, 2:36 a.m. OK GNU C++ TESTS 90 156 15667200 3400
37512624 DCXDCX F April 21, 2018, 11:36 a.m. OK GNU C++ TESTS 90 156 15769600 3400
47266315 vjudge5 F Dec. 19, 2018, 2:28 p.m. OK GNU C++11 TESTS 90 61 26624000 3400
69960833 tacmon F Feb. 1, 2020, 11:25 a.m. OK GNU C++11 TESTS 90 62 13004800 3400
64205347 boshi F Nov. 4, 2019, 12:43 p.m. OK GNU C++11 TESTS 90 77 25804800 3400
64280970 boshi F Nov. 5, 2019, 1:46 a.m. OK GNU C++11 TESTS 90 78 25804800 3400
47354312 yukuai26 F Dec. 22, 2018, 5:19 a.m. OK GNU C++11 TESTS 90 78 26624000 3400
57882295 lopare F July 28, 2019, 8:20 a.m. OK GNU C++11 TESTS 90 124 15872000 3400
33507393 xc01 F Dec. 22, 2017, 12:55 p.m. OK GNU C++11 TESTS 90 124 17715200 3400
66498976 Lagoon_ F Dec. 8, 2019, 11:43 a.m. OK GNU C++11 TESTS 90 140 12492800 3400
67965665 vjudge2 F Dec. 30, 2019, 1:15 p.m. OK GNU C++11 TESTS 90 140 13209600 3400
47359327 zhouyuyang F Dec. 22, 2018, 7:50 a.m. OK GNU C++11 TESTS 90 140 38809600 3400
64293056 BJpers3 F Nov. 5, 2019, 7:44 a.m. OK GNU C++14 TESTS 90 202 12902400 3400
64072121 yhx-12243 F Nov. 2, 2019, 7:45 a.m. OK GNU C++14 TESTS 90 202 15257600 3400
69275750 wucstdio F Jan. 22, 2020, 1:54 a.m. OK GNU C++14 TESTS 90 217 29798400 3400
23575096 vjudge4 F Jan. 6, 2017, 1:43 a.m. OK GNU C++14 TESTS 90 248 15564800 3400
64344980 lyx_cjz F Nov. 6, 2019, 5:42 a.m. OK GNU C++14 TESTS 90 264 15155200 3400
64439942 zhongyuwei F Nov. 7, 2019, 3:42 a.m. OK GNU C++14 TESTS 90 265 13414400 3400
69407120 orbitingflea F Jan. 23, 2020, 11:14 a.m. OK GNU C++14 TESTS 90 265 58163200 3400
64440070 vjudge4 F Nov. 7, 2019, 3:47 a.m. OK GNU C++14 TESTS 90 280 13414400 3400
47354139 emoairx F Dec. 22, 2018, 5:14 a.m. OK GNU C++14 TESTS 90 280 13824000 3400
68481975 rushcheyo F Jan. 10, 2020, 8:07 a.m. OK GNU C++14 TESTS 90 280 14950400 3400
64454045 vjudge3 F Nov. 7, 2019, 8:06 a.m. OK GNU C++17 TESTS 90 202 12902400 3400
64453955 LJZ_C F Nov. 7, 2019, 8:05 a.m. OK GNU C++17 TESTS 90 218 13209600 3400
68107082 Tgiwx F Jan. 3, 2020, 7:41 a.m. OK GNU C++17 TESTS 90 264 12288000 3400
69715691 ruo F Jan. 29, 2020, 8:55 a.m. OK GNU C++17 TESTS 90 265 18227200 3400
68406495 Elegia F Jan. 8, 2020, 3:08 p.m. OK GNU C++17 TESTS 90 295 18534400 3400
62575959 ak_taniya F Oct. 14, 2019, 3:54 p.m. OK GNU C++17 TESTS 90 327 15769600 3400
64296098 AprilGrimoire F Nov. 5, 2019, 8:39 a.m. OK GNU C++17 TESTS 90 327 25702400 3400
69611045 gongsuidashen F Jan. 27, 2020, 11:30 a.m. OK GNU C++17 TESTS 90 358 15769600 3400
47063653 Beslan F Dec. 15, 2018, 3:47 p.m. OK GNU C++17 TESTS 90 358 15769600 3400
47178815 Beslan F Dec. 17, 2018, 7:09 p.m. OK GNU C++17 TESTS 90 1029 15769600 3400
16436983 Strochik12 F March 1, 2016, 7:27 a.m. OK Java 8 TESTS 90 576 39219200 3400
16436966 Slendermen00 F March 1, 2016, 7:26 a.m. OK Java 8 TESTS 90 576 39219200 3400
16420920 WorldWeb F Feb. 29, 2016, 5:20 a.m. OK Java 8 TESTS 90 576 39219200 3400
16418329 Petr F Feb. 28, 2016, 10:43 p.m. OK Java 8 TESTS 90 639 39219200 3400
36458717 issiz F March 21, 2018, 3:59 p.m. OK Java 8 TESTS 90 935 117862400 3400
17272940 Los_Angelos_Laycurse F April 11, 2016, 2:10 a.m. OK MS C++ TESTS 90 280 56217600 3400

remove filters

Back to search problems