Educational Codeforces Round 84 (Rated for 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
1327 Educational Codeforces Round 84 (Rated for Div. 2) FINISHED False 7200 152378710 March 23, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3325 ) D Infinite Path PROGRAMMING brute force dfs and similar graphs math number theory 2200

B"You are given a colored permutation p_1, p_2, ... , p_n . The i -th element of the permutation has color c_i . Let's define an infinite path as infinite sequence i, p[i], p[p[i]], p[p[p[i]]] ... where all elements have same color ( c[i] = c[p[i]] = c[p[p[i]]] = ... ). We can also define a multiplication of permutations a and b as permutation c = a x b where c[i] = b[a[i]] . Moreover, we can define a power k of permutation p as p^k= underbrace{p x p x ... x p}_{k text{ times}} . Find the minimum k > 0 such that p^k has at least one infinite path (i.e. there is a position i in p^k such that the sequence starting from i is an infinite path). It can be proved that the answer always exists. The first line contains single integer T ( 1 <= T <= 10^4 ) -- the number of test cases. Next 3T lines contain test cases -- one per three lines. The first line contains single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the size of the permutation. The second line contains n integers p_1, p_2, ... , p_n ( 1 <= p_i <= n , p_i neq p_j for i neq j ) -- the permutation p . The third line contains n integers c_1, c_2, ... , c_n ( 1 <= c_i <= n ) -- the colors of elements of the permutation. It is guaranteed that the total sum of n doesn't exceed 2 cdot 10^5 . Print T integers -- one per test case. For each test case print minimum k > 0 such that p^k has at least one infinite path. In the first test case, p^1 = p = [1, 3, 4, 2] and the sequence starting from 1 : 1, p[1] = 1, ... is an infinite path. In the second test case, p^5 = [1, 2, 3, 4, 5] and it obviously contains several infinite paths. In the third test case, p^2 = [3, 6, 1, 8, 7, 2, 5, 4] and the sequence starting from 4 : 4, p^2[4]=8, p^2[8]=4,"...

Tutorials

