Codeforces Round 595 (Div. 3)

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
1249 Codeforces Round 595 (Div. 3) FINISHED False 8100 165684287 Oct. 22, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 20922 ) B1 Books Exchange (easy version) PROGRAMMING ds math 1000

B"The only difference between easy and hard versions is constraints. There are n kids, each of them is reading a unique book. At the end of any day, the i -th kid will give his book to the p_i -th kid (in case of i = p_i the kid will give his book to himself). It is guaranteed that all values of p_i are distinct integers from 1 to n (i.e. p is a permutation). The sequence p doesn't change from day to day, it is fixed. For example, if n=6 and p=[4, 6, 1, 3, 5, 2] then at the end of the first day the book of the 1 -st kid will belong to the 4 -th kid, the 2 -nd kid will belong to the 6 -th kid and so on. At the end of the second day the book of the 1 -st kid will belong to the 3 -th kid, the 2 -nd kid will belong to the 2 -th kid and so on. Your task is to determine the number of the day the book of the i -th child is returned back to him for the first time for every i from 1 to n . Consider the following example: p = [5, 1, 2, 4, 3] . The book of the 1 -st kid will be passed to the following kids: So after the fourth day, the book of the first kid will return to its owner. The book of the fourth kid will return to him for the first time after exactly one day. You have to answer q independent queries. The first line of the input contains one integer q ( 1 <= q <= 200 ) -- the number of queries. Then q queries follow. The first line of the query contains one integer n ( 1 <= n <= 200 ) -- the number of kids in the query. The second line of the query contains n integers p_1, p_2, ... , p_n ( 1 <= p_i <= n , all p_i are distinct, i.e. p is a permutation), where p_i is the kid which will get the book of the i -th kid. For each query, print the answer on it: n integers a_1, a_2, ... , a_n , where a_i is the number of the day the book o"...

Tutorials

