Codeforces Round 418 (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
814 Codeforces Round 418 (Div. 2) FINISHED False 7200 279567923 June 7, 2017, 12:15 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 725 ) E An unavoidable detour for home PROGRAMMING combinatorics dp graphs shortest paths 2700

Those unwilling to return home from a long journey, will be affected by the oddity of the snail and lose their way. Mayoi, the oddity's carrier, wouldn't like this to happen, but there's nothing to do with this before a cure is figured out. For now, she would only like to know the enormous number of possibilities to be faced with if someone gets lost. There are n towns in the region, numbered from 1 to n . The town numbered 1 is called the capital. The traffic network is formed by bidirectional roads connecting pairs of towns. No two roads connect the same pair of towns, and no road connects a town with itself. The time needed to travel through each of the roads is the same. Lost travelers will not be able to find out how the towns are connected, but the residents can help them by providing the following facts: Starting from each town other than the capital, the shortest path (i.e. the path passing through the minimum number of roads) to the capital exists, and is unique; Let l i be the number of roads on the shortest path from town i to the capital, then l i ≥ l i - 1 holds for all 2 ≤ i ≤ n ; For town i , the number of roads connected to it is denoted by d i , which equals either 2 or 3 . You are to count the number of different ways in which the towns are connected, and give the answer modulo 10 9 + 7 . Two ways of connecting towns are considered different if a pair ( u , v ) ( 1 ≤ u , v ≤ n ) exists such there is a road between towns u and v in one of them but not in the other. The first line of input contains a positive integer n ( 3 ≤ n ≤ 50 ) — the number of towns. The second line contains n space-separated integers d 1 , d 2 , ..., d n ( 2 ≤ d i ≤ 3 ) — the number of roads connected to towns 1, 2, ..., n , respectively. It is guaranteed that the sum of d i over all i is even. Output one integer — the total number of different possible ways in which the towns are connected, modulo 10 9 + 7 . In the first example, the following structure is the only

Tutorials

