Codeforces Round 382 (Div. 2)

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
735 Codeforces Round 382 (Div. 2) FINISHED False 7200 296141123 Nov. 27, 2016, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 997 ) E Ostap and Tree PROGRAMMING dp trees 2800

Ostap already settled down in Rio de Janiero suburb and started to grow a tree in his garden. Recall that a tree is a connected undirected acyclic graph. Ostap's tree now has n vertices. He wants to paint some vertices of the tree black such that from any vertex u there is at least one black vertex v at distance no more than k . Distance between two vertices of the tree is the minimum possible number of edges of the path between them. As this number of ways to paint the tree can be large, Ostap wants you to compute it modulo 10 9 + 7 . Two ways to paint the tree are considered different if there exists a vertex that is painted black in one way and is not painted in the other one. The first line of the input contains two integers n and k ( 1 ≤ n ≤ 100 , 0 ≤ k ≤ min (20, n - 1) ) — the number of vertices in Ostap's tree and the maximum allowed distance to the nearest black vertex. Don't miss the unusual constraint for k . Each of the next n - 1 lines contain two integers u i and v i ( 1 ≤ u i , v i ≤ n ) — indices of vertices, connected by the i -th edge. It's guaranteed that given graph is a tree. Print one integer — the remainder of division of the number of ways to paint the tree by 1 000 000 007 ( 10 9 + 7 ). In the first sample, Ostap has to paint both vertices black. In the second sample, it is enough to paint only one of two vertices, thus the answer is 3 : Ostap can paint only vertex 1 , only vertex 2 , vertices 1 and 2 both. In the third sample, the valid ways to paint vertices are: {1, 3} , {1, 4} , {2, 3} , {2, 4} , {1, 2, 3} , {1, 2, 4} , {1, 3, 4} , {2, 3, 4} , {1, 2, 3, 4} .

Tutorials

