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 |
|---|---|---|---|---|---|---|
| 901 | Codeforces Round 453 (Div. 1) | FINISHED | False | 7200 | 262707923 | Dec. 19, 2017, 3:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 5372 ) | A | Hashing Trees | PROGRAMMING | constructive algorithms trees | 1500 |
Sasha is taking part in a programming competition. In one of the problems she should check if some rooted trees are isomorphic or not. She has never seen this problem before, but, being an experienced participant, she guessed that she should match trees to some sequences and then compare these sequences instead of trees. Sasha wants to match each tree with a sequence a 0 , a 1 , ..., a h , where h is the height of the tree, and a i equals to the number of vertices that are at distance of i edges from root. Unfortunately, this time Sasha's intuition was wrong, and there could be several trees matching the same sequence. To show it, you need to write a program that, given the sequence a i , builds two non-isomorphic rooted trees that match that sequence, or determines that there is only one such tree. Two rooted trees are isomorphic, if you can reenumerate the vertices of the first one in such a way, that the index of the root becomes equal the index of the root of the second tree, and these two trees become equal. The height of a rooted tree is the maximum number of edges on a path from the root to any other vertex. The first line contains a single integer h ( 2 ≤ h ≤ 10 5 ) — the height of the tree. The second line contains h + 1 integers — the sequence a 0 , a 1 , ..., a h ( 1 ≤ a i ≤ 2·10 5 ). The sum of all a i does not exceed 2·10 5 . It is guaranteed that there is at least one tree matching this sequence. If there is only one tree matching this sequence, print " perfect ". Otherwise print " ambiguous " in the first line. In the second and in the third line print descriptions of two trees in the following format: in one line print integers, the k -th of them should be the parent of vertex k or be equal to zero, if the k -th vertex is the root. These treese should be non-isomorphic and should match the given sequence. The only tree in the first example and the two printed trees from the second example are shown on the picture: |
| Codeforces Round #453 (Div. 1 & Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 33430088 | yosupo | A | Dec. 19, 2017, 4:53 p.m. | OK | D | TESTS | 45 | 109 | 14540800 | 1500 | |
| 42303435 | TShT | A | Aug. 31, 2018, 9:23 a.m. | OK | FPC | TESTS | 45 | 732 | 1638400 | 1500 | |
| 35924223 | Butylochnik | A | March 4, 2018, 1:26 p.m. | OK | GNU C | TESTS | 45 | 108 | 4300800 | 1500 | |
| 33437556 | pk1210 | A | Dec. 19, 2017, 7:17 p.m. | OK | GNU C | TESTS | 45 | 109 | 2252800 | 1500 | |
| 33417979 | yasugongshang | A | Dec. 19, 2017, 3:53 p.m. | OK | GNU C++ | TESTS | 45 | 31 | 2457600 | 1500 | |
| 34430888 | Scut82 | A | Jan. 22, 2018, 3:30 a.m. | OK | GNU C++ | TESTS | 45 | 31 | 2457600 | 1500 | |
| 34344248 | Scut82 | A | Jan. 20, 2018, 8:14 a.m. | OK | GNU C++ | TESTS | 45 | 31 | 4608000 | 1500 | |
| 34341964 | Scut82 | A | Jan. 20, 2018, 7:01 a.m. | OK | GNU C++ | TESTS | 45 | 31 | 5222400 | 1500 | |
| 33421303 | khatribiru | A | Dec. 19, 2017, 4:05 p.m. | OK | GNU C++ | TESTS | 45 | 78 | 11673600 | 1500 | |
| 33862310 | _rqy | A | Jan. 2, 2018, 11:14 a.m. | OK | GNU C++ | TESTS | 45 | 93 | 2252800 | 1500 | |
| 33469701 | sweet_love | A | Dec. 21, 2017, 3:44 a.m. | OK | GNU C++ | TESTS | 45 | 93 | 2457600 | 1500 | |
| 34341747 | Scut82 | A | Jan. 20, 2018, 6:55 a.m. | OK | GNU C++ | TESTS | 45 | 93 | 2457600 | 1500 | |
| 33452382 | DoanPhuDuc | A | Dec. 20, 2017, 10:33 a.m. | OK | GNU C++ | TESTS | 45 | 93 | 2457600 | 1500 | |
| 33416086 | suhendry | A | Dec. 19, 2017, 3:48 p.m. | OK | GNU C++ | TESTS | 45 | 93 | 2457600 | 1500 | |
| 33453362 | Akarin_kawaii | A | Dec. 20, 2017, 11:12 a.m. | OK | GNU C11 | TESTS | 45 | 1591 | 2662400 | 1500 | |
| 33748399 | Umi | A | Dec. 29, 2017, 1:56 a.m. | OK | GNU C++11 | TESTS | 45 | 31 | 2457600 | 1500 | |
| 33417077 | __math | A | Dec. 19, 2017, 3:50 p.m. | OK | GNU C++11 | TESTS | 45 | 31 | 5632000 | 1500 | |
| 54094481 | luogu_bot5 | A | May 14, 2019, 12:26 p.m. | OK | GNU C++11 | TESTS | 45 | 46 | 5734400 | 1500 | |
| 54068423 | HNYLMS_Tea | A | May 13, 2019, 2:42 p.m. | OK | GNU C++11 | TESTS | 45 | 46 | 5734400 | 1500 | |
| 65950771 | ouuan | A | Nov. 29, 2019, 10:46 a.m. | OK | GNU C++11 | TESTS | 45 | 62 | 819200 | 1500 | |
| 40978894 | ReaLNero1 | A | July 30, 2018, 4:51 p.m. | OK | GNU C++11 | TESTS | 45 | 62 | 3584000 | 1500 | |
| 45053154 | sckalrter | A | Oct. 29, 2018, 11:37 a.m. | OK | GNU C++11 | TESTS | 45 | 78 | 4812800 | 1500 | |
| 56887770 | vjudge1 | A | July 12, 2019, 1:29 p.m. | OK | GNU C++11 | TESTS | 45 | 93 | 409600 | 1500 | |
| 54067510 | wibE | A | May 13, 2019, 2:15 p.m. | OK | GNU C++11 | TESTS | 45 | 93 | 614400 | 1500 | |
| 54094017 | z_q_c | A | May 14, 2019, 12:13 p.m. | OK | GNU C++11 | TESTS | 45 | 93 | 819200 | 1500 | |
| 33415929 | Miyukine | A | Dec. 19, 2017, 3:48 p.m. | OK | GNU C++14 | TESTS | 45 | 62 | 13926400 | 1500 | |
| 48305909 | Hamza | A | Jan. 12, 2019, 7:46 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2048000 | 1500 | |
| 33444098 | AsahiKasugano | A | Dec. 20, 2017, 3:37 a.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33416932 | WillyPillow | A | Dec. 19, 2017, 3:50 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33416743 | cristian1997 | A | Dec. 19, 2017, 3:50 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33416149 | SureYeaah | A | Dec. 19, 2017, 3:48 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33415237 | Vergara | A | Dec. 19, 2017, 3:46 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33414879 | IvL | A | Dec. 19, 2017, 3:45 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33594217 | SpeedOfMagic | A | Dec. 24, 2017, 1:26 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2252800 | 1500 | |
| 33418237 | Hoi_koro | A | Dec. 19, 2017, 3:54 p.m. | OK | GNU C++14 | TESTS | 45 | 77 | 2355200 | 1500 | |
| 41079958 | Qlukva | A | Aug. 1, 2018, 11:12 a.m. | OK | GNU C++17 | TESTS | 45 | 78 | 2969600 | 1500 | |
| 41397999 | samgiz | A | Aug. 9, 2018, 12:07 p.m. | OK | GNU C++17 | TESTS | 45 | 78 | 3788800 | 1500 | |
| 69242390 | TongChu | A | Jan. 21, 2020, 11:50 a.m. | OK | GNU C++17 | TESTS | 45 | 78 | 3993600 | 1500 | |
| 67423476 | Arpa | A | Dec. 22, 2019, 12:36 p.m. | OK | GNU C++17 | TESTS | 45 | 93 | 409600 | 1500 | |
| 51607480 | le9018468 | A | March 21, 2019, 8:20 a.m. | OK | GNU C++17 | TESTS | 45 | 93 | 409600 | 1500 | |
| 51599668 | tiandong123 | A | March 21, 2019, 2:21 a.m. | OK | GNU C++17 | TESTS | 45 | 93 | 512000 | 1500 | |
| 42544757 | Ilya-bar | A | Sept. 6, 2018, 8:22 a.m. | OK | GNU C++17 | TESTS | 45 | 93 | 614400 | 1500 | |
| 65995292 | __Ash__ | A | Nov. 29, 2019, 5:28 p.m. | OK | GNU C++17 | TESTS | 45 | 93 | 819200 | 1500 | |
| 64548233 | mblazev | A | Nov. 8, 2019, 9:01 p.m. | OK | GNU C++17 | TESTS | 45 | 93 | 1228800 | 1500 | |
| 61851900 | AThousandMoon | A | Oct. 4, 2019, 12:57 p.m. | OK | GNU C++17 | TESTS | 45 | 93 | 1638400 | 1500 | |
| 67768630 | supriya14 | A | Dec. 28, 2019, 5:40 a.m. | OK | Java 8 | TESTS | 45 | 155 | 29081600 | 1500 | |
| 33415211 | uwi | A | Dec. 19, 2017, 3:46 p.m. | OK | Java 8 | TESTS | 45 | 186 | 20787200 | 1500 | |
| 33444063 | Ruins | A | Dec. 20, 2017, 3:34 a.m. | OK | Java 8 | TESTS | 45 | 186 | 20787200 | 1500 | |
| 33418967 | barakraganosungam | A | Dec. 19, 2017, 3:56 p.m. | OK | Java 8 | TESTS | 45 | 186 | 20787200 | 1500 | |
| 53660806 | prem_cse | A | May 2, 2019, 7:35 a.m. | OK | Java 8 | TESTS | 45 | 187 | 0 | 1500 | |
| 33418368 | alexyz | A | Dec. 19, 2017, 3:54 p.m. | OK | Java 8 | TESTS | 45 | 187 | 20787200 | 1500 | |
| 34095232 | pz049 | A | Jan. 11, 2018, 7:09 p.m. | OK | Java 8 | TESTS | 45 | 187 | 35532800 | 1500 | |
| 39885037 | kunal725725 | A | July 3, 2018, 6:25 a.m. | OK | Java 8 | TESTS | 45 | 202 | 10035200 | 1500 | |
| 35102622 | _bacali | A | Feb. 9, 2018, 6:48 p.m. | OK | Java 8 | TESTS | 45 | 202 | 20787200 | 1500 | |
| 34494033 | coderbond007 | A | Jan. 23, 2018, 7:16 p.m. | OK | Java 8 | TESTS | 45 | 202 | 20787200 | 1500 | |
| 34789225 | chopik | A | Feb. 1, 2018, 4:50 a.m. | OK | Kotlin | TESTS | 45 | 1294 | 23142400 | 1500 | |
| 33414418 | chokudai | A | Dec. 19, 2017, 3:44 p.m. | OK | MS C# | TESTS | 45 | 124 | 26112000 | 1500 | |
| 35742854 | RCG | A | Feb. 26, 2018, 7:09 p.m. | OK | MS C++ | TESTS | 45 | 93 | 2969600 | 1500 | |
| 33695016 | Maffka | A | Dec. 27, 2017, 7:54 p.m. | OK | MS C++ | TESTS | 45 | 93 | 4505600 | 1500 | |
| 33812763 | scorpiowf | A | Dec. 30, 2017, 3:32 p.m. | OK | MS C++ | TESTS | 45 | 108 | 2867200 | 1500 | |
| 33754850 | LoneFox | A | Dec. 29, 2017, 8:37 a.m. | OK | MS C++ | TESTS | 45 | 109 | 3276800 | 1500 | |
| 33760016 | Saif_AlmShaGa | A | Dec. 29, 2017, 12:53 p.m. | OK | MS C++ | TESTS | 45 | 140 | 2457600 | 1500 | |
| 33417411 | innok96 | A | Dec. 19, 2017, 3:51 p.m. | OK | MS C++ | TESTS | 45 | 140 | 2457600 | 1500 | |
| 33438086 | AleksanderBalobanov | A | Dec. 19, 2017, 7:32 p.m. | OK | MS C++ | TESTS | 45 | 249 | 3276800 | 1500 | |
| 66179088 | vjudge1 | A | Dec. 2, 2019, 12:13 p.m. | OK | MS C++ | TESTS | 45 | 264 | 409600 | 1500 | |
| 36191587 | vjudge3 | A | March 11, 2018, 8:08 a.m. | OK | MS C++ | TESTS | 45 | 280 | 2867200 | 1500 | |
| 33456337 | Redisko | A | Dec. 20, 2017, 1:24 p.m. | OK | MS C++ | TESTS | 45 | 280 | 14131200 | 1500 | |
| 33461678 | StinsonOvO | A | Dec. 20, 2017, 4:51 p.m. | OK | PyPy 3 | TESTS | 45 | 483 | 40857600 | 1500 | |
| 33458618 | nwi | A | Dec. 20, 2017, 2:45 p.m. | OK | Python 2 | TESTS | 45 | 202 | 20480000 | 1500 | |
| 35088494 | laoliumang | A | Feb. 9, 2018, 11:57 a.m. | OK | Python 2 | TESTS | 45 | 311 | 19660800 | 1500 | |
| 33449109 | xlk | A | Dec. 20, 2017, 7:59 a.m. | OK | Python 2 | TESTS | 45 | 405 | 11366400 | 1500 | |
| 33803595 | nealzane | A | Dec. 30, 2017, 7:45 a.m. | OK | Python 2 | TESTS | 45 | 420 | 7987200 | 1500 | |
| 33421734 | jochang | A | Dec. 19, 2017, 4:07 p.m. | OK | Python 2 | TESTS | 45 | 452 | 7987200 | 1500 | |
| 59185577 | invictus_123 | A | Aug. 20, 2019, 6:27 p.m. | OK | Python 3 | TESTS | 45 | 311 | 14028800 | 1500 | |
| 52582229 | vjudge3 | A | April 10, 2019, 7:57 p.m. | OK | Python 3 | TESTS | 45 | 358 | 18227200 | 1500 | |
| 52582219 | ddelcastillo | A | April 10, 2019, 7:56 p.m. | OK | Python 3 | TESTS | 45 | 358 | 18227200 | 1500 | |
| 33462527 | MSteine | A | Dec. 20, 2017, 5:29 p.m. | OK | Python 3 | TESTS | 45 | 374 | 12697600 | 1500 | |
| 48066705 | Mtaylor | A | Jan. 7, 2019, 6:34 p.m. | OK | Python 3 | TESTS | 45 | 421 | 7168000 | 1500 | |
| 69846209 | T1duS | A | Jan. 30, 2020, 2:24 p.m. | OK | Python 3 | TESTS | 45 | 873 | 6348800 | 1500 | |
| 34523286 | KulikAlex | A | Jan. 24, 2018, 4:43 p.m. | OK | Python 3 | TESTS | 45 | 966 | 11059200 | 1500 | |
| 33456651 | dvec | A | Dec. 20, 2017, 1:34 p.m. | OK | Python 3 | TESTS | 45 | 1029 | 15257600 | 1500 | |
| 42120357 | Mk_Python_v1 | A | Aug. 26, 2018, 12:09 p.m. | OK | Python 3 | TESTS | 45 | 1091 | 8499200 | 1500 | |
| 33416197 | meooow | A | Dec. 19, 2017, 3:48 p.m. | OK | Python 3 | TESTS | 45 | 1123 | 15974400 | 1500 |
Back to search problems