Codeforces Round #418 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
27681678 lkmcfj E June 9, 2017, 3:21 a.m. OK FPC TESTS 40 390 117248000 2700
27681657 lkmcfj E June 9, 2017, 3:17 a.m. OK FPC TESTS 40 390 117248000 2700
27661496 a_student E June 8, 2017, 2:16 a.m. OK GNU C++ TESTS 40 15 0 2700
32358124 fateice E Nov. 16, 2017, 2:40 p.m. OK GNU C++ TESTS 40 15 102400 2700
27651433 CommonAnts E June 7, 2017, 3:06 p.m. OK GNU C++ TESTS 40 15 409600 2700
27664816 li20082008li E June 8, 2017, 6:52 a.m. OK GNU C++ TESTS 40 15 614400 2700
31936407 yml E Nov. 1, 2017, 1:49 a.m. OK GNU C++ TESTS 40 15 716800 2700
27667161 zyding E June 8, 2017, 8:55 a.m. OK GNU C++ TESTS 40 15 716800 2700
27699586 xzyxzy E June 10, 2017, 3:54 a.m. OK GNU C++ TESTS 40 15 921600 2700
27760006 pegasas E June 13, 2017, 5:17 p.m. OK GNU C++ TESTS 40 15 1126400 2700
27685505 AkaneSasu E June 9, 2017, 8:45 a.m. OK GNU C++ TESTS 40 15 1126400 2700
27644993 xumingkuan E June 7, 2017, 1:31 p.m. OK GNU C++ TESTS 40 15 1126400 2700
27646931 HellKitsune E June 7, 2017, 1:49 p.m. OK GNU C++11 TESTS 40 15 0 2700
27833311 PlayfulPanda E June 16, 2017, 9 p.m. OK GNU C++11 TESTS 40 15 204800 2700
27783679 ecjtu-nzf E June 15, 2017, 12:32 a.m. OK GNU C++11 TESTS 40 15 307200 2700
27713542 I_always_love_cc E June 11, 2017, 2:14 a.m. OK GNU C++11 TESTS 40 15 307200 2700
27777443 akmintro E June 14, 2017, 5:31 p.m. OK GNU C++11 TESTS 40 15 512000 2700
27701703 BlazingWind E June 10, 2017, 7:28 a.m. OK GNU C++11 TESTS 40 15 512000 2700
27693186 KeyID E June 9, 2017, 4:48 p.m. OK GNU C++11 TESTS 40 15 716800 2700
27688102 RNS_CUS E June 9, 2017, 11:37 a.m. OK GNU C++11 TESTS 40 15 716800 2700
27715867 blutrex E June 11, 2017, 6:16 a.m. OK GNU C++11 TESTS 40 15 921600 2700
27880645 txingml E June 18, 2017, 8:53 a.m. OK GNU C++11 TESTS 40 15 1024000 2700
27769410 lys1280023 E June 14, 2017, 7:19 a.m. OK GNU C++14 TESTS 40 15 512000 2700
27763890 krijgertje E June 13, 2017, 9:46 p.m. OK GNU C++14 TESTS 40 15 512000 2700
27716118 PengsenMao E June 11, 2017, 6:42 a.m. OK GNU C++14 TESTS 40 15 512000 2700
27700153 consecutivelimit E June 10, 2017, 5:04 a.m. OK GNU C++14 TESTS 40 15 512000 2700
27680399 Qizy E June 9, 2017, 12:34 a.m. OK GNU C++14 TESTS 40 15 614400 2700
27680375 Qizy E June 9, 2017, 12:31 a.m. OK GNU C++14 TESTS 40 15 614400 2700
27741097 SegmentationRight E June 12, 2017, 3:59 p.m. OK GNU C++14 TESTS 40 15 716800 2700
27695056 IOI2017Predictions E June 9, 2017, 6:58 p.m. OK GNU C++14 TESTS 40 15 716800 2700
27669973 InvUsr E June 8, 2017, 11:25 a.m. OK GNU C++14 TESTS 40 15 716800 2700
27821173 FallingStar E June 16, 2017, 9:08 a.m. OK GNU C++14 TESTS 40 15 1126400 2700
49935694 ShichengXiao E Feb. 15, 2019, 7:12 a.m. OK GNU C++17 TESTS 40 30 921600 2700
57000259 idxcalccalc E July 14, 2019, 2:57 a.m. OK GNU C++17 TESTS 40 30 1024000 2700
50492752 zhangqingqi E Feb. 25, 2019, 1:57 p.m. OK GNU C++17 TESTS 40 30 1126400 2700
49944922 HirasawaaYui E Feb. 15, 2019, 11:36 a.m. OK GNU C++17 TESTS 40 30 266956800 2700
66826634 vjudge5 E Dec. 14, 2019, 9:10 a.m. OK GNU C++17 TESTS 40 31 716800 2700
57139989 hjk1030 E July 16, 2019, 10:35 a.m. OK GNU C++17 TESTS 40 31 716800 2700
43487684 vjudge3 E Sept. 27, 2018, 11:12 a.m. OK GNU C++17 TESTS 40 31 1126400 2700
52533159 nickluo E April 9, 2019, 2:19 p.m. OK GNU C++17 TESTS 40 31 5222400 2700
65288041 ffao E Nov. 18, 2019, 8:49 a.m. OK GNU C++17 TESTS 40 46 31232000 2700
57222131 mocania E July 17, 2019, 3:28 p.m. OK GNU C++17 TESTS 40 46 232755200 2700
27889361 kost E June 18, 2017, 6:14 p.m. OK Haskell TESTS 40 61 16998400 2700
42423895 luogu_bot3 E Sept. 3, 2018, 11:44 a.m. OK Java 8 TESTS 40 124 0 2700
27821590 --UMANG-- E June 16, 2017, 9:29 a.m. OK Java 8 TESTS 40 124 0 2700
27745671 tri E June 12, 2017, 10:18 p.m. OK Java 8 TESTS 40 124 0 2700
27657578 uwi E June 7, 2017, 7:21 p.m. OK Java 8 TESTS 40 124 0 2700
27915814 donli E June 20, 2017, 2:27 a.m. OK Java 8 TESTS 40 140 0 2700
27915839 donli E June 20, 2017, 2:29 a.m. OK Java 8 TESTS 40 202 0 2700
27843096 rrepeat E June 17, 2017, 9:49 a.m. OK Java 8 TESTS 40 202 0 2700
28303638 Moor E July 5, 2017, 12:23 p.m. OK Java 8 TESTS 40 342 160972800 2700
27673449 stevie1024 E June 8, 2017, 2:28 p.m. OK Java 8 TESTS 40 1372 7680000 2700
27899738 donli E June 19, 2017, 8:34 a.m. OK Java 8 TESTS 40 1528 146841600 2700
57740015 vjudge4 E July 25, 2019, 11:10 a.m. OK MS C++ TESTS 40 31 716800 2700
57739932 vjudge3 E July 25, 2019, 11:09 a.m. OK MS C++ TESTS 40 31 716800 2700
37367938 Hzoi_joker E April 16, 2018, 8:59 a.m. OK MS C++ TESTS 40 31 4812800 2700
56518275 vjudge5 E July 4, 2019, 1:46 p.m. OK MS C++ TESTS 40 31 53657600 2700
67628478 rtycz E Dec. 26, 2019, 12:53 a.m. OK MS C++ 2017 TESTS 40 951 73625600 2700

remove filters

Back to search problems