Codeforces Round 733 (Div. 1 + Div. 2, based on VK Cup 2021 - Elimination (Engine))

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
1530 Codeforces Round 733 (Div. 1 + Div. 2, based on VK Cup 2021 - Elimination (Engine)) FINISHED False 10800 110647463 July 17, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9387 ) D Secret Santa PROGRAMMING constructive algorithms flows graphs math probabilities

B'Every December, VK traditionally holds an event for its employees named "Secret Santa". Here 's how it happens. n employees numbered from 1 to n take part in the event. Each employee i is assigned a different employee b_i , to which employee i has to make a new year gift. Each employee is assigned to exactly one other employee, and nobody is assigned to themselves (but two employees may be assigned to each other). Formally, all b_i must be distinct integers between 1 and n , and for any i , b_i ne i must hold. The assignment is usually generated randomly. This year, as an experiment, all event participants have been asked who they wish to make a gift to. Each employee i has said that they wish to make a gift to employee a_i . Find a valid assignment b that maximizes the number of fulfilled wishes of the employees. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^5 ). Description of the test cases follows. Each test case consists of two lines. The first line contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of participants of the event. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ; a_i ne i ) -- wishes of the employees in order from 1 to n . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print two lines. In the first line, print a single integer k ( 0 <= k <= n ) -- the number of fulfilled wishes in your assignment. In the second line, print n distinct integers b_1, b_2, ldots, b_n ( 1 <= b_i <= n ; b_i ne i ) -- the numbers of employees assigned to employees 1, 2, ldots, n . k must be equal to the number of values of i such that a_i = b_i , and must be as large as possible. If '...

Tutorials

