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 |
---|---|---|---|---|---|---|
1211 | Kotlin Heroes: Episode 2 | FINISHED | False | 9000 | 169572287 | Sept. 7, 2019, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 72 ) | G | King's Path | PROGRAMMING | *special math trees | 2500 |
B"There are n cities and n-1 two-way roads in Treeland. Each road connects a pair of different cities. From any city you can drive to any other, moving only along the roads. Cities are numbered from 1 to n . Yes, of course, you recognized an undirected tree in this description. There is exactly one flag in each city, in the i -th city the flag color is c_i . The colors of the flags in different cities may be the same. If the King travels along the route [u_1, u_2, u_3, ... , u_k] , then this means that he starts in the city u_1 , then moves to the city u_2 ( u_2 is connected by road with u_1 ), then from u_2 to u_3 ( u_3 is connected by road to u_2 ), and so on until he arrives in the city of u_k . It is possible that during this route the King will visit the same city more than once. In other words, the route [u_1, u_2, u_3, ... , u_k] does not necessarily consist of different cities. In terms of graph theory -- the King moves from u_1 to u_k along some path [u_1, u_2, u_3, ... , u_k] , which is not necessarily simple (for all j from 1 to k-1 of the city u_j and u_{j+1} are connected by road). When the King moves from one city to another, city heads exchange flags as a sign of their friendship. For aesthetic reasons, the King wants the flag color in the city i to be equal to d_i for all i from 1 to n . Determine whether the King can choose some route and drive along it so that for each city the flag color in it turns out to be equal to the desired color d_i . Note that the King can choose (and drive) exactly one route. If yes, find the shortest possible route for the King. If the initial colors of the flags already match the King's requirements (i.e. c_i=d_i for all i ), then consider that the King makes a route of length k=0 . The first line contains an integer t$"... |
Kotlin Heroes: Episode 2 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
60227904 | eatmore | G | Sept. 7, 2019, 3:37 p.m. | OK | Kotlin | TESTS | 75 | 405 | 17510400 | 2500 | |
60231986 | Slamur | G | Sept. 7, 2019, 4:47 p.m. | OK | Kotlin | TESTS | 75 | 639 | 44236800 | 2500 | |
60232018 | .tx | G | Sept. 7, 2019, 4:48 p.m. | OK | Kotlin | TESTS | 75 | 639 | 57139200 | 2500 | |
60230528 | xiaowuc1 | G | Sept. 7, 2019, 4:19 p.m. | OK | Kotlin | TESTS | 75 | 717 | 120934400 | 2500 | |
60234084 | alexey.enkov | G | Sept. 7, 2019, 5:33 p.m. | OK | Kotlin | TESTS | 75 | 842 | 66150400 | 2500 | |
60232843 | liouzhou_101 | G | Sept. 7, 2019, 5:03 p.m. | OK | Kotlin | TESTS | 75 | 873 | 176640000 | 2500 | |
60232494 | aleex | G | Sept. 7, 2019, 4:57 p.m. | OK | Kotlin | TESTS | 75 | 935 | 172748800 | 2500 | |
60229712 | DmitryGrigorev | G | Sept. 7, 2019, 4:05 p.m. | OK | Kotlin | TESTS | 75 | 936 | 201523200 | 2500 | |
60232737 | _lo | G | Sept. 7, 2019, 5:01 p.m. | OK | Kotlin | TESTS | 75 | 1060 | 130969600 | 2500 | |
60228578 | Benq | G | Sept. 7, 2019, 3:47 p.m. | OK | Kotlin | TESTS | 75 | 1154 | 72294400 | 2500 |
Back to search problems