Codeforces Round 511 (Div. 1)

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
1034 Codeforces Round 511 (Div. 1) FINISHED False 7200 199985124 Sept. 21, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 899 ) C Region Separation PROGRAMMING combinatorics dp number theory trees 2900

B'There are n cities in the Kingdom of Autumn, numbered from 1 to n . People can travel between any two cities using n-1 two-directional roads. This year, the government decides to separate the kingdom. There will be regions of different levels. The whole kingdom will be the region of level 1 . Each region of i -th level should be separated into several (at least two) regions of i+1 -th level, unless i -th level is the last level. Each city should belong to exactly one region of each level and for any two cities in the same region, it should be possible to travel between them passing the cities in the same region only. According to research, for each city i , there is a value a_i , which describes the importance of this city. All regions of the same level should have an equal sum of city importances. Your task is to find how many plans there are to determine the separation of the regions that all the conditions are satisfied. Two plans are considered different if and only if their numbers of levels are different or there exist two cities in the same region of one level in one plan but in different regions of this level in the other plan. Since the answer may be very large, output it modulo 10^9+7 . The first line contains one integer n ( 1 <= q n <= q 10^6 ) -- the number of the cities. The second line contains n integers, the i -th of which is a_i ( 1 <= q a_i <= q 10^9 ) -- the value of each city. The third line contains n-1 integers, p_1, p_2, ldots, p_{n-1} ; p_i ( p_i <= q i ) describes a road between cities p_i and i+1 . Print one integer -- the number of different plans modulo 10^9+7 . For the first example, there are 4 different plans: Plan 1 : Level- 1 : {1,2,3,4 } . Plan 2 : Level- 1 : {1,2,3,4 } , Level- 2 : {1,2 } , {3,4 } . Plan 3 : Level- 1 : {1,2,3,4 }$'...

Tutorials

Codeforces Round #511 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
44751702 ReaLNero1 C Oct. 23, 2018, 8:18 p.m. OK GNU C++11 TESTS 60 312 25088000 2900
45087750 Mirach C Oct. 30, 2018, 8:14 a.m. OK GNU C++11 TESTS 60 327 19865600 2900
46631137 luogu_bot3 C Dec. 5, 2018, 3:10 a.m. OK GNU C++11 TESTS 60 327 24064000 2900
46583789 Althen C Dec. 4, 2018, 12:19 p.m. OK GNU C++11 TESTS 60 327 24064000 2900
53562233 Holland_Pig C April 30, 2019, 10:16 a.m. OK GNU C++11 TESTS 60 342 20070400 2900
59790829 luogu_bot4 C Aug. 31, 2019, 7:06 a.m. OK GNU C++11 TESTS 60 342 23859200 2900
59790780 CTP_314 C Aug. 31, 2019, 7:05 a.m. OK GNU C++11 TESTS 60 342 23859200 2900
45087311 luogu_bot1 C Oct. 30, 2018, 8:04 a.m. OK GNU C++11 TESTS 60 343 19865600 2900
45087284 vjudge2 C Oct. 30, 2018, 8:03 a.m. OK GNU C++11 TESTS 60 343 19865600 2900
64798570 luogu_bot3 C Nov. 13, 2019, 1:46 p.m. OK GNU C++11 TESTS 60 343 20070400 2900
43421866 xyr C Sept. 25, 2018, 5:59 p.m. OK GNU C++14 TESTS 60 358 20275200 2900
43422267 xyr C Sept. 25, 2018, 6:09 p.m. OK GNU C++14 TESTS 60 374 20172800 2900
43422085 xyr C Sept. 25, 2018, 6:05 p.m. OK GNU C++14 TESTS 60 374 20275200 2900
43984099 nickluo C Oct. 8, 2018, 5:48 a.m. OK GNU C++14 TESTS 60 405 20172800 2900
43422057 xyr C Sept. 25, 2018, 6:04 p.m. OK GNU C++14 TESTS 60 420 20275200 2900
44341751 teafrogsf C Oct. 15, 2018, 4:12 a.m. OK GNU C++14 TESTS 60 467 92160000 2900
43499348 rqgao2014 C Sept. 27, 2018, 4:22 p.m. OK GNU C++14 TESTS 60 639 44339200 2900
51325726 mayaohua2003 C March 15, 2019, 9:35 a.m. OK GNU C++14 TESTS 60 717 24064000 2900
44728719 top1_TFT C Oct. 23, 2018, 9:21 a.m. OK GNU C++14 TESTS 60 717 33075200 2900
49816191 n_dao107 C Feb. 12, 2019, 6:03 a.m. OK GNU C++14 TESTS 60 779 16076800 2900
58926140 neal C Aug. 16, 2019, 7:37 p.m. OK GNU C++17 TESTS 60 327 16076800 2900
58927251 neal C Aug. 16, 2019, 8:19 p.m. OK GNU C++17 TESTS 60 343 16076800 2900
58927266 neal C Aug. 16, 2019, 8:20 p.m. OK GNU C++17 TESTS 60 358 16076800 2900
58926120 neal C Aug. 16, 2019, 7:36 p.m. OK GNU C++17 TESTS 60 358 20070400 2900
43728304 Trisolaris C Oct. 3, 2018, 1:09 p.m. OK GNU C++17 TESTS 60 358 20480000 2900
43727672 Trisolaris C Oct. 3, 2018, 12:53 p.m. OK GNU C++17 TESTS 60 373 20480000 2900
43278029 DZYO C Sept. 23, 2018, 2:14 a.m. OK GNU C++17 TESTS 60 374 20275200 2900
46837430 dinosaurs C Dec. 10, 2018, 4:26 a.m. OK GNU C++17 TESTS 60 717 20070400 2900
50778332 fdironia C March 4, 2019, 9:55 a.m. OK GNU C++17 TESTS 60 748 19968000 2900
50778296 fdironia C March 4, 2019, 9:54 a.m. OK GNU C++17 TESTS 60 779 19968000 2900
67975601 Harpae C Dec. 30, 2019, 4:47 p.m. OK Java 8 TESTS 60 1107 107827200 2900
44276954 xodiac C Oct. 13, 2018, 10:52 p.m. OK Java 8 TESTS 60 1902 228249600 2900
43481156 vjudge3 C Sept. 27, 2018, 7:13 a.m. OK MS C++ TESTS 60 1169 20377600 2900
43236249 wa1tz719 C Sept. 22, 2018, 8:13 a.m. OK MS C++ TESTS 60 1309 96358400 2900

remove filters

Back to search problems