Codeforces Round #733 Editorial (all problems)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
122864340 ssvb D July 17, 2021, 7:27 p.m. OK D TESTS 52 389 60211200
122869602 rainboy D July 17, 2021, 8:50 p.m. OK GNU C11 TESTS 52 1310 6553600
122892057 HellollWorld D July 18, 2021, 5:48 a.m. OK GNU C++11 TESTS 52 62 7475200
122885456 wkywky D July 18, 2021, 4:08 a.m. OK GNU C++11 TESTS 52 77 6348800
122880877 ZH_comld D July 18, 2021, 2:46 a.m. OK GNU C++11 TESTS 52 77 11161600
122880906 comld D July 18, 2021, 2:46 a.m. OK GNU C++11 TESTS 52 77 11161600
122887860 Moon1125666900 D July 18, 2021, 4:48 a.m. OK GNU C++11 TESTS 52 78 7884800
122855030 Eric_Qian D July 17, 2021, 5:26 p.m. OK GNU C++11 TESTS 52 78 9523200
122871392 Rajib_119 D July 17, 2021, 9:40 p.m. OK GNU C++11 TESTS 52 78 15974400
122880762 1351545721 D July 18, 2021, 2:43 a.m. OK GNU C++11 TESTS 52 93 6144000
122889420 touristyyds D July 18, 2021, 5:10 a.m. OK GNU C++11 TESTS 52 93 7475200
122850699 zuoyifan D July 17, 2021, 5:13 p.m. OK GNU C++11 TESTS 52 93 7884800
122865189 mraron D July 17, 2021, 7:36 p.m. OK GNU C++14 TESTS 52 93 8908800
122881584 GennadyTran D July 18, 2021, 3 a.m. OK GNU C++14 TESTS 52 108 7987200
122891873 I_francis D July 18, 2021, 5:45 a.m. OK GNU C++14 TESTS 52 108 7987200
122890241 yashLadha D July 18, 2021, 5:22 a.m. OK GNU C++14 TESTS 52 108 9113600
122890283 yashLadha D July 18, 2021, 5:23 a.m. OK GNU C++14 TESTS 52 108 9113600
122886918 flamex7 D July 18, 2021, 4:33 a.m. OK GNU C++14 TESTS 52 109 6144000
122848739 _KitCat_ D July 17, 2021, 5:06 p.m. OK GNU C++14 TESTS 52 109 6144000
122885131 Mahdi_ D July 18, 2021, 4:02 a.m. OK GNU C++14 TESTS 52 109 6963200
122884095 ttttyyyy D July 18, 2021, 3:44 a.m. OK GNU C++14 TESTS 52 109 6963200
122869156 dingdingding D July 17, 2021, 8:39 p.m. OK GNU C++14 TESTS 52 109 7168000
122884947 _DCE_ D July 18, 2021, 3:59 a.m. OK GNU C++17 TESTS 52 93 7782400
122890294 yashLadha D July 18, 2021, 5:23 a.m. OK GNU C++17 TESTS 52 93 9113600
122853360 marsgravity D July 17, 2021, 5:21 p.m. OK GNU C++17 TESTS 52 108 7168000
122848280 luatngu D July 17, 2021, 5:05 p.m. OK GNU C++17 TESTS 52 108 7987200
122891649 pavankalyanpallapolu D July 18, 2021, 5:42 a.m. OK GNU C++17 TESTS 52 108 11673600
122855888 xryuseix D July 17, 2021, 5:29 p.m. OK GNU C++17 TESTS 52 109 6144000
122854095 blueKatt D July 17, 2021, 5:23 p.m. OK GNU C++17 TESTS 52 109 6144000
122852058 farion_igor D July 17, 2021, 5:17 p.m. OK GNU C++17 TESTS 52 109 6144000
122884831 cmanh75 D July 18, 2021, 3:58 a.m. OK GNU C++17 TESTS 52 109 6144000
122864787 cdh981009 D July 17, 2021, 7:31 p.m. OK GNU C++17 TESTS 52 109 6144000
122854264 wleung_bvg D July 17, 2021, 5:24 p.m. OK GNU C++17 (64) TESTS 52 46 10752000
122887880 chowdhuryan1999 D July 18, 2021, 4:48 a.m. OK GNU C++17 (64) TESTS 52 77 16588800
122891316 linxd D July 18, 2021, 5:38 a.m. OK GNU C++17 (64) TESTS 52 78 9318400
122867290 Narutobaco D July 17, 2021, 8:04 p.m. OK GNU C++17 (64) TESTS 52 78 9728000
122857402 arora_kshitiz D July 17, 2021, 5:32 p.m. OK GNU C++17 (64) TESTS 52 78 18739200
122855560 lost_boy20 D July 17, 2021, 5:28 p.m. OK GNU C++17 (64) TESTS 52 92 9113600
122847416 baoxyz1234chuan D July 17, 2021, 5:02 p.m. OK GNU C++17 (64) TESTS 52 92 9113600
122867151 rgnerdplayer D July 17, 2021, 8:01 p.m. OK GNU C++17 (64) TESTS 52 93 6758400
122850913 medicdht D July 17, 2021, 5:13 p.m. OK GNU C++17 (64) TESTS 52 93 9113600
122857316 samchen123 D July 17, 2021, 5:32 p.m. OK GNU C++17 (64) TESTS 52 93 9932800
122855438 LiandrysAnguish D July 17, 2021, 5:27 p.m. OK Java 11 TESTS 52 295 39731200
122850625 Pushkar-PM D July 17, 2021, 5:12 p.m. OK Java 11 TESTS 52 311 32768000
122866062 tony_heart D July 17, 2021, 7:46 p.m. OK Java 11 TESTS 52 326 37990400
122884593 akshatj07 D July 18, 2021, 3:54 a.m. OK Java 11 TESTS 52 358 44646400
122892204 hakr_2104 D July 18, 2021, 5:50 a.m. OK Java 11 TESTS 52 389 37580800
122848190 ab5v D July 17, 2021, 5:05 p.m. OK Java 11 TESTS 52 436 48947200
122855342 I_Killed_Jason_Todd D July 17, 2021, 5:27 p.m. OK Java 11 TESTS 52 467 42803200
122892034 Sachin_2961 D July 18, 2021, 5:48 a.m. OK Java 11 TESTS 52 530 41574400
122871303 _Body D July 17, 2021, 9:38 p.m. OK Java 11 TESTS 52 577 61440000
122891210 khaufnak D July 18, 2021, 5:37 a.m. OK Java 11 TESTS 52 592 96358400
122855892 SlowLegendaryNoobMaster D July 17, 2021, 5:29 p.m. OK Java 8 TESTS 52 233 41164800
122865139 TheKingInTheNorth D July 17, 2021, 7:35 p.m. OK Java 8 TESTS 52 296 34201600
122867128 GoldenShadow D July 17, 2021, 8:01 p.m. OK Java 8 TESTS 52 296 36864000
122857303 invincible777 D July 17, 2021, 5:32 p.m. OK Java 8 TESTS 52 358 38092800
122891641 priyam_anand D July 18, 2021, 5:42 a.m. OK Java 8 TESTS 52 358 60416000
122869458 fan_balae D July 17, 2021, 8:46 p.m. OK Java 8 TESTS 52 436 25907200
122890219 naitikvarshney D July 18, 2021, 5:22 a.m. OK Java 8 TESTS 52 514 62054400
122865691 RonWonWon D July 17, 2021, 7:41 p.m. OK Java 8 TESTS 52 592 89292800
122883235 C_nena_E D July 18, 2021, 3:30 a.m. OK Java 8 TESTS 52 763 114585600
122849723 Frank0628 D July 17, 2021, 5:10 p.m. OK Java 8 TESTS 52 779 96051200
122856729 shin2ro D July 17, 2021, 5:31 p.m. OK Kotlin TESTS 52 499 42188800
122848161 dandoh D July 17, 2021, 5:05 p.m. OK Kotlin TESTS 52 529 36147200
122847623 eki D July 17, 2021, 5:03 p.m. OK Mono C# TESTS 52 1465 45568000
122890541 chinaoierlby D July 18, 2021, 5:27 a.m. OK MS C++ TESTS 52 140 23142400
122858109 gleb32 D July 17, 2021, 5:34 p.m. OK MS C++ 2017 TESTS 52 436 11776000
122855380 suVrik D July 17, 2021, 5:27 p.m. OK MS C++ 2017 TESTS 52 889 13414400
122867013 Tangerine D July 17, 2021, 7:59 p.m. OK MS C++ 2017 TESTS 52 904 7680000
122848584 gnomina007 D July 17, 2021, 5:06 p.m. OK MS C++ 2017 TESTS 52 951 11776000
122877499 FLself D July 18, 2021, 1:23 a.m. OK MS C++ 2017 TESTS 52 1934 7065600
122852577 kagu D July 17, 2021, 5:19 p.m. OK PyPy 2 TESTS 52 997 63385600
122865246 nitish420 D July 17, 2021, 7:36 p.m. OK PyPy 3 TESTS 52 311 45670400
122890775 viraj-shah18 D July 18, 2021, 5:31 a.m. OK PyPy 3 TESTS 52 358 50380800
122890793 viraj-shah18 D July 18, 2021, 5:31 a.m. OK PyPy 3 TESTS 52 374 45772800
122848228 iimmortal D July 17, 2021, 5:05 p.m. OK PyPy 3 TESTS 52 389 44236800
122887662 Chef_17 D July 18, 2021, 4:45 a.m. OK PyPy 3 TESTS 52 389 57344000
122891121 viraj-shah18 D July 18, 2021, 5:35 a.m. OK PyPy 3 TESTS 52 420 50278400
122883878 vishwaskalani2002 D July 18, 2021, 3:41 a.m. OK PyPy 3 TESTS 52 421 51712000
122865190 _k_ D July 17, 2021, 7:36 p.m. OK PyPy 3 TESTS 52 421 56320000
122866151 sushmanth.dampur8780 D July 17, 2021, 7:47 p.m. OK PyPy 3 TESTS 52 467 41267200
122873421 Zecx_troy-1 D July 17, 2021, 10:57 p.m. OK PyPy 3 TESTS 52 468 45158400
122883791 shiviDON D July 18, 2021, 3:40 a.m. OK Python 3 TESTS 52 998 36966400
122874132 jogepari D July 17, 2021, 11:26 p.m. OK Python 3 TESTS 52 1044 37068800
122857691 REDVED D July 17, 2021, 5:33 p.m. OK Python 3 TESTS 52 1060 34816000
122857136 vinay272001 D July 17, 2021, 5:32 p.m. OK Python 3 TESTS 52 1075 21504000
122851636 SIXTH-SENSE D July 17, 2021, 5:16 p.m. OK Python 3 TESTS 52 1138 24576000
122849636 codingskg D July 17, 2021, 5:09 p.m. OK Python 3 TESTS 52 1138 24576000
122887368 saurabh3195 D July 18, 2021, 4:40 a.m. OK Python 3 TESTS 52 1185 30720000
122887432 saurabh3195 D July 18, 2021, 4:41 a.m. OK Python 3 TESTS 52 1200 30720000
122887270 saurabh3195 D July 18, 2021, 4:39 a.m. OK Python 3 TESTS 52 1294 35225600
122866189 zouhrydoussama D July 17, 2021, 7:48 p.m. OK Python 3 TESTS 52 1528 24576000
122873077 8uk.8ak D July 17, 2021, 10:42 p.m. OK Rust TESTS 52 108 12595200
122847847 8uk.8ak D July 17, 2021, 5:04 p.m. OK Rust TESTS 52 1793 12595200

remove filters

Back to search problems