Codeforces Round #382 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
22608773 rainboy E Nov. 29, 2016, 7:02 p.m. OK GNU C TESTS 56 15 512000 2800
27449662 FoolPerson E May 30, 2017, 2:02 p.m. OK GNU C++ TESTS 56 15 0 2800
27449258 FoolPerson E May 30, 2017, 1:38 p.m. OK GNU C++ TESTS 56 15 0 2800
23041572 ODT E Dec. 17, 2016, 7:31 a.m. OK GNU C++ TESTS 56 15 0 2800
23008475 unistar E Dec. 15, 2016, 2:09 p.m. OK GNU C++ TESTS 56 15 0 2800
22696048 vjudge3 E Dec. 4, 2016, 12:55 p.m. OK GNU C++ TESTS 56 15 0 2800
22617944 GLK E Nov. 30, 2016, 9:11 a.m. OK GNU C++ TESTS 56 15 0 2800
22732423 icecathy E Dec. 6, 2016, 2:27 p.m. OK GNU C++ TESTS 56 15 102400 2800
22944042 Caproner E Dec. 14, 2016, 8:06 a.m. OK GNU C++ TESTS 56 15 204800 2800
22731429 Ateisti E Dec. 6, 2016, 1:38 p.m. OK GNU C++ TESTS 56 15 204800 2800
22615198 vjudge2 E Nov. 30, 2016, 6:31 a.m. OK GNU C++ TESTS 56 15 204800 2800
22926326 sfiction E Dec. 13, 2016, 12:39 p.m. OK GNU C++11 TESTS 56 15 0 2800
22900277 Shizuo E Dec. 12, 2016, 8:56 a.m. OK GNU C++11 TESTS 56 15 0 2800
22633805 niu E Dec. 1, 2016, 1:51 a.m. OK GNU C++11 TESTS 56 15 0 2800
22928898 yenthanh.t7 E Dec. 13, 2016, 2:47 p.m. OK GNU C++11 TESTS 56 15 102400 2800
22653771 zy1997 E Dec. 2, 2016, 8:06 a.m. OK GNU C++11 TESTS 56 15 102400 2800
22638366 Arg_007 E Dec. 1, 2016, 11:53 a.m. OK GNU C++11 TESTS 56 15 102400 2800
22559668 ielenik E Nov. 27, 2016, 8:22 p.m. OK GNU C++11 TESTS 56 15 102400 2800
31949717 Amphetamine E Nov. 1, 2017, 12:34 p.m. OK GNU C++11 TESTS 56 15 204800 2800
30270452 minson123 E Sept. 11, 2017, 4:55 p.m. OK GNU C++11 TESTS 56 15 204800 2800
22998210 DTDT E Dec. 15, 2016, 6:02 a.m. OK GNU C++11 TESTS 56 15 204800 2800
30244436 lessmeaning E Sept. 10, 2017, 11:58 a.m. OK GNU C++14 TESTS 56 15 204800 2800
27057169 NineFailure E May 12, 2017, 3:10 p.m. OK GNU C++14 TESTS 56 15 204800 2800
27057162 vjudge5 E May 12, 2017, 3:09 p.m. OK GNU C++14 TESTS 56 15 204800 2800
27056722 NineFailure E May 12, 2017, 2:47 p.m. OK GNU C++14 TESTS 56 15 204800 2800
27056710 vjudge4 E May 12, 2017, 2:46 p.m. OK GNU C++14 TESTS 56 15 204800 2800
27056675 NineFailure E May 12, 2017, 2:44 p.m. OK GNU C++14 TESTS 56 15 204800 2800
27055164 NineFailure E May 12, 2017, 1:24 p.m. OK GNU C++14 TESTS 56 15 204800 2800
23021148 skipher. E Dec. 16, 2016, 2:28 a.m. OK GNU C++14 TESTS 56 15 204800 2800
22711224 Eson E Dec. 5, 2016, 12:29 p.m. OK GNU C++14 TESTS 56 15 204800 2800
22683136 alkhwarizmi E Dec. 3, 2016, 6:46 p.m. OK GNU C++14 TESTS 56 15 204800 2800
48862909 Duanyll E Jan. 24, 2019, 12:39 a.m. OK GNU C++17 TESTS 56 30 716800 2800
57786750 Fulisike E July 26, 2019, 8:04 a.m. OK GNU C++17 TESTS 56 31 102400 2800
43106182 hyfzbtrs E Sept. 20, 2018, 8:48 a.m. OK GNU C++17 TESTS 56 31 102400 2800
66672645 hjk1030 E Dec. 12, 2019, 10 a.m. OK GNU C++17 TESTS 56 31 204800 2800
46933720 xielinhan E Dec. 12, 2018, 12:51 p.m. OK GNU C++17 TESTS 56 31 204800 2800
59701715 pkgunboat E Aug. 30, 2019, 10:57 a.m. OK GNU C++17 TESTS 56 31 512000 2800
48862836 vjudge5 E Jan. 24, 2019, 12:34 a.m. OK GNU C++17 TESTS 56 31 614400 2800
48862812 Duanyll E Jan. 24, 2019, 12:33 a.m. OK GNU C++17 TESTS 56 31 716800 2800
57199089 skyping E July 17, 2019, 1:09 p.m. OK GNU C++17 TESTS 56 46 102400 2800
45431117 YJH143 E Nov. 8, 2018, 3:41 a.m. OK GNU C++17 TESTS 56 46 204800 2800
22644620 fzbztjg E Dec. 1, 2016, 4:55 p.m. OK Java 8 TESTS 56 124 0 2800
22582933 Dukkha E Nov. 28, 2016, 6:18 p.m. OK Java 8 TESTS 56 124 0 2800
22703096 diver-in-sky E Dec. 5, 2016, 12:18 a.m. OK Java 8 TESTS 56 139 0 2800
22703066 diver-in-sky E Dec. 5, 2016, 12:09 a.m. OK Java 8 TESTS 56 140 0 2800
22675431 JC_Kiraa E Dec. 3, 2016, 11:35 a.m. OK MS C++ TESTS 56 15 102400 2800
22677185 JC_Kiraa E Dec. 3, 2016, 12:53 p.m. OK MS C++ TESTS 56 30 102400 2800
48797124 vjudge3 E Jan. 23, 2019, 1:03 p.m. OK MS C++ TESTS 56 31 102400 2800
22602968 666qwerty E Nov. 29, 2016, 4:11 p.m. OK MS C++ TESTS 56 31 102400 2800
48864574 vjudge2 E Jan. 24, 2019, 2:03 a.m. OK MS C++ TESTS 56 46 8294400 2800
22562381 orailly E Nov. 28, 2016, 12:39 a.m. OK Python 3 TESTS 56 140 307200 2800
22677869 cqdef_xxx E Dec. 3, 2016, 1:25 p.m. OK Python 3 TESTS 56 296 307200 2800

remove filters

Back to search problems