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 |
|---|---|---|---|---|---|---|
| 599 | Codeforces Round 332 (Div. 2) | FINISHED | False | 7200 | 328368323 | Nov. 20, 2015, 4:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 760 ) | E | Sandy and Nuts | PROGRAMMING | bitmasks dp trees | 2100 |
Rooted tree is a connected graph without any simple cycles with one vertex selected as a root. In this problem the vertex number 1 will always serve as a root. Lowest common ancestor of two vertices u and v is the farthest from the root vertex that lies on both the path from u to the root and on path from v to the root. We will denote it as LCA ( u , v ) . Sandy had a rooted tree consisting of n vertices that she used to store her nuts. Unfortunately, the underwater storm broke her tree and she doesn't remember all it's edges. She only managed to restore m edges of the initial tree and q triples a i , b i and c i , for which she supposes LCA ( a i , b i ) = c i . Help Sandy count the number of trees of size n with vertex 1 as a root, that match all the information she remembered. If she made a mess and there are no such trees then print 0 . Two rooted trees are considered to be distinct if there exists an edge that occur in one of them and doesn't occur in the other one. The first line of the input contains three integers n , m and q ( 1 ≤ n ≤ 13, 0 ≤ m < n , 0 ≤ q ≤ 100 ) — the number of vertices, the number of edges and LCA triples remembered by Sandy respectively. Each of the next m lines contains two integers u i and v i ( 1 ≤ u i , v i ≤ n , u i ≠ v i ) — the numbers of vertices connected by the i -th edge. It's guaranteed that this set of edges is a subset of edges of some tree. The last q lines contain the triplets of numbers a i , b i , c i ( 1 ≤ a i , b i , c i ≤ n ) . Each of these triples define LCA ( a i , b i ) = c i . It's not guaranteed that there exists a tree that satisfy all the given LCA conditions. Print a single integer — the number of trees of size n that satisfy all the conditions. In the second sample correct answer looks like this: In the third sample there are two possible trees: In the fourth sample the answer is 0 because the information about LCA is inconsistent. |
| Editorial Codeforces Round #332 (Div. 2) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 14421072 | FlierKing | E | Nov. 23, 2015, 3:02 a.m. | OK | GNU C++ | TESTS | 142 | 15 | 1024000 | 2100 | |
| 14414535 | I_so_sad | E | Nov. 22, 2015, 1:39 p.m. | OK | GNU C++ | TESTS | 142 | 15 | 1024000 | 2100 | |
| 14421616 | MohanLau | E | Nov. 23, 2015, 4:49 a.m. | OK | GNU C++ | TESTS | 142 | 31 | 1024000 | 2100 | |
| 14420753 | MohanLau | E | Nov. 23, 2015, 1:48 a.m. | OK | GNU C++ | TESTS | 142 | 31 | 1024000 | 2100 | |
| 19301297 | zhan8855 | E | July 21, 2016, 11:56 a.m. | OK | GNU C++ | TESTS | 142 | 31 | 1126400 | 2100 | |
| 40985732 | ReaLNero1 | E | July 30, 2018, 8:08 p.m. | OK | GNU C++ | TESTS | 142 | 46 | 1024000 | 2100 | |
| 41234893 | luogu_bot2 | E | Aug. 5, 2018, 6:39 a.m. | OK | GNU C++ | TESTS | 142 | 46 | 4710400 | 2100 | |
| 20209332 | vjudge1 | E | Aug. 28, 2016, 10:24 a.m. | OK | GNU C++ | TESTS | 142 | 46 | 6860800 | 2100 | |
| 15413611 | justryit | E | Jan. 17, 2016, 11:16 a.m. | OK | GNU C++ | TESTS | 142 | 62 | 819200 | 2100 | |
| 15286967 | vjudge2 | E | Jan. 11, 2016, 11:31 a.m. | OK | GNU C++ | TESTS | 142 | 62 | 921600 | 2100 | |
| 58192284 | rainboy | E | Aug. 2, 2019, 8:26 p.m. | OK | GNU C11 | TESTS | 142 | 234 | 2252800 | 2100 | |
| 19224623 | Oktavia | E | July 19, 2016, 5:27 a.m. | OK | GNU C++11 | TESTS | 142 | 30 | 1024000 | 2100 | |
| 19224769 | Oktavia | E | July 19, 2016, 5:38 a.m. | OK | GNU C++11 | TESTS | 142 | 30 | 1024000 | 2100 | |
| 19226873 | Oktavia | E | July 19, 2016, 8:05 a.m. | OK | GNU C++11 | TESTS | 142 | 31 | 819200 | 2100 | |
| 14435512 | DemiGuo | E | Nov. 24, 2015, 6:02 a.m. | OK | GNU C++11 | TESTS | 142 | 31 | 1024000 | 2100 | |
| 20209476 | hnuRoshan | E | Aug. 28, 2016, 10:34 a.m. | OK | GNU C++11 | TESTS | 142 | 31 | 6860800 | 2100 | |
| 45036661 | zyt1253679098 | E | Oct. 29, 2018, 8:07 a.m. | OK | GNU C++11 | TESTS | 142 | 46 | 716800 | 2100 | |
| 45407032 | remember | E | Nov. 7, 2018, 10:02 a.m. | OK | GNU C++11 | TESTS | 142 | 46 | 2048000 | 2100 | |
| 14677077 | khoaisohd | E | Dec. 6, 2015, 2:51 p.m. | OK | GNU C++11 | TESTS | 142 | 61 | 819200 | 2100 | |
| 62183683 | AsrielDreamer | E | Oct. 9, 2019, 7:25 a.m. | OK | GNU C++11 | TESTS | 142 | 61 | 1843200 | 2100 | |
| 14629333 | MadNick | E | Dec. 3, 2015, 6:26 a.m. | OK | GNU C++11 | TESTS | 142 | 62 | 819200 | 2100 | |
| 23386139 | Ali.Pi | E | Dec. 28, 2016, 8:05 p.m. | OK | GNU C++14 | TESTS | 142 | 61 | 2969600 | 2100 | |
| 45054526 | WZJ423 | E | Oct. 29, 2018, 12:10 p.m. | OK | GNU C++14 | TESTS | 142 | 78 | 1945600 | 2100 | |
| 58138899 | stefanbalaz2 | E | Aug. 1, 2019, 5:16 p.m. | OK | GNU C++14 | TESTS | 142 | 93 | 921600 | 2100 | |
| 47271574 | anis028 | E | Dec. 19, 2018, 4:56 p.m. | OK | GNU C++14 | TESTS | 142 | 93 | 1843200 | 2100 | |
| 45060348 | q234rty | E | Oct. 29, 2018, 2:31 p.m. | OK | GNU C++14 | TESTS | 142 | 93 | 11366400 | 2100 | |
| 45056512 | q234rty | E | Oct. 29, 2018, 12:58 p.m. | OK | GNU C++14 | TESTS | 142 | 108 | 11366400 | 2100 | |
| 52567462 | NiroBC | E | April 10, 2019, 12:57 p.m. | OK | GNU C++14 | TESTS | 142 | 109 | 2150400 | 2100 | |
| 62841201 | Zory | E | Oct. 18, 2019, 2:50 a.m. | OK | GNU C++14 | TESTS | 142 | 124 | 1024000 | 2100 | |
| 48875352 | fmrozaqi | E | Jan. 24, 2019, 7:56 a.m. | OK | GNU C++14 | TESTS | 142 | 124 | 1945600 | 2100 | |
| 28306679 | boook | E | July 5, 2017, 2:49 p.m. | OK | GNU C++14 | TESTS | 142 | 124 | 10342400 | 2100 | |
| 55508610 | cjtoribio | E | June 12, 2019, 7:50 p.m. | OK | GNU C++17 | TESTS | 142 | 61 | 1024000 | 2100 | |
| 55508597 | cjtoribio | E | June 12, 2019, 7:50 p.m. | OK | GNU C++17 | TESTS | 142 | 61 | 1024000 | 2100 | |
| 55508634 | cjtoribio | E | June 12, 2019, 7:52 p.m. | OK | GNU C++17 | TESTS | 142 | 62 | 1024000 | 2100 | |
| 67973824 | ruo | E | Dec. 30, 2019, 4:04 p.m. | OK | GNU C++17 | TESTS | 142 | 62 | 1024000 | 2100 | |
| 47187378 | luogu_bot2 | E | Dec. 18, 2018, 5:43 a.m. | OK | GNU C++17 | TESTS | 142 | 93 | 819200 | 2100 | |
| 56062767 | misir | E | June 26, 2019, 6:24 a.m. | OK | GNU C++17 | TESTS | 142 | 155 | 1126400 | 2100 | |
| 50494645 | vjudge2 | E | Feb. 25, 2019, 2:40 p.m. | OK | GNU C++17 | TESTS | 142 | 156 | 3891200 | 2100 | |
| 66146607 | AM. | E | Dec. 1, 2019, 4:52 p.m. | OK | GNU C++17 | TESTS | 142 | 217 | 1126400 | 2100 | |
| 47231942 | Medeowex | E | Dec. 18, 2018, 6:31 p.m. | OK | GNU C++17 | TESTS | 142 | 218 | 8294400 | 2100 | |
| 66148021 | AM. | E | Dec. 1, 2019, 5:32 p.m. | OK | GNU C++17 | TESTS | 142 | 234 | 1126400 | 2100 | |
| 14460605 | gpita | E | Nov. 24, 2015, 11:35 p.m. | OK | Java 7 | TESTS | 142 | 779 | 0 | 2100 | |
| 15323350 | antonkov | E | Jan. 12, 2016, 9:16 p.m. | OK | Java 8 | TESTS | 142 | 202 | 0 | 2100 | |
| 14419888 | I_Need_Alex_R_Coleman | E | Nov. 22, 2015, 10:14 p.m. | OK | Java 8 | TESTS | 142 | 217 | 0 | 2100 | |
| 14419932 | I_Need_Alex_R_Coleman | E | Nov. 22, 2015, 10:19 p.m. | OK | Java 8 | TESTS | 142 | 233 | 0 | 2100 | |
| 14429040 | opticoder | E | Nov. 23, 2015, 3:35 p.m. | OK | Java 8 | TESTS | 142 | 249 | 0 | 2100 | |
| 14422332 | Ruins | E | Nov. 23, 2015, 6:37 a.m. | OK | Java 8 | TESTS | 142 | 249 | 0 | 2100 | |
| 14435368 | safarisoul | E | Nov. 24, 2015, 5:40 a.m. | OK | Java 8 | TESTS | 142 | 311 | 0 | 2100 | |
| 14435035 | safarisoul | E | Nov. 24, 2015, 4:40 a.m. | OK | Java 8 | TESTS | 142 | 311 | 0 | 2100 | |
| 14434773 | safarisoul | E | Nov. 24, 2015, 3:54 a.m. | OK | Java 8 | TESTS | 142 | 311 | 0 | 2100 | |
| 14434945 | safarisoul | E | Nov. 24, 2015, 4:27 a.m. | OK | Java 8 | TESTS | 142 | 312 | 0 | 2100 | |
| 14435206 | safarisoul | E | Nov. 24, 2015, 5:08 a.m. | OK | Java 8 | TESTS | 142 | 326 | 0 | 2100 | |
| 14485477 | vanvector | E | Nov. 25, 2015, 9:30 p.m. | OK | MS C++ | TESTS | 142 | 78 | 819200 | 2100 | |
| 14566962 | Kmcode | E | Nov. 30, 2015, 8:02 a.m. | OK | MS C++ | TESTS | 142 | 78 | 6348800 | 2100 | |
| 14554932 | Kmcode | E | Nov. 29, 2015, 9:34 a.m. | OK | MS C++ | TESTS | 142 | 108 | 6348800 | 2100 | |
| 15601470 | Taube | E | Jan. 26, 2016, 8:48 p.m. | OK | MS C++ | TESTS | 142 | 296 | 921600 | 2100 |
Back to search problems