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 |
---|---|---|---|---|---|---|
1710 | Codeforces Round 810 (Div. 1) | FINISHED | False | 7200 | 78506663 | July 24, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 431 ) | D | Recover the Tree | PROGRAMMING | constructive algorithms trees |
B"Rhodoks has a tree with n vertices, but he doesn't remember its structure. The vertices are indexed from 1 to n . A segment [l,r] ( 1 <= q l <= q r <= q n ) is good if the vertices with indices l , l + 1 , ..., r form a connected component in Rhodoks' tree. Otherwise, it is bad. For example, if the tree is the one in the picture, then only the segment [3,4] is bad while all the other segments are good. For each of the frac{n(n+1)}{2} segments, Rhodoks remembers whether it is good or bad. Can you help him recover the tree? If there are multiple solutions, print any. It is guaranteed that the there is at least one tree satisfying Rhodoks' description. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 1000 ). The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= q n <= q 2000 ) -- the number of vertices in the tree. Then n lines follow. The i -th of these lines contains a string good_i of length n+1-i consisting of 0 and 1. If the segment [i,i+j-1] is good then the j -th character of good_i is 1, otherwise j -th character of good_i is 0. It is guaranteed that the there is at least one tree consistent with the given data. It is guaranteed that the sum of n over all test cases does not exceed 2000 . For each test case, print n-1 lines describing the tree you recover. The i -th line should contain two integers u_i and v_i ( 1 <= q u_i,v_i <= q n ), denoting an edge between vertices u_i and v_i . If there are multiple solutions, print any. The first test case is explained in the statement. In the second test case, one possible tree is as follows: In the third test case, one possible tree is as follows: "... |
Codeforces Round #810 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
165622919 | fengqiyuka | D | July 25, 2022, 3:03 a.m. | OK | GNU C++14 | TESTS | 28 | 46 | 16179200 | ||
165627839 | gray-youth | D | July 25, 2022, 4:29 a.m. | OK | GNU C++14 | TESTS | 28 | 109 | 4096000 | ||
165576901 | fivedemands | D | July 24, 2022, 4:04 p.m. | OK | GNU C++17 | TESTS | 28 | 62 | 16486400 | ||
165610195 | wibucodedao | D | July 24, 2022, 10:22 p.m. | OK | GNU C++17 | TESTS | 28 | 62 | 25395200 | ||
165609141 | wibucodedao | D | July 24, 2022, 9:55 p.m. | OK | GNU C++17 | TESTS | 28 | 62 | 25395200 | ||
165594975 | Devil | D | July 24, 2022, 6:13 p.m. | OK | GNU C++17 | TESTS | 28 | 763 | 41164800 | ||
165621030 | zihouzhong | D | July 25, 2022, 2:34 a.m. | OK | GNU C++17 (64) | TESTS | 28 | 31 | 3481600 | ||
165615806 | vipjml | D | July 25, 2022, 1:01 a.m. | OK | GNU C++17 (64) | TESTS | 28 | 31 | 3481600 | ||
165615731 | vipjml | D | July 25, 2022, 12:59 a.m. | OK | GNU C++17 (64) | TESTS | 28 | 46 | 3481600 | ||
165591929 | Lawali | D | July 24, 2022, 5:47 p.m. | OK | GNU C++17 (64) | TESTS | 28 | 46 | 3584000 | ||
165583310 | hitonanode | D | July 24, 2022, 4:24 p.m. | OK | GNU C++17 (64) | TESTS | 28 | 46 | 7065600 | ||
165578412 | 353cerega | D | July 24, 2022, 4:08 p.m. | OK | GNU C++17 (64) | TESTS | 28 | 46 | 35532800 | ||
165579985 | 1092515504 | D | July 24, 2022, 4:13 p.m. | OK | GNU C++17 (64) | TESTS | 28 | 93 | 4300800 | ||
165594682 | Benq | D | July 24, 2022, 6:10 p.m. | OK | GNU C++17 (64) | TESTS | 28 | 108 | 3584000 | ||
165622179 | AoLiGei | D | July 25, 2022, 2:51 a.m. | OK | GNU C++17 (64) | TESTS | 28 | 873 | 40755200 | ||
165573207 | jiangly | D | July 24, 2022, 3:52 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 31 | 716800 | ||
165606079 | ecnerwala | D | July 24, 2022, 8:51 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 31 | 2560000 | ||
165606025 | ecnerwala | D | July 24, 2022, 8:50 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 31 | 2560000 | ||
165605909 | ecnerwala | D | July 24, 2022, 8:47 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 46 | 3993600 | ||
165629442 | Qingyu | D | July 25, 2022, 5:01 a.m. | OK | GNU C++20 (64) | TESTS | 28 | 46 | 35532800 | ||
165619265 | Ormlis | D | July 25, 2022, 2:04 a.m. | OK | GNU C++20 (64) | TESTS | 28 | 62 | 17408000 | ||
165578292 | greenheadstrange | D | July 24, 2022, 4:08 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 109 | 32665600 | ||
165580964 | nantf | D | July 24, 2022, 4:17 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 124 | 24883200 | ||
165582423 | Rebelz | D | July 24, 2022, 4:21 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 124 | 30310400 | ||
165592128 | stepanov.aa | D | July 24, 2022, 5:49 p.m. | OK | GNU C++20 (64) | TESTS | 28 | 155 | 18636800 |
Back to search problems