Educational Codeforces Round 84 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
74119901 iica D March 23, 2020, 4:26 p.m. OK D TESTS 27 467 37785600 2200
74137322 ruban D March 23, 2020, 6:29 p.m. OK Delphi TESTS 27 202 115302400 2200
74123129 Lanly D March 23, 2020, 4:32 p.m. OK GNU C++11 TESTS 27 46 2662400 2200
74166597 LJb00131 D March 24, 2020, 6:16 a.m. OK GNU C++11 TESTS 27 46 2867200 2200
74174379 Lu_Anlai D March 24, 2020, 7:46 a.m. OK GNU C++11 TESTS 27 46 2969600 2200
74183167 Fuyuki D March 24, 2020, 9:35 a.m. OK GNU C++11 TESTS 27 46 3379200 2200
74249363 luogu_bot2 D March 25, 2020, 1:48 a.m. OK GNU C++11 TESTS 28 46 3481600 2200
74382687 Glu_TtoNy D March 26, 2020, 11:58 a.m. OK GNU C++11 TESTS 28 46 3993600 2200
74382656 vjudge2 D March 26, 2020, 11:58 a.m. OK GNU C++11 TESTS 28 46 3993600 2200
74377440 Vxlimo D March 26, 2020, 10:56 a.m. OK GNU C++11 TESTS 28 46 3993600 2200
74347288 DWAE86 D March 26, 2020, 2:56 a.m. OK GNU C++11 TESTS 28 46 3993600 2200
74126608 wangjunrui D March 23, 2020, 4:47 p.m. OK GNU C++11 TESTS 27 46 4300800 2200
74208765 akane_psycho D March 24, 2020, 2:10 p.m. OK GNU C++14 TESTS 28 93 3993600 2200
74142754 wangyu D March 23, 2020, 7:45 p.m. OK GNU C++14 TESTS 27 93 3993600 2200
74162464 mwlc D March 24, 2020, 5 a.m. OK GNU C++14 TESTS 27 93 13004800 2200
74153766 Bekh D March 24, 2020, 12:57 a.m. OK GNU C++14 TESTS 27 108 2662400 2200
74246034 silxi D March 24, 2020, 11:31 p.m. OK GNU C++14 TESTS 28 108 3379200 2200
74257907 killforcode D March 25, 2020, 5:41 a.m. OK GNU C++14 TESTS 28 109 2560000 2200
74247777 jupiro D March 25, 2020, 12:42 a.m. OK GNU C++14 TESTS 28 109 3276800 2200
74199694 omikad D March 24, 2020, 12:42 p.m. OK GNU C++14 TESTS 28 109 3276800 2200
74338259 SmartClown D March 25, 2020, 9:43 p.m. OK GNU C++14 TESTS 28 109 3379200 2200
74256458 sahilshelangia D March 25, 2020, 5:12 a.m. OK GNU C++14 TESTS 28 109 3379200 2200
74162374 _andyli D March 24, 2020, 4:58 a.m. OK GNU C++17 TESTS 27 46 5529600 2200
74162319 _andyli D March 24, 2020, 4:56 a.m. OK GNU C++17 TESTS 27 46 5529600 2200
74174407 vjudge3 D March 24, 2020, 7:47 a.m. OK GNU C++17 TESTS 27 61 2969600 2200
74315506 _Rebellion D March 25, 2020, 4:46 p.m. OK GNU C++17 TESTS 28 93 3174400 2200
74265102 thtsshz_bgwrswh D March 25, 2020, 7:39 a.m. OK GNU C++17 TESTS 28 108 3379200 2200
74132853 Lucina D March 23, 2020, 5:37 p.m. OK GNU C++17 TESTS 27 109 2662400 2200
74354067 makogon2907 D March 26, 2020, 5:44 a.m. OK GNU C++17 TESTS 28 109 3276800 2200
74246075 Moon0603 D March 24, 2020, 11:32 p.m. OK GNU C++17 TESTS 28 109 3276800 2200
74208591 George1123 D March 24, 2020, 2:08 p.m. OK GNU C++17 TESTS 28 109 3276800 2200
74144742 LadyPython D March 23, 2020, 8:20 p.m. OK GNU C++17 TESTS 27 109 3276800 2200
74265197 thtsshz_bgwrswh D March 25, 2020, 7:41 a.m. OK GNU C++17 (64) TESTS 28 78 3891200 2200
74119553 Diego D March 23, 2020, 4:26 p.m. OK GNU C++17 (64) TESTS 27 78 3993600 2200
74149050 neal D March 23, 2020, 9:57 p.m. OK GNU C++17 (64) TESTS 27 78 7782400 2200
74359632 sugarrr D March 26, 2020, 7:03 a.m. OK GNU C++17 (64) TESTS 28 78 9011200 2200
74125292 HCPS42 D March 23, 2020, 4:40 p.m. OK GNU C++17 (64) TESTS 27 78 9011200 2200
74313554 WGree D March 25, 2020, 4:25 p.m. OK GNU C++17 (64) TESTS 28 93 3788800 2200
74139570 Tiramister D March 23, 2020, 6:57 p.m. OK GNU C++17 (64) TESTS 27 93 3788800 2200
74128017 Rahul D March 23, 2020, 4:56 p.m. OK GNU C++17 (64) TESTS 27 93 6144000 2200
74134102 pachico D March 23, 2020, 5:51 p.m. OK GNU C++17 (64) TESTS 27 93 6963200 2200
74149034 neal D March 23, 2020, 9:56 p.m. OK GNU C++17 (64) TESTS 27 93 7782400 2200
74156397 synapse D March 24, 2020, 2:23 a.m. OK Go TESTS 27 327 28672000 2200
74220364 ae04071 D March 24, 2020, 4:15 p.m. OK Go TESTS 28 374 29593600 2200
74391673 Laurens D March 26, 2020, 1:38 p.m. OK Haskell TESTS 28 1434 121958400 2200
74182583 polyakoff D March 24, 2020, 9:27 a.m. OK Java 11 TESTS 27 358 6553600 2200
74261505 happy15 D March 25, 2020, 6:44 a.m. OK Java 11 TESTS 28 421 19968000 2200
74236069 jenish9599 D March 24, 2020, 7:33 p.m. OK Java 11 TESTS 28 701 3788800 2200
74342416 JHope D March 26, 2020, 12:03 a.m. OK Java 11 TESTS 28 811 164659200 2200
74132456 SecondThread D March 23, 2020, 5:33 p.m. OK Java 8 TESTS 27 202 7270400 2200
74452057 yaoct D March 26, 2020, 3:44 p.m. OK Java 8 TESTS 28 218 7680000 2200
74136028 StayAwayFromBitches D March 23, 2020, 6:13 p.m. OK Java 8 TESTS 27 296 1945600 2200
74139817 martins D March 23, 2020, 7:01 p.m. OK Java 8 TESTS 27 311 7168000 2200
74139621 robinz62 D March 23, 2020, 6:58 p.m. OK Java 8 TESTS 27 311 10752000 2200
74236787 adarsh000321 D March 24, 2020, 7:45 p.m. OK Java 8 TESTS 28 342 6656000 2200
74574468 prashantpiyush D March 27, 2020, 3:31 p.m. OK Java 8 TESTS 28 421 7168000 2200
74333855 NRGsama D March 25, 2020, 8:14 p.m. OK Java 8 TESTS 28 468 30515200 2200
74216574 sguar D March 24, 2020, 3:32 p.m. OK Java 8 TESTS 28 483 1638400 2200
74269739 an09mous D March 25, 2020, 8:42 a.m. OK Java 8 TESTS 28 483 8704000 2200
74200072 Spheniscine D March 24, 2020, 12:46 p.m. OK Kotlin TESTS 28 295 8908800 2200
74213093 Hakiobo D March 24, 2020, 2:52 p.m. OK Kotlin TESTS 28 997 25088000 2200
74131536 hibatibati D March 23, 2020, 5:24 p.m. OK Mono C# TESTS 27 248 37990400 2200
74263632 camypaper D March 25, 2020, 7:16 a.m. OK Mono C# TESTS 28 358 19558400 2200
74383265 vjudge3 D March 26, 2020, 12:05 p.m. OK MS C++ TESTS 28 280 3276800 2200
74117286 Maru D March 23, 2020, 4:21 p.m. OK MS C++ 2017 TESTS 27 124 11264000 2200
74358869 Monotonic D March 26, 2020, 6:53 a.m. OK MS C++ 2017 TESTS 28 156 3993600 2200
74132062 CrashMaster D March 23, 2020, 5:29 p.m. OK MS C++ 2017 TESTS 27 218 4096000 2200
74166713 vjudge2 D March 24, 2020, 6:18 a.m. OK MS C++ 2017 TESTS 27 265 6860800 2200
74189532 LeeLdler D March 24, 2020, 10:52 a.m. OK MS C++ 2017 TESTS 28 280 2662400 2200
74149292 danilgrig D March 23, 2020, 10:03 p.m. OK MS C++ 2017 TESTS 27 312 3379200 2200
74392577 VorivaN D March 26, 2020, 1:47 p.m. OK MS C++ 2017 TESTS 28 327 4198400 2200
74129384 Tirutu D March 23, 2020, 5:06 p.m. OK MS C++ 2017 TESTS 27 342 4198400 2200
74521790 hwqconceptnick D March 27, 2020, 3:25 a.m. OK MS C++ 2017 TESTS 28 358 5017600 2200
74271295 hwqconceptnick D March 25, 2020, 8:56 a.m. OK MS C++ 2017 TESTS 28 358 33792000 2200
74134824 nehan_der_thal D March 23, 2020, 5:59 p.m. OK PyPy 3 TESTS 27 452 21401600 2200
74130536 anagohirame D March 23, 2020, 5:15 p.m. OK PyPy 3 TESTS 27 452 23449600 2200
74134657 aberent D March 23, 2020, 5:57 p.m. OK PyPy 3 TESTS 27 467 20787200 2200
74120225 nagitaosu D March 23, 2020, 4:27 p.m. OK PyPy 3 TESTS 27 467 22323200 2200
74155811 erickjohnross D March 24, 2020, 2:06 a.m. OK PyPy 3 TESTS 27 467 22835200 2200
74173229 Kiri8128 D March 24, 2020, 7:32 a.m. OK PyPy 3 TESTS 27 498 19456000 2200
74145768 LadyPython D March 23, 2020, 8:38 p.m. OK PyPy 3 TESTS 27 623 20684800 2200
74122992 Sevlll D March 23, 2020, 4:32 p.m. OK PyPy 3 TESTS 27 639 19763200 2200
74184946 qwertz73355a D March 24, 2020, 9:56 a.m. OK PyPy 3 TESTS 27 670 19148800 2200
74145460 LadyPython D March 23, 2020, 8:33 p.m. OK PyPy 3 TESTS 27 670 23654400 2200
74313475 mkawa2 D March 25, 2020, 4:24 p.m. OK Python 3 TESTS 28 1824 18227200 2200
74174216 cotton100pc D March 24, 2020, 7:44 a.m. OK Rust TESTS 27 139 6246400 2200
74139555 akiradeveloper D March 23, 2020, 6:57 p.m. OK Rust TESTS 27 779 11059200 2200
74221086 akiradeveloper D March 24, 2020, 4:25 p.m. OK Rust TESTS 28 779 11776000 2200

remove filters

Back to search problems