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
( 17061 ) B2 Books Exchange (hard version) PROGRAMMING dfs and similar ds math 1300

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 <= 1000 ) -- the number of queries. Then q queries follow. The first line of the query contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- 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. It is guaranteed that sum n <= 2 cdot 10^5 (sum of n over all queries does not exceed 2 cdot 10^5 ). For "...

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
63248106 Just_Matvey B2 Oct. 23, 2019, 3:13 p.m. OK FPC TESTS 7 608 2662400 1300
68755308 chaorenhaha B2 Jan. 14, 2020, 8:05 a.m. OK FPC TESTS 7 608 3174400 1300
68755186 chaorenhaha B2 Jan. 14, 2020, 8:02 a.m. OK FPC TESTS 7 623 6348800 1300
63208445 eugalt B2 Oct. 23, 2019, 1:57 a.m. OK GNU C11 TESTS 7 78 7987200 1300
63208405 eugalt B2 Oct. 23, 2019, 1:55 a.m. OK GNU C11 TESTS 7 78 7987200 1300
63208539 eugalt B2 Oct. 23, 2019, 2:03 a.m. OK GNU C11 TESTS 7 93 7987200 1300
63215474 eugalt B2 Oct. 23, 2019, 5:56 a.m. OK GNU C11 TESTS 7 93 8192000 1300
64650091 torque_459 B2 Nov. 10, 2019, 4:44 p.m. OK GNU C11 TESTS 7 685 1638400 1300
63207641 kaiboy B2 Oct. 23, 2019, 1:18 a.m. OK GNU C11 TESTS 7 685 1638400 1300
63209818 BugLeave B2 Oct. 23, 2019, 3:01 a.m. OK GNU C11 TESTS 7 685 7987200 1300
63301760 Soumya_123 B2 Oct. 24, 2019, 2:29 p.m. OK GNU C11 TESTS 7 701 2457600 1300
69030538 vjudge5 B2 Jan. 18, 2020, 8:02 a.m. OK GNU C11 TESTS 7 701 2457600 1300
63914376 jschr B2 Oct. 31, 2019, 9:30 a.m. OK GNU C11 TESTS 7 701 7987200 1300
66567880 yuzhechuan B2 Dec. 10, 2019, 1 a.m. OK GNU C++11 TESTS 7 31 1638400 1300
63207170 hsm_2021 B2 Oct. 23, 2019, 12:53 a.m. OK GNU C++11 TESTS 7 31 21811200 1300
63208918 Never_out B2 Oct. 23, 2019, 2:23 a.m. OK GNU C++11 TESTS 7 46 2457600 1300
63245659 luogu_bot3 B2 Oct. 23, 2019, 2:35 p.m. OK GNU C++11 TESTS 7 46 6041600 1300
63219912 AyoAyowei B2 Oct. 23, 2019, 7:34 a.m. OK GNU C++11 TESTS 7 46 8806400 1300
63207400 huanggs B2 Oct. 23, 2019, 1:05 a.m. OK GNU C++11 TESTS 7 46 9728000 1300
63220111 AyoAyowei B2 Oct. 23, 2019, 7:38 a.m. OK GNU C++11 TESTS 7 46 10854400 1300
63220002 AyoAyowei B2 Oct. 23, 2019, 7:36 a.m. OK GNU C++11 TESTS 7 46 10854400 1300
63223383 2016c01 B2 Oct. 23, 2019, 8:34 a.m. OK GNU C++11 TESTS 7 61 2252800 1300
64674887 wasa855 B2 Nov. 11, 2019, 7:38 a.m. OK GNU C++11 TESTS 7 61 2457600 1300
63648614 vishnu_m B2 Oct. 28, 2019, 10:39 a.m. OK GNU C++14 TESTS 7 61 819200 1300
64325457 sudip10028 B2 Nov. 5, 2019, 5:07 p.m. OK GNU C++14 TESTS 7 77 1638400 1300
64150311 normaljnoje B2 Nov. 3, 2019, 11:11 a.m. OK GNU C++14 TESTS 7 77 1638400 1300
63982029 Bekh B2 Nov. 1, 2019, 10:37 a.m. OK GNU C++14 TESTS 7 77 2457600 1300
63368511 asceL- B2 Oct. 25, 2019, 8:27 a.m. OK GNU C++14 TESTS 7 77 3379200 1300
64758887 Kasia B2 Nov. 12, 2019, 6:10 p.m. OK GNU C++14 TESTS 7 77 3993600 1300
63220416 Narayan_1255_Dada B2 Oct. 23, 2019, 7:43 a.m. OK GNU C++14 TESTS 7 78 1638400 1300
68482585 vjudge4 B2 Jan. 10, 2020, 8:23 a.m. OK GNU C++14 TESTS 7 78 1638400 1300
63251313 TrainingRoom B2 Oct. 23, 2019, 4:10 p.m. OK GNU C++14 TESTS 7 78 1638400 1300
64366289 blackapple749 B2 Nov. 6, 2019, 1:07 p.m. OK GNU C++14 TESTS 7 78 2355200 1300
63546254 coyorkdow B2 Oct. 27, 2019, 10:36 a.m. OK GNU C++17 TESTS 7 62 3379200 1300
63517309 OussamaJB B2 Oct. 27, 2019, 1:34 a.m. OK GNU C++17 TESTS 7 77 1638400 1300
68965041 jjang36524 B2 Jan. 17, 2020, 4:16 a.m. OK GNU C++17 TESTS 7 77 1638400 1300
63229373 qmzzrdjhwhctrl B2 Oct. 23, 2019, 10:26 a.m. OK GNU C++17 TESTS 7 77 2355200 1300
67938298 Georgioss B2 Dec. 29, 2019, 9:52 p.m. OK GNU C++17 TESTS 7 77 2457600 1300
63850221 hdsingharora99 B2 Oct. 30, 2019, 3:29 p.m. OK GNU C++17 TESTS 7 77 2457600 1300
63761222 tungaqhd B2 Oct. 30, 2019, 3:51 a.m. OK GNU C++17 TESTS 7 77 3174400 1300
63954344 yuruhiya B2 Nov. 1, 2019, 12:07 a.m. OK GNU C++17 TESTS 7 77 3174400 1300
63502800 Agusanso B2 Oct. 26, 2019, 5:46 p.m. OK GNU C++17 TESTS 7 77 3276800 1300
63895437 Monogon B2 Oct. 31, 2019, 1:35 a.m. OK GNU C++17 TESTS 7 77 7372800 1300
63356036 synapse B2 Oct. 25, 2019, 2:41 a.m. OK Go TESTS 7 171 13926400 1300
63418189 yang12138 B2 Oct. 26, 2019, 5:21 a.m. OK Go TESTS 7 826 4608000 1300
65512634 bluesky111 B2 Nov. 22, 2019, 5:05 a.m. OK Java 11 TESTS 7 202 0 1300
63237884 tapanr97 B2 Oct. 23, 2019, 12:45 p.m. OK Java 11 TESTS 7 233 0 1300
63243011 Ahmed_Diab B2 Oct. 23, 2019, 1:56 p.m. OK Java 11 TESTS 7 249 0 1300
63285052 LightYagami674 B2 Oct. 24, 2019, 10:01 a.m. OK Java 11 TESTS 7 264 3584000 1300
63280212 sunkafei B2 Oct. 24, 2019, 8:25 a.m. OK Java 11 TESTS 7 265 1843200 1300
65500619 pizzaEater B2 Nov. 21, 2019, 6:41 p.m. OK Java 11 TESTS 7 280 6860800 1300
63239583 Maaddy B2 Oct. 23, 2019, 1:07 p.m. OK Java 11 TESTS 7 280 10547200 1300
63390515 di_halt B2 Oct. 25, 2019, 3:04 p.m. OK Java 11 TESTS 7 311 9625600 1300
67137699 lightseba B2 Dec. 18, 2019, 5:13 a.m. OK Java 11 TESTS 7 561 200294400 1300
66569800 al_Jahy B2 Dec. 10, 2019, 3:18 a.m. OK Java 11 TESTS 7 904 4096000 1300
69245131 luchy0120 B2 Jan. 21, 2020, 12:40 p.m. OK Java 8 TESTS 7 140 0 1300
63224251 cribabby B2 Oct. 23, 2019, 8:48 a.m. OK Java 8 TESTS 7 140 9830400 1300
64664075 dyhu083 B2 Nov. 10, 2019, 11:56 p.m. OK Java 8 TESTS 7 155 0 1300
63932576 Bhavya_Arora B2 Oct. 31, 2019, 2:43 p.m. OK Java 8 TESTS 7 155 0 1300
63277845 Oland B2 Oct. 24, 2019, 7:36 a.m. OK Java 8 TESTS 7 155 0 1300
64588387 vishal.a.burman23 B2 Nov. 9, 2019, 1:59 p.m. OK Java 8 TESTS 7 156 0 1300
63225192 manish_98 B2 Oct. 23, 2019, 9:05 a.m. OK Java 8 TESTS 7 156 0 1300
63899322 Faizan B2 Oct. 31, 2019, 4:23 a.m. OK Java 8 TESTS 7 156 1536000 1300
63710815 pablo11 B2 Oct. 29, 2019, 9:58 a.m. OK Java 8 TESTS 7 156 16896000 1300
63211440 chojh1222 B2 Oct. 23, 2019, 4:04 a.m. OK Java 8 TESTS 7 170 0 1300
63510494 walborn B2 Oct. 26, 2019, 8:20 p.m. OK JavaScript TESTS 7 171 31027200 1300
67521448 Killer45 B2 Dec. 24, 2019, 12:33 p.m. OK Kotlin TESTS 7 186 4096000 1300
63208330 Spheniscine B2 Oct. 23, 2019, 1:51 a.m. OK Kotlin TESTS 7 217 10342400 1300
65712026 AsuraPro B2 Nov. 25, 2019, 2:45 p.m. OK Kotlin TESTS 7 358 17817600 1300
63761461 satyamcse B2 Oct. 30, 2019, 4:02 a.m. OK Kotlin TESTS 7 405 17100800 1300
63280179 Black_Fregat B2 Oct. 24, 2019, 8:25 a.m. OK Kotlin TESTS 7 405 24166400 1300
66141467 hyper_sinnniy B2 Dec. 1, 2019, 2:36 p.m. OK Kotlin TESTS 7 420 18739200 1300
63752330 kiuny B2 Oct. 29, 2019, 8:56 p.m. OK Kotlin TESTS 7 826 126054400 1300
63758756 mendel_vv B2 Oct. 30, 2019, 2 a.m. OK Kotlin TESTS 7 951 14540800 1300
64119709 miami_oxford B2 Nov. 2, 2019, 11:52 p.m. OK Kotlin TESTS 7 982 17305600 1300
66142093 Glebik8 B2 Dec. 1, 2019, 2:53 p.m. OK Kotlin TESTS 7 998 18227200 1300
63263641 m1_k3 B2 Oct. 23, 2019, 9:55 p.m. OK Mono C# TESTS 7 140 17203200 1300
64199789 eSeF_ B2 Nov. 4, 2019, 11:06 a.m. OK Mono C# TESTS 7 155 31334400 1300
63256371 ilia.kot B2 Oct. 23, 2019, 6:20 p.m. OK Mono C# TESTS 7 171 31334400 1300
63231005 Vovlik B2 Oct. 23, 2019, 10:58 a.m. OK Mono C# TESTS 7 171 32460800 1300
63283074 nadilk B2 Oct. 24, 2019, 9:21 a.m. OK Mono C# TESTS 7 717 30515200 1300
63383331 Strelokask B2 Oct. 25, 2019, 1:05 p.m. OK Mono C# TESTS 7 733 25907200 1300
64730864 NEvOl B2 Nov. 12, 2019, 8:23 a.m. OK Mono C# TESTS 7 748 31232000 1300
63230742 hloya B2 Oct. 23, 2019, 10:53 a.m. OK Mono C# TESTS 7 779 50073600 1300
69604681 vjudge1 B2 Jan. 27, 2020, 9:16 a.m. OK MS C++ TESTS 7 78 1638400 1300
64369303 bj126627885 B2 Nov. 6, 2019, 1:51 p.m. OK MS C++ TESTS 7 78 1638400 1300
69706577 vjudge4 B2 Jan. 29, 2020, 4:56 a.m. OK MS C++ TESTS 7 78 2457600 1300
65594925 vjudge2 B2 Nov. 23, 2019, 3:30 p.m. OK MS C++ TESTS 7 78 3584000 1300
68573157 vjudge5 B2 Jan. 11, 2020, 3:32 a.m. OK MS C++ TESTS 7 78 5017600 1300
65669503 vjudge2 B2 Nov. 24, 2019, 3:19 p.m. OK MS C++ TESTS 7 78 5632000 1300
63523283 vjudge2 B2 Oct. 27, 2019, 4:29 a.m. OK MS C++ TESTS 7 78 7168000 1300
69088710 vjudge1 B2 Jan. 19, 2020, 9:20 a.m. OK MS C++ TESTS 7 93 1638400 1300
68547935 vjudge3 B2 Jan. 10, 2020, 4 p.m. OK MS C++ TESTS 7 93 1638400 1300
68555518 vjudge1 B2 Jan. 10, 2020, 5:05 p.m. OK MS C++ TESTS 7 93 1638400 1300
63200051 pmitkov B2 Oct. 22, 2019, 8:05 p.m. OK MS C++ 2017 TESTS 7 93 4710400 1300
63244566 cursed B2 Oct. 23, 2019, 2:19 p.m. OK MS C++ 2017 TESTS 7 109 2457600 1300
63650805 RONGER B2 Oct. 28, 2019, 11:19 a.m. OK MS C++ 2017 TESTS 7 109 4812800 1300
65955105 vjudge1 B2 Nov. 29, 2019, 12:29 p.m. OK MS C++ 2017 TESTS 7 109 5632000 1300
65822244 Veasky B2 Nov. 27, 2019, 11:04 a.m. OK MS C++ 2017 TESTS 7 109 5632000 1300
63652035 vjudge5 B2 Oct. 28, 2019, 11:40 a.m. OK MS C++ 2017 TESTS 7 109 5632000 1300
63650209 vjudge4 B2 Oct. 28, 2019, 11:10 a.m. OK MS C++ 2017 TESTS 7 109 5632000 1300
63209820 IntoSpring B2 Oct. 23, 2019, 3:01 a.m. OK MS C++ 2017 TESTS 7 109 6553600 1300
63387840 YoshinariYoh B2 Oct. 25, 2019, 2:17 p.m. OK MS C++ 2017 TESTS 7 124 1638400 1300
63769387 kawayisang B2 Oct. 30, 2019, 7:25 a.m. OK MS C++ 2017 TESTS 7 124 3891200 1300
64838286 taivu.cse B2 Nov. 13, 2019, 4:23 p.m. OK Node.js TESTS 7 280 33382400 1300
63201932 mayakin B2 Oct. 22, 2019, 9:03 p.m. OK PHP TESTS 7 139 35225600 1300
63924440 SoSooding B2 Oct. 31, 2019, 12:39 p.m. OK PyPy 2 TESTS 7 202 16793600 1300
63370126 alex223 B2 Oct. 25, 2019, 9:03 a.m. OK PyPy 2 TESTS 7 217 18022400 1300
63375565 alex223 B2 Oct. 25, 2019, 10:55 a.m. OK PyPy 2 TESTS 7 295 22016000 1300
66167057 yumtam B2 Dec. 2, 2019, 8:14 a.m. OK PyPy 2 TESTS 7 311 18124800 1300
65662556 fortmax120 B2 Nov. 24, 2019, 12:59 p.m. OK PyPy 2 TESTS 7 436 17408000 1300
65661860 fortmax120 B2 Nov. 24, 2019, 12:42 p.m. OK PyPy 2 TESTS 7 514 17715200 1300
65662169 fortmax120 B2 Nov. 24, 2019, 12:49 p.m. OK PyPy 2 TESTS 7 514 18022400 1300
64658199 Leendertz B2 Nov. 10, 2019, 7:57 p.m. OK PyPy 3 TESTS 7 311 18636800 1300
64764938 algdgn B2 Nov. 12, 2019, 8:19 p.m. OK PyPy 3 TESTS 7 358 19968000 1300
64356984 yanpekkinen B2 Nov. 6, 2019, 10:34 a.m. OK PyPy 3 TESTS 7 373 19660800 1300
67660886 mstr_shifu B2 Dec. 26, 2019, 3:46 p.m. OK PyPy 3 TESTS 7 373 19865600 1300
68135958 mottoper B2 Jan. 3, 2020, 6:56 p.m. OK PyPy 3 TESTS 7 373 22528000 1300
64189126 alvinhyuan B2 Nov. 4, 2019, 6:52 a.m. OK PyPy 3 TESTS 7 373 26214400 1300
63980428 titanlolcat B2 Nov. 1, 2019, 10:05 a.m. OK PyPy 3 TESTS 7 374 21606400 1300
65108855 jory18 B2 Nov. 15, 2019, 8:49 p.m. OK PyPy 3 TESTS 7 389 20070400 1300
63665878 YasarTK B2 Oct. 28, 2019, 3:18 p.m. OK PyPy 3 TESTS 7 389 20070400 1300
64157460 TilakSN B2 Nov. 3, 2019, 1:17 p.m. OK PyPy 3 TESTS 7 389 20377600 1300
63933610 soumyasarkar1998 B2 Oct. 31, 2019, 3:01 p.m. OK Python 2 TESTS 7 436 12902400 1300
69934851 44184005TuanNB B2 Feb. 1, 2020, 3:04 a.m. OK Python 2 TESTS 7 452 25804800 1300
63230893 Madhur1906 B2 Oct. 23, 2019, 10:56 a.m. OK Python 2 TESTS 7 468 11059200 1300
64100005 kalrover B2 Nov. 2, 2019, 3:07 p.m. OK Python 2 TESTS 7 482 13824000 1300
63703346 sainitejeshwar B2 Oct. 29, 2019, 8:04 a.m. OK Python 2 TESTS 7 560 21401600 1300
65662061 fortmax120 B2 Nov. 24, 2019, 12:47 p.m. OK Python 2 TESTS 7 858 18432000 1300
63374267 orailly B2 Oct. 25, 2019, 10:29 a.m. OK Python 3 TESTS 7 265 16281600 1300
63622419 raiccoon936 B2 Oct. 28, 2019, 12:30 a.m. OK Python 3 TESTS 7 296 20070400 1300
63532372 Wannagrow B2 Oct. 27, 2019, 7:05 a.m. OK Python 3 TESTS 7 311 19558400 1300
63235672 midez B2 Oct. 23, 2019, 12:13 p.m. OK Python 3 TESTS 7 311 19968000 1300
63374020 orailly B2 Oct. 25, 2019, 10:24 a.m. OK Python 3 TESTS 7 326 17203200 1300
63647485 imulan B2 Oct. 28, 2019, 10:15 a.m. OK Python 3 TESTS 7 327 16486400 1300
63760774 Salmonize B2 Oct. 30, 2019, 3:32 a.m. OK Python 3 TESTS 7 327 16793600 1300
63395869 harsh_9200 B2 Oct. 25, 2019, 4:38 p.m. OK Python 3 TESTS 7 327 16896000 1300
63265230 Alastarr B2 Oct. 23, 2019, 11:20 p.m. OK Python 3 TESTS 7 358 16896000 1300
63247192 prsb0824 B2 Oct. 23, 2019, 2:59 p.m. OK Python 3 TESTS 7 358 20582400 1300
63359360 didy_kpn B2 Oct. 25, 2019, 4:42 a.m. OK Rust TESTS 7 62 11059200 1300
63257323 koka831 B2 Oct. 23, 2019, 6:43 p.m. OK Rust TESTS 7 78 3993600 1300
64841911 maxglushkov561 B2 Nov. 13, 2019, 4:38 p.m. OK Rust TESTS 7 78 5529600 1300
63653449 sonya123 B2 Oct. 28, 2019, 12:03 p.m. OK Scala TESTS 7 577 19865600 1300

remove filters

Back to search problems