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 |
|---|---|---|---|---|---|---|
| 923 | VK Cup 2018 - Round 1 | FINISHED | False | 7200 | 255709523 | March 10, 2018, 3:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 126 ) | F | Public Service | PROGRAMMING | constructive algorithms graphs trees | 2900 |
There are N cities in Bob's country connected by roads. Some pairs of cities are connected by public transport. There are two competing transport companies — Boblines operating buses and Bobrail running trains. When traveling from A to B , a passenger always first selects the mode of transport (either bus or train), and then embarks on a journey. For every pair of cities, there are exactly two ways of how to travel between them without visiting any city more than once — one using only bus routes, and the second using only train routes. Furthermore, there is no pair of cities that is directly connected by both a bus route and a train route. You obtained the plans of each of the networks. Unfortunately, each of the companies uses different names for the same cities. More precisely, the bus company numbers the cities using integers from 1 to N , while the train company uses integers between N + 1 and 2 N . Find one possible mapping between those two numbering schemes, such that no pair of cities is connected directly by both a bus route and a train route. Note that this mapping has to map different cities to different cities. The first line contains an integer N ( 2 ≤ N ≤ 10000 ), the number of cities. N - 1 lines follow, representing the network plan of Boblines. Each contains two integers u and v ( 1 ≤ u , v ≤ N ), meaning that there is a bus route between cities u and v . N - 1 lines follow, representing the network plan of Bobrail. Each contains two integers u and v ( N + 1 ≤ u , v ≤ 2 N ), meaning that there is a train route between cities u and v . If there is no solution, output a single line with the word " No ". If a solution exists, output two lines. On the first line, there should be the word " Yes ". On the second line, there should be N integers P 1 , P 2 , ..., P N ( N + 1 ≤ P i ≤ 2 N ) — the mapping between the two numbering schemes. More precisely, for i ≠ j it should be P i ≠ P j , and for every direct bus route ( i , j ) , there is no direct |
| VK Cup 2018 Round 1 and CF Round #470 (div. 1 & 2) editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 68010996 | Isonan | F | Dec. 31, 2019, 3:47 p.m. | OK | GNU C++11 | TESTS | 164 | 46 | 3276800 | 2900 | |
| 51560371 | foreverlasting | F | March 20, 2019, 7:42 a.m. | OK | GNU C++11 | TESTS | 164 | 62 | 5939200 | 2900 | |
| 51560481 | foreverlasting | F | March 20, 2019, 7:45 a.m. | OK | GNU C++11 | TESTS | 164 | 77 | 5939200 | 2900 | |
| 36207428 | temich | F | March 11, 2018, 5:57 p.m. | OK | GNU C++11 | TESTS | 164 | 93 | 9318400 | 2900 | |
| 37134342 | zhouyuyang | F | April 10, 2018, 2:22 a.m. | OK | GNU C++11 | TESTS | 164 | 93 | 15257600 | 2900 | |
| 57768029 | py_ultron | F | July 25, 2019, 10:03 p.m. | OK | GNU C++11 | TESTS | 164 | 217 | 14848000 | 2900 | |
| 57871557 | lopare | F | July 28, 2019, 2:13 a.m. | OK | GNU C++11 | TESTS | 164 | 233 | 14848000 | 2900 | |
| 36340444 | zxyhh | F | March 17, 2018, 2:59 a.m. | OK | GNU C++11 | TESTS | 164 | 2167 | 27545600 | 2900 | |
| 36300387 | sadpiajpdjajdpjapdj | F | March 15, 2018, 12:59 p.m. | OK | GNU C++11 | TESTS | 164 | 2167 | 27545600 | 2900 | |
| 36179631 | Memset137 | F | March 10, 2018, 9:11 p.m. | OK | GNU C++11 | TESTS | 164 | 2167 | 27545600 | 2900 | |
| 40978352 | ReaLNero1 | F | July 30, 2018, 4:36 p.m. | OK | GNU C++14 | TESTS | 164 | 46 | 2662400 | 2900 | |
| 52648872 | Motarack | F | April 12, 2019, 3:42 p.m. | OK | GNU C++14 | TESTS | 164 | 61 | 3686400 | 2900 | |
| 36211887 | zDule98 | F | March 11, 2018, 11:04 p.m. | OK | GNU C++14 | TESTS | 164 | 62 | 7168000 | 2900 | |
| 58169387 | yhdd | F | Aug. 2, 2019, 10:35 a.m. | OK | GNU C++14 | TESTS | 164 | 77 | 6041600 | 2900 | |
| 36238122 | apiadu | F | March 13, 2018, 3:23 a.m. | OK | GNU C++14 | TESTS | 164 | 77 | 13824000 | 2900 | |
| 36557499 | Xellos | F | March 23, 2018, 10:30 p.m. | OK | GNU C++14 | TESTS | 164 | 78 | 4710400 | 2900 | |
| 40475352 | choutii | F | July 17, 2018, 11:36 a.m. | OK | GNU C++14 | TESTS | 164 | 78 | 6348800 | 2900 | |
| 36972860 | jslijin | F | April 4, 2018, 3:53 p.m. | OK | GNU C++14 | TESTS | 164 | 186 | 18227200 | 2900 | |
| 38809587 | Send_._Nodes | F | May 31, 2018, 5:25 p.m. | OK | GNU C++14 | TESTS | 164 | 233 | 18329600 | 2900 | |
| 36975127 | jslijin | F | April 4, 2018, 4:06 p.m. | OK | GNU C++14 | TESTS | 164 | 233 | 18329600 | 2900 |
Back to search problems