Codeforces Round #595 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
64760513 Ghozlan B1 Nov. 12, 2019, 6:57 p.m. OK Clang++17 Diagnostics TESTS 21 343 204800 1000
63257445 harsha314 B1 Oct. 23, 2019, 6:46 p.m. OK Clang++17 Diagnostics TESTS 21 686 2150400 1000
63247093 Just_Matvey B1 Oct. 23, 2019, 2:57 p.m. OK FPC TESTS 21 155 0 1000
63236961 tranminhprvt01 B1 Oct. 23, 2019, 12:32 p.m. OK FPC TESTS 21 155 307200 1000
66650209 shubh101220001 B1 Dec. 11, 2019, 6:42 p.m. OK GNU C11 TESTS 21 140 0 1000
63399519 OrangeIn-Month B1 Oct. 25, 2019, 5:49 p.m. OK GNU C11 TESTS 21 140 0 1000
64508209 censor B1 Nov. 8, 2019, 7:48 a.m. OK GNU C11 TESTS 21 140 0 1000
63914388 jschr B1 Oct. 31, 2019, 9:31 a.m. OK GNU C11 TESTS 21 140 1638400 1000
65549610 _Tom_ B1 Nov. 22, 2019, 6:20 p.m. OK GNU C11 TESTS 21 155 0 1000
63495833 Mashiyat B1 Oct. 26, 2019, 3:32 p.m. OK GNU C11 TESTS 21 155 0 1000
64473657 felven B1 Nov. 7, 2019, 1:46 p.m. OK GNU C11 TESTS 21 155 0 1000
63613841 samay_kothari B1 Oct. 27, 2019, 6:32 p.m. OK GNU C11 TESTS 21 155 819200 1000
68124825 DMenor B1 Jan. 3, 2020, 2:46 p.m. OK GNU C11 TESTS 21 156 0 1000
68485189 dongbin1999 B1 Jan. 10, 2020, 9:25 a.m. OK GNU C11 TESTS 21 156 0 1000
63271836 BLUESKY007 B1 Oct. 24, 2019, 4:41 a.m. OK GNU C++11 TESTS 21 15 1843200 1000
63223348 luogu_bot4 B1 Oct. 23, 2019, 8:34 a.m. OK GNU C++11 TESTS 21 15 33075200 1000
65996928 Mcggvc B1 Nov. 29, 2019, 5:51 p.m. OK GNU C++11 TESTS 21 30 204800 1000
63740982 Johnsonsecond B1 Oct. 29, 2019, 4:55 p.m. OK GNU C++11 TESTS 21 30 614400 1000
69445352 cornivores B1 Jan. 24, 2020, 2:21 a.m. OK GNU C++11 TESTS 21 30 1638400 1000
63266195 REFLAME_ASH B1 Oct. 24, 2019, 12:20 a.m. OK GNU C++11 TESTS 21 30 1638400 1000
63233194 luojz B1 Oct. 23, 2019, 11:35 a.m. OK GNU C++11 TESTS 21 30 1843200 1000
63210001 urchin-c B1 Oct. 23, 2019, 3:08 a.m. OK GNU C++11 TESTS 21 30 2252800 1000
64773868 MelonMeow_ylh B1 Nov. 13, 2019, 2:33 a.m. OK GNU C++11 TESTS 21 30 2457600 1000
63207524 huanggs B1 Oct. 23, 2019, 1:13 a.m. OK GNU C++11 TESTS 21 30 7270400 1000
63230118 martingarrix18 B1 Oct. 23, 2019, 10:40 a.m. OK GNU C++14 TESTS 21 15 102400 1000
69536459 _Math.man B1 Jan. 25, 2020, 7:05 p.m. OK GNU C++14 TESTS 21 15 16179200 1000
63267785 arasHi_ B1 Oct. 24, 2019, 1:40 a.m. OK GNU C++14 TESTS 21 30 0 1000
66659955 AbhayMistry B1 Dec. 12, 2019, 3:42 a.m. OK GNU C++14 TESTS 21 30 0 1000
66772839 dy2000 B1 Dec. 13, 2019, 8:42 a.m. OK GNU C++14 TESTS 21 30 0 1000
67979382 rathi_ankush24 B1 Dec. 30, 2019, 6:27 p.m. OK GNU C++14 TESTS 21 30 0 1000
65168978 witch_factory B1 Nov. 16, 2019, 2:23 p.m. OK GNU C++14 TESTS 21 30 0 1000
63246486 nisnt_2411 B1 Oct. 23, 2019, 2:47 p.m. OK GNU C++14 TESTS 21 30 0 1000
63657527 SugA B1 Oct. 28, 2019, 1:08 p.m. OK GNU C++14 TESTS 21 30 0 1000
63773977 Akash.s B1 Oct. 30, 2019, 8:54 a.m. OK GNU C++14 TESTS 21 30 0 1000
63401082 Vasyl_Protsiv B1 Oct. 25, 2019, 6:22 p.m. OK GNU C++17 TESTS 21 15 204800 1000
66225329 snjumaheshwari98 B1 Dec. 3, 2019, 12:23 p.m. OK GNU C++17 TESTS 21 15 512000 1000
63232598 Love_oneplus B1 Oct. 23, 2019, 11:25 a.m. OK GNU C++17 TESTS 21 15 1843200 1000
66159319 zhouxiansheng B1 Dec. 2, 2019, 2:48 a.m. OK GNU C++17 TESTS 21 15 2662400 1000
67781931 oduesp B1 Dec. 28, 2019, 11:17 a.m. OK GNU C++17 TESTS 21 15 4198400 1000
65919997 lesssia B1 Nov. 28, 2019, 3:59 p.m. OK GNU C++17 TESTS 21 30 0 1000
63433578 Mizar0 B1 Oct. 26, 2019, 9:52 a.m. OK GNU C++17 TESTS 21 30 0 1000
63953220 wadhah1000 B1 Oct. 31, 2019, 11:05 p.m. OK GNU C++17 TESTS 21 30 0 1000
65726092 slfyzz.2 B1 Nov. 25, 2019, 11:19 p.m. OK GNU C++17 TESTS 21 30 0 1000
67277078 YanBee B1 Dec. 20, 2019, 10:37 a.m. OK GNU C++17 TESTS 21 30 102400 1000
63355946 synapse B1 Oct. 25, 2019, 2:37 a.m. OK Go TESTS 21 46 0 1000
63243976 rnazmo B1 Oct. 23, 2019, 2:10 p.m. OK Go TESTS 21 46 13414400 1000
64159339 SchrodZzz B1 Nov. 3, 2019, 1:55 p.m. OK Go TESTS 21 62 0 1000
66071369 LeoVertiz B1 Nov. 30, 2019, 7:41 p.m. OK Go TESTS 21 686 0 1000
65512666 bluesky111 B1 Nov. 22, 2019, 5:06 a.m. OK Java 11 TESTS 21 171 0 1000
63243022 Ahmed_Diab B1 Oct. 23, 2019, 1:56 p.m. OK Java 11 TESTS 21 202 0 1000
63239629 Maaddy B1 Oct. 23, 2019, 1:08 p.m. OK Java 11 TESTS 21 202 0 1000
63237909 tapanr97 B1 Oct. 23, 2019, 12:45 p.m. OK Java 11 TESTS 21 202 0 1000
65500587 pizzaEater B1 Nov. 21, 2019, 6:40 p.m. OK Java 11 TESTS 21 217 0 1000
67137691 lightseba B1 Dec. 18, 2019, 5:13 a.m. OK Java 11 TESTS 21 218 0 1000
63284293 LightYagami674 B1 Oct. 24, 2019, 9:46 a.m. OK Java 11 TESTS 21 218 0 1000
68583757 warrioramrit B1 Jan. 11, 2020, 10:43 a.m. OK Java 11 TESTS 21 234 0 1000
63204869 bbkivines B1 Oct. 22, 2019, 10:58 p.m. OK Java 11 TESTS 21 295 0 1000
66569801 al_Jahy B1 Dec. 10, 2019, 3:19 a.m. OK Java 11 TESTS 21 342 0 1000
64664081 dyhu083 B1 Nov. 10, 2019, 11:56 p.m. OK Java 8 TESTS 21 108 0 1000
69854852 musaab B1 Jan. 30, 2020, 4:40 p.m. OK Java 8 TESTS 21 109 0 1000
68465231 GiantTornado B1 Jan. 9, 2020, 7:58 p.m. OK Java 8 TESTS 21 109 0 1000
65950752 kocko B1 Nov. 29, 2019, 10:46 a.m. OK Java 8 TESTS 21 109 0 1000
63224265 cribabby B1 Oct. 23, 2019, 8:49 a.m. OK Java 8 TESTS 21 109 0 1000
69854374 mufaddalnaya B1 Jan. 30, 2020, 4:33 p.m. OK Java 8 TESTS 21 124 0 1000
68067312 amolpratap007 B1 Jan. 2, 2020, 8:32 a.m. OK Java 8 TESTS 21 124 0 1000
67615140 igor_kz B1 Dec. 25, 2019, 4:55 p.m. OK Java 8 TESTS 21 124 0 1000
66006862 osama.bmaq B1 Nov. 29, 2019, 10:33 p.m. OK Java 8 TESTS 21 124 0 1000
64523987 Nutella3000 B1 Nov. 8, 2019, 1:11 p.m. OK Java 8 TESTS 21 124 0 1000
63980458 648771054 B1 Nov. 1, 2019, 10:06 a.m. OK JavaScript TESTS 21 62 1331200 1000
64615850 rishu_sharma94 B1 Nov. 10, 2019, 4:46 a.m. OK JavaScript TESTS 21 405 1638400 1000
67521407 Killer45 B1 Dec. 24, 2019, 12:32 p.m. OK Kotlin TESTS 21 124 0 1000
63208335 Spheniscine B1 Oct. 23, 2019, 1:52 a.m. OK Kotlin TESTS 21 140 102400 1000
65711233 AsuraPro B1 Nov. 25, 2019, 2:27 p.m. OK Kotlin TESTS 21 171 204800 1000
63752343 kiuny B1 Oct. 29, 2019, 8:56 p.m. OK Kotlin TESTS 21 171 204800 1000
65711148 AsuraPro B1 Nov. 25, 2019, 2:25 p.m. OK Kotlin TESTS 21 186 204800 1000
63280218 Black_Fregat B1 Oct. 24, 2019, 8:25 a.m. OK Kotlin TESTS 21 187 307200 1000
63761470 satyamcse B1 Oct. 30, 2019, 4:02 a.m. OK Kotlin TESTS 21 187 1331200 1000
66141477 hyper_sinnniy B1 Dec. 1, 2019, 2:36 p.m. OK Kotlin TESTS 21 202 1433600 1000
64118800 miami_oxford B1 Nov. 2, 2019, 10:50 p.m. OK Kotlin TESTS 21 248 1228800 1000
63758707 mendel_vv B1 Oct. 30, 2019, 1:58 a.m. OK Kotlin TESTS 21 311 204800 1000
63263376 m1_k3 B1 Oct. 23, 2019, 9:42 p.m. OK Mono C# TESTS 21 77 5836800 1000
64201147 nehan B1 Nov. 4, 2019, 11:30 a.m. OK Mono C# TESTS 21 77 6656000 1000
63213848 pcoding B1 Oct. 23, 2019, 5:13 a.m. OK Mono C# TESTS 21 77 6758400 1000
63280463 MAKARonin B1 Oct. 24, 2019, 8:31 a.m. OK Mono C# TESTS 21 78 2969600 1000
64199723 eSeF_ B1 Nov. 4, 2019, 11:05 a.m. OK Mono C# TESTS 21 93 6656000 1000
63230509 hloya B1 Oct. 23, 2019, 10:48 a.m. OK Mono C# TESTS 21 156 6758400 1000
64730670 NEvOl B1 Nov. 12, 2019, 8:19 a.m. OK Mono C# TESTS 21 171 6656000 1000
63431723 Dock290 B1 Oct. 26, 2019, 9:20 a.m. OK Mono C# TESTS 21 186 3072000 1000
63380463 Strelokask B1 Oct. 25, 2019, 12:19 p.m. OK Mono C# TESTS 21 186 3072000 1000
63282421 nadilk B1 Oct. 24, 2019, 9:08 a.m. OK Mono C# TESTS 21 186 6553600 1000
65298653 vjudge3 B1 Nov. 18, 2019, 12:27 p.m. OK MS C++ TESTS 21 30 3993600 1000
66137882 vjudge1 B1 Dec. 1, 2019, 1:02 p.m. OK MS C++ TESTS 21 31 0 1000
65840619 vjudge4 B1 Nov. 27, 2019, 2:20 p.m. OK MS C++ TESTS 21 31 0 1000
65690424 vjudge3 B1 Nov. 25, 2019, 4:23 a.m. OK MS C++ TESTS 21 31 0 1000
65689335 vjudge4 B1 Nov. 25, 2019, 3:26 a.m. OK MS C++ TESTS 21 31 0 1000
63425809 vjudge5 B1 Oct. 26, 2019, 7:47 a.m. OK MS C++ TESTS 21 31 0 1000
66042562 vjudge1 B1 Nov. 30, 2019, 2:03 p.m. OK MS C++ TESTS 21 31 0 1000
63425769 vjudge1 B1 Oct. 26, 2019, 7:47 a.m. OK MS C++ TESTS 21 31 1638400 1000
63652042 vjudge3 B1 Oct. 28, 2019, 11:40 a.m. OK MS C++ TESTS 21 31 1638400 1000
64369280 bj126627885 B1 Nov. 6, 2019, 1:51 p.m. OK MS C++ TESTS 21 31 1638400 1000
63209802 IntoSpring B1 Oct. 23, 2019, 3 a.m. OK MS C++ 2017 TESTS 21 31 1843200 1000
65951177 vjudge5 B1 Nov. 29, 2019, 10:55 a.m. OK MS C++ 2017 TESTS 21 46 0 1000
68484894 kim_young_hyun B1 Jan. 10, 2020, 9:17 a.m. OK MS C++ 2017 TESTS 21 46 0 1000
66019324 vjudge4 B1 Nov. 30, 2019, 6:46 a.m. OK MS C++ 2017 TESTS 21 46 0 1000
64795338 jm.wrong B1 Nov. 13, 2019, 12:41 p.m. OK MS C++ 2017 TESTS 21 46 0 1000
64094367 vjudge5 B1 Nov. 2, 2019, 1:30 p.m. OK MS C++ 2017 TESTS 21 46 0 1000
65523865 vjudge3 B1 Nov. 22, 2019, 9:30 a.m. OK MS C++ 2017 TESTS 21 46 307200 1000
65744637 ZA139 B1 Nov. 26, 2019, 11:44 a.m. OK MS C++ 2017 TESTS 21 46 307200 1000
63208834 vjudge2 B1 Oct. 23, 2019, 2:19 a.m. OK MS C++ 2017 TESTS 21 46 409600 1000
63963717 hwangganzi B1 Nov. 1, 2019, 6:20 a.m. OK MS C++ 2017 TESTS 21 46 1228800 1000
64837584 taivu.cse B1 Nov. 13, 2019, 4:20 p.m. OK Node.js TESTS 21 187 5017600 1000
64171638 taivu.cse B1 Nov. 3, 2019, 6:40 p.m. OK Node.js TESTS 21 265 4403200 1000
64172033 taivu.cse B1 Nov. 3, 2019, 6:53 p.m. OK Node.js TESTS 21 389 8601600 1000
65154703 nhatth2 B1 Nov. 16, 2019, 8:52 a.m. OK Node.js TESTS 21 561 9625600 1000
63201888 mayakin B1 Oct. 22, 2019, 9:01 p.m. OK PHP TESTS 21 46 0 1000
63212319 Mukundan314 B1 Oct. 23, 2019, 4:34 a.m. OK PyPy 2 TESTS 21 140 1945600 1000
63369614 alex223 B1 Oct. 25, 2019, 8:52 a.m. OK PyPy 2 TESTS 21 155 1126400 1000
63288272 urs_rs B1 Oct. 24, 2019, 11:02 a.m. OK PyPy 2 TESTS 21 249 1433600 1000
63224927 pein_7 B1 Oct. 23, 2019, 9 a.m. OK PyPy 2 TESTS 21 576 1228800 1000
63702247 sainitejeshwar B1 Oct. 29, 2019, 7:42 a.m. OK PyPy 2 TESTS 21 670 7168000 1000
64189124 alvinhyuan B1 Nov. 4, 2019, 6:52 a.m. OK PyPy 3 TESTS 21 171 2662400 1000
63293364 r57shell B1 Oct. 24, 2019, 12:20 p.m. OK PyPy 3 TESTS 21 171 2867200 1000
65564915 matheusdemiro_ufrpe B1 Nov. 23, 2019, 5:24 a.m. OK PyPy 3 TESTS 21 186 2560000 1000
63901893 bit_2 B1 Oct. 31, 2019, 5:01 a.m. OK PyPy 3 TESTS 21 186 2662400 1000
64689303 ArthurT B1 Nov. 11, 2019, 12:40 p.m. OK PyPy 3 TESTS 21 186 2764800 1000
64859242 inferior B1 Nov. 14, 2019, 1:56 a.m. OK PyPy 3 TESTS 21 186 5427200 1000
65122147 ldbach346 B1 Nov. 16, 2019, 2:20 a.m. OK PyPy 3 TESTS 21 187 2252800 1000
63225607 diwakar123 B1 Oct. 23, 2019, 9:12 a.m. OK PyPy 3 TESTS 21 187 2457600 1000
63211955 sklgm B1 Oct. 23, 2019, 4:23 a.m. OK PyPy 3 TESTS 21 187 2457600 1000
64356979 yanpekkinen B1 Nov. 6, 2019, 10:34 a.m. OK PyPy 3 TESTS 21 187 2560000 1000
69934861 44184005TuanNB B1 Feb. 1, 2020, 3:04 a.m. OK Python 2 TESTS 21 202 204800 1000
64100037 kalrover B1 Nov. 2, 2019, 3:07 p.m. OK Python 2 TESTS 21 202 204800 1000
63924285 SoSooding B1 Oct. 31, 2019, 12:37 p.m. OK Python 2 TESTS 21 202 204800 1000
63230871 Madhur1906 B1 Oct. 23, 2019, 10:55 a.m. OK Python 2 TESTS 21 217 102400 1000
69823532 bsr011 B1 Jan. 30, 2020, 8:35 a.m. OK Python 2 TESTS 21 249 102400 1000
63199895 Mike10 B1 Oct. 22, 2019, 8:01 p.m. OK Python 2 TESTS 21 811 512000 1000
63295248 SalmonTimo B1 Oct. 24, 2019, 12:49 p.m. OK Python 3 TESTS 21 124 409600 1000
63622403 raiccoon936 B1 Oct. 28, 2019, 12:29 a.m. OK Python 3 TESTS 21 124 614400 1000
64274790 knight-erraunt B1 Nov. 4, 2019, 8:44 p.m. OK Python 3 TESTS 21 139 512000 1000
63367925 tdthuan B1 Oct. 25, 2019, 8:14 a.m. OK Python 3 TESTS 21 139 614400 1000
64704338 T3o B1 Nov. 11, 2019, 3:54 p.m. OK Python 3 TESTS 21 139 819200 1000
63373998 orailly B1 Oct. 25, 2019, 10:23 a.m. OK Python 3 TESTS 21 139 921600 1000
63235622 midez B1 Oct. 23, 2019, 12:12 p.m. OK Python 3 TESTS 21 140 307200 1000
63216110 atnas B1 Oct. 23, 2019, 6:09 a.m. OK Python 3 TESTS 21 140 307200 1000
63647490 imulan B1 Oct. 28, 2019, 10:15 a.m. OK Python 3 TESTS 21 140 614400 1000
63395889 harsh_9200 B1 Oct. 25, 2019, 4:39 p.m. OK Python 3 TESTS 21 140 614400 1000
64842030 maxglushkov561 B1 Nov. 13, 2019, 4:39 p.m. OK Rust TESTS 21 31 102400 1000
63303310 didy_kpn B1 Oct. 24, 2019, 2:53 p.m. OK Rust TESTS 21 202 102400 1000
63653509 sonya123 B1 Oct. 28, 2019, 12:03 p.m. OK Scala TESTS 21 467 0 1000

remove filters

Back to search problems