TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!)

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
1787 TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!) FINISHED False 10800 56820299 Jan. 29, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 690 ) F Inverse Transformation PROGRAMMING constructive algorithms implementation math

B'A permutation scientist is studying a self-transforming permutation a consisting of n elements a_1,a_2, ldots,a_n . A permutation is a sequence of integers from 1 to n of length n containing each number exactly once. For example, [1] , [4, 3, 5, 1, 2] are permutations, while [1, 1] , [4, 3, 1] are not. The permutation transforms day by day. On each day, each element x becomes a_x , that is, a_x becomes a_{a_x} . Specifically: You 're given the permutation a ' on the k -th day. Define sigma(x) = a_x , and define f(x) as the minimal positive integer m such that sigma^m(x) = x , where sigma^m(x) denotes underbrace{ sigma( sigma( ldots sigma}_{m text{ times}}(x) ldots)) . For example, if a = [2,3,1] , then sigma(1) = 2 , sigma^2(1) = sigma( sigma(1)) = sigma(2) = 3 , sigma^3(1) = sigma( sigma( sigma(1))) = sigma(3) = 1 , so f(1) = 3 . And if a=[4,2,1,3] , sigma(2) = 2 so f(2) = 1 ; sigma(3) = 1 , sigma^2(3) = 4 , sigma^3(3) = 3 so f(3) = 3 . Find the initial permutation a such that sum limits^n_{i=1} dfrac{1}{f(i)} is minimum possible. Each test contains multiple test cases. The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n <= 2 cdot 10^5 ; 1 <= k <= 10^9 ) -- the length of a , and the last day. The second line contains n integers a '_1,a '_2, ldots,a '_n ( 1 <= a '_i <= n ) -- the permutation on the k -th day. It 's guaranteed that the sum of n does not exceed 2 cdot 10^5 . For each test case, if at least one initial a consistent with the given a ' exists, print "YES", then print n integers a_1,a_2, ldots,a_n -- the initial permutation with the'...

Tutorials

TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
191145733 hos.lyric F Jan. 29, 2023, 4:13 p.m. OK D TESTS 59 234 38195200
191184206 rainboy F Jan. 29, 2023, 9:35 p.m. OK GNU C11 TESTS 59 873 8294400
191144901 inaFSTream F Jan. 29, 2023, 4:10 p.m. OK GNU C++14 TESTS 59 93 5632000
191147355 Noam527 F Jan. 29, 2023, 4:20 p.m. OK GNU C++14 TESTS 59 93 8192000
191161704 le0n F Jan. 29, 2023, 5:27 p.m. OK GNU C++14 TESTS 59 93 11264000
191198591 _CbrX_ F Jan. 30, 2023, 3:04 a.m. OK GNU C++14 TESTS 59 93 12288000
191160070 LinRui F Jan. 29, 2023, 5:19 p.m. OK GNU C++14 TESTS 59 93 12595200
191154057 20333333333 F Jan. 29, 2023, 4:51 p.m. OK GNU C++14 TESTS 59 93 29900800
191162324 stkwill F Jan. 29, 2023, 5:30 p.m. OK GNU C++14 TESTS 59 108 4710400
191152815 NoPotato F Jan. 29, 2023, 4:45 p.m. OK GNU C++14 TESTS 59 108 9011200
191145150 JaeminPark F Jan. 29, 2023, 4:11 p.m. OK GNU C++14 TESTS 59 109 5017600
191156814 FizzyDavid F Jan. 29, 2023, 5:03 p.m. OK GNU C++14 TESTS 59 109 9625600
191157246 Suda F Jan. 29, 2023, 5:06 p.m. OK GNU C++17 TESTS 59 93 5632000
191200369 Dd2dD2 F Jan. 30, 2023, 3:33 a.m. OK GNU C++17 TESTS 59 93 5836800
191173148 Rafi02 F Jan. 29, 2023, 7:12 p.m. OK GNU C++17 TESTS 59 93 7168000
191169925 -skyline- F Jan. 29, 2023, 6:45 p.m. OK GNU C++17 TESTS 59 93 7270400
191145729 alireza_kaviani F Jan. 29, 2023, 4:13 p.m. OK GNU C++17 TESTS 59 93 28876800
191201706 zhangmj2008 F Jan. 30, 2023, 3:55 a.m. OK GNU C++17 TESTS 59 108 7372800
191169927 Jacob F Jan. 29, 2023, 6:45 p.m. OK GNU C++17 TESTS 59 109 2867200
191157126 Nextby F Jan. 29, 2023, 5:05 p.m. OK GNU C++17 TESTS 59 109 6144000
191170543 kristevalex F Jan. 29, 2023, 6:50 p.m. OK GNU C++17 TESTS 59 109 7270400
191163627 Baharevim F Jan. 29, 2023, 5:34 p.m. OK GNU C++17 TESTS 59 109 7782400
191149450 QAQAutoMaton F Jan. 29, 2023, 4:29 p.m. OK GNU C++17 (64) TESTS 59 46 15872000
191185833 rainboy F Jan. 29, 2023, 10:02 p.m. OK GNU C++17 (64) TESTS 59 78 8806400
191160760 trainwithoutpain F Jan. 29, 2023, 5:23 p.m. OK GNU C++17 (64) TESTS 59 78 12492800
191157113 torisasami F Jan. 29, 2023, 5:05 p.m. OK GNU C++17 (64) TESTS 59 78 12492800
191147930 kotatsugame F Jan. 29, 2023, 4:23 p.m. OK GNU C++17 (64) TESTS 59 78 16179200
191179893 Errichto F Jan. 29, 2023, 8:30 p.m. OK GNU C++17 (64) TESTS 59 92 11673600
191149886 potato167 F Jan. 29, 2023, 4:31 p.m. OK GNU C++17 (64) TESTS 59 93 7577600
191149037 Toxel F Jan. 29, 2023, 4:27 p.m. OK GNU C++17 (64) TESTS 59 93 9011200
191143716 Xellos F Jan. 29, 2023, 4:05 p.m. OK GNU C++17 (64) TESTS 59 93 11366400
191162630 Wielomian F Jan. 29, 2023, 5:31 p.m. OK GNU C++17 (64) TESTS 59 93 11468800
191157964 Sol1 F Jan. 29, 2023, 5:09 p.m. OK GNU C++20 (64) TESTS 59 46 16896000
191183602 mana F Jan. 29, 2023, 9:25 p.m. OK GNU C++20 (64) TESTS 59 62 6963200
191149414 I_LOVE_DASHA_KARPENKO F Jan. 29, 2023, 4:29 p.m. OK GNU C++20 (64) TESTS 59 62 8192000
191155205 dreamoon_love_AA F Jan. 29, 2023, 4:56 p.m. OK GNU C++20 (64) TESTS 59 62 10752000
191160372 nuip F Jan. 29, 2023, 5:21 p.m. OK GNU C++20 (64) TESTS 59 62 11673600
191196850 platelet F Jan. 30, 2023, 2:32 a.m. OK GNU C++20 (64) TESTS 59 62 11878400
191145044 Endagorion F Jan. 29, 2023, 4:10 p.m. OK GNU C++20 (64) TESTS 59 62 12492800
191155876 ai_dev_master F Jan. 29, 2023, 4:59 p.m. OK GNU C++20 (64) TESTS 59 62 13312000
191195376 ajpiano F Jan. 30, 2023, 2:04 a.m. OK GNU C++20 (64) TESTS 59 62 14540800
191181219 JavierN F Jan. 29, 2023, 8:47 p.m. OK GNU C++20 (64) TESTS 59 77 8806400
191187162 fetetriste F Jan. 29, 2023, 10:31 p.m. OK Java 8 TESTS 59 295 31334400
191146376 Tlatoani F Jan. 29, 2023, 4:16 p.m. OK Kotlin 1.7 TESTS 59 795 108134400
191201761 Little_Sheep_Yawn F Jan. 30, 2023, 3:55 a.m. OK PyPy 3-64 TESTS 59 374 33484800
191156116 Maruzensky F Jan. 29, 2023, 5 p.m. OK PyPy 3-64 TESTS 59 404 34201600
191152986 rust_fan F Jan. 29, 2023, 4:45 p.m. OK Rust 2021 TESTS 59 62 21094400

remove filters

Back to search problems