Educational Codeforces Round 158 (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
1901 Educational Codeforces Round 158 (Rated for Div. 2) FINISHED False 7200 30986699 Nov. 24, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12129 ) C Add, Divide and Floor PROGRAMMING constructive algorithms greedy math

B"You are given an integer array a_1, a_2, ... , a_n ( 0 <= a_i <= 10^9 ). In one operation, you can choose an integer x ( 0 <= x <= 10^{18} ) and replace a_i with lfloor frac{a_i + x}{2} rfloor ( lfloor y rfloor denotes rounding y down to the nearest integer) for all i from 1 to n . Pay attention to the fact that all elements of the array are affected on each operation. Print the smallest number of operations required to make all elements of the array equal. If the number of operations is less than or equal to n , then print the chosen x for each operation. If there are multiple answers, print any of them. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of testcases. The first line of each testcase contains a single integer n ( 1 <= n <= 2 cdot 10^5 ). The second line contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 10^9 ). The sum of n over all testcases doesn't exceed 2 cdot 10^5 . For each testcase, print the smallest number of operations required to make all elements of the array equal. If the number of operations is less than or equal to n , then print the chosen x for each operation in the next line. If there are multiple answers, print any of them. In the first testcase, all elements are already equal, so 0 operations are required. It doesn't matter if you print an empty line afterwards or not. In the second testcase, you can't make less than 2 operations. There are multiple answers, let's consider the answer sequence [2, 5] . After applying an operation with x = 2 , the array becomes [ lfloor frac{4 + 2}{2} rfloor, lfloor frac{6 + 2}{2} rfloor] = [3, 4] . After applying an operation with x = 5 after that, the array becomes [ lfloor frac{3 + 5}{2} rfloor, lfloor frac{4 + 5}{2} rfloor] = [4, 4] . Both elements are the same,"...

Tutorials

Educational Codeforces Round 158 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
234154147 ksandr1v C Nov. 24, 2023, 9:56 p.m. OK C# 10 TESTS 10 109 3584000
234148269 ksandr1v C Nov. 24, 2023, 8:28 p.m. OK C# 10 TESTS 10 139 3276800
234131866 tahtarovserver C Nov. 24, 2023, 5:58 p.m. OK C# 10 TESTS 10 155 15974400
234111103 kuuso C Nov. 24, 2023, 4:23 p.m. OK C# 8 TESTS 10 124 30003200
234176757 bluemegane C Nov. 25, 2023, 5:12 a.m. OK C# 8 TESTS 10 202 16588800
234176574 bluemegane C Nov. 25, 2023, 5:11 a.m. OK C# 8 TESTS 10 233 16691200
234155845 Gassa C Nov. 24, 2023, 10:28 p.m. OK D TESTS 10 108 13721600
234156265 Gassa C Nov. 24, 2023, 10:37 p.m. OK D TESTS 10 109 13721600
234123106 Unk1ndled C Nov. 24, 2023, 5 p.m. OK GNU C11 TESTS 10 358 0
234123260 Unk1ndled C Nov. 24, 2023, 5:01 p.m. OK GNU C11 TESTS 10 374 0
234120396 pash18i5 C Nov. 24, 2023, 4:46 p.m. OK GNU C11 TESTS 10 374 0
234112440 tsaiyilin C Nov. 24, 2023, 4:26 p.m. OK GNU C11 TESTS 10 405 1638400
234163321 Do_2007_Vinh C Nov. 25, 2023, 1:46 a.m. OK GNU C++14 TESTS 10 61 204800
234115549 tinnam.choi C Nov. 24, 2023, 4:32 p.m. OK GNU C++14 TESTS 10 61 819200
234158038 usernameson C Nov. 24, 2023, 11:24 p.m. OK GNU C++14 TESTS 10 62 204800
234114653 esenekal C Nov. 24, 2023, 4:30 p.m. OK GNU C++14 TESTS 10 62 204800
234175352 bharat_ppa C Nov. 25, 2023, 4:58 a.m. OK GNU C++14 TESTS 10 62 204800
234112935 storybehind C Nov. 24, 2023, 4:27 p.m. OK GNU C++14 TESTS 10 62 819200
234117099 Gokuu_ C Nov. 24, 2023, 4:34 p.m. OK GNU C++14 TESTS 10 62 819200
234128502 Gold_Dragon C Nov. 24, 2023, 5:33 p.m. OK GNU C++14 TESTS 10 62 819200
234157368 liuyz11 C Nov. 24, 2023, 11:05 p.m. OK GNU C++14 TESTS 10 62 819200
234115747 TCO_ C Nov. 24, 2023, 4:32 p.m. OK GNU C++14 TESTS 10 62 819200
234120330 Nitin_R C Nov. 24, 2023, 4:46 p.m. OK GNU C++17 TESTS 10 31 2150400
234162642 DostoyevskyDecomp C Nov. 25, 2023, 1:31 a.m. OK GNU C++17 TESTS 10 46 204800
234121961 verywater C Nov. 24, 2023, 4:54 p.m. OK GNU C++17 TESTS 10 46 819200
234147817 The_wolf2004 C Nov. 24, 2023, 8:23 p.m. OK GNU C++17 TESTS 10 61 204800
234179475 Starrismxx C Nov. 25, 2023, 5:40 a.m. OK GNU C++17 TESTS 10 61 921600
234119906 admiring_xm C Nov. 24, 2023, 4:44 p.m. OK GNU C++17 TESTS 10 61 2150400
234122060 Jarry666 C Nov. 24, 2023, 4:54 p.m. OK GNU C++17 TESTS 10 62 0
234129437 nihal_gupta C Nov. 24, 2023, 5:40 p.m. OK GNU C++17 TESTS 10 62 204800
234133570 AngelOlan C Nov. 24, 2023, 6:10 p.m. OK GNU C++17 TESTS 10 62 204800
234169801 kimmoqt C Nov. 25, 2023, 3:44 a.m. OK GNU C++17 TESTS 10 62 204800
234165360 fs20091003 C Nov. 25, 2023, 2:26 a.m. OK GNU C++17 (64) TESTS 10 46 0
234163853 zml2022 C Nov. 25, 2023, 1:57 a.m. OK GNU C++17 (64) TESTS 10 46 0
234135038 vinkentclicker27 C Nov. 24, 2023, 6:20 p.m. OK GNU C++17 (64) TESTS 10 46 819200
234164878 Once_I_Liked_AGirl C Nov. 25, 2023, 2:17 a.m. OK GNU C++17 (64) TESTS 10 46 819200
234168681 enslaved C Nov. 25, 2023, 3:26 a.m. OK GNU C++17 (64) TESTS 10 46 819200
234127535 ASLEH C Nov. 24, 2023, 5:26 p.m. OK GNU C++17 (64) TESTS 10 46 819200
234171001 niqiqi C Nov. 25, 2023, 4:04 a.m. OK GNU C++17 (64) TESTS 10 46 819200
234177297 manishjha91 C Nov. 25, 2023, 5:18 a.m. OK GNU C++17 (64) TESTS 10 46 1638400
234172854 abhinav_jain05 C Nov. 25, 2023, 4:29 a.m. OK GNU C++17 (64) TESTS 10 46 1638400
234170821 ShantanuBhojak C Nov. 25, 2023, 4:01 a.m. OK GNU C++17 (64) TESTS 10 46 1638400
234115490 Ferrriccc C Nov. 24, 2023, 4:32 p.m. OK GNU C++20 (64) TESTS 10 15 819200
234128511 -A-shes C Nov. 24, 2023, 5:33 p.m. OK GNU C++20 (64) TESTS 10 31 0
234171460 DaniDiazTech C Nov. 25, 2023, 4:10 a.m. OK GNU C++20 (64) TESTS 10 31 0
234169404 LLGM C Nov. 25, 2023, 3:38 a.m. OK GNU C++20 (64) TESTS 10 31 0
234165516 Anish_Singh_Dhami_07 C Nov. 25, 2023, 2:29 a.m. OK GNU C++20 (64) TESTS 10 31 0
234163859 shonnn C Nov. 25, 2023, 1:57 a.m. OK GNU C++20 (64) TESTS 10 31 0
234132220 LamKappa C Nov. 24, 2023, 6 p.m. OK GNU C++20 (64) TESTS 10 31 0
234129793 Eslam_Saleh C Nov. 24, 2023, 5:42 p.m. OK GNU C++20 (64) TESTS 10 31 0
234123836 MiaoMia C Nov. 24, 2023, 5:04 p.m. OK GNU C++20 (64) TESTS 10 31 0
234120007 TecoSC C Nov. 24, 2023, 4:44 p.m. OK GNU C++20 (64) TESTS 10 31 0
234164986 lxy_sheep C Nov. 25, 2023, 2:19 a.m. OK Go TESTS 10 124 7987200
234111380 Pranav_Sharda C Nov. 24, 2023, 4:24 p.m. OK Java 11 TESTS 10 265 0
234114120 Pranav_Sharda C Nov. 24, 2023, 4:29 p.m. OK Java 11 TESTS 10 265 102400
234117091 rajkothari634 C Nov. 24, 2023, 4:34 p.m. OK Java 11 TESTS 10 420 0
234111287 shivanshu_100 C Nov. 24, 2023, 4:23 p.m. OK Java 11 TESTS 10 545 0
234150388 PlayDate C Nov. 24, 2023, 8:56 p.m. OK Java 11 TESTS 10 810 0
234134663 CutSandstone C Nov. 24, 2023, 6:18 p.m. OK Java 17 TESTS 10 217 4403200
234160668 nis1234 C Nov. 25, 2023, 12:44 a.m. OK Java 17 TESTS 10 264 409600
234120738 Liiii C Nov. 24, 2023, 4:48 p.m. OK Java 17 TESTS 10 264 409600
234138826 aishwarykesarwani C Nov. 24, 2023, 6:51 p.m. OK Java 17 TESTS 10 280 512000
234127637 28leoleo28 C Nov. 24, 2023, 5:27 p.m. OK Java 17 TESTS 10 280 512000
234120884 tirthgohil1410 C Nov. 24, 2023, 4:48 p.m. OK Java 17 TESTS 10 280 716800
234127453 28leoleo28 C Nov. 24, 2023, 5:26 p.m. OK Java 17 TESTS 10 295 716800
234131806 puriabhijit000 C Nov. 24, 2023, 5:57 p.m. OK Java 17 TESTS 10 295 1126400
234133980 Nagendravarma C Nov. 24, 2023, 6:13 p.m. OK Java 17 TESTS 10 296 716800
234115711 Jagnath_Reddy C Nov. 24, 2023, 4:32 p.m. OK Java 17 TESTS 10 296 716800
234163463 frey4 C Nov. 25, 2023, 1:49 a.m. OK Java 21 TESTS 10 311 204800
234140367 Akash_Sardar C Nov. 24, 2023, 7:04 p.m. OK Java 21 TESTS 10 374 20684800
234112566 mcrash12 C Nov. 24, 2023, 4:26 p.m. OK Java 21 TESTS 10 546 102400
234120151 fibukki C Nov. 24, 2023, 4:45 p.m. OK Java 21 TESTS 10 889 614400
234156474 Kenzhezhan C Nov. 24, 2023, 10:42 p.m. OK Java 8 TESTS 10 124 0
234123915 _ShenHua_ C Nov. 24, 2023, 5:04 p.m. OK Java 8 TESTS 10 171 0
234123052 _ShenHua_ C Nov. 24, 2023, 5 p.m. OK Java 8 TESTS 10 171 0
234122701 _ShenHua_ C Nov. 24, 2023, 4:58 p.m. OK Java 8 TESTS 10 171 0
234119367 zhassulan018 C Nov. 24, 2023, 4:41 p.m. OK Java 8 TESTS 10 171 3481600
234122305 _ShenHua_ C Nov. 24, 2023, 4:55 p.m. OK Java 8 TESTS 10 186 0
234153756 vatsal_04 C Nov. 24, 2023, 9:48 p.m. OK Java 8 TESTS 10 187 2764800
234121549 priyaroy3370 C Nov. 24, 2023, 4:52 p.m. OK Java 8 TESTS 10 202 7168000
234179901 formidablechief_27 C Nov. 25, 2023, 5:43 a.m. OK Java 8 TESTS 10 218 11264000
234137590 Sumitsingh7 C Nov. 24, 2023, 6:40 p.m. OK Java 8 TESTS 10 405 7475200
234110451 Lex_b C Nov. 24, 2023, 4:22 p.m. OK MS C++ 2017 TESTS 10 280 0
234154930 tytsmile C Nov. 24, 2023, 10:10 p.m. OK MS C++ 2017 TESTS 10 280 819200
234126680 baloomba C Nov. 24, 2023, 5:20 p.m. OK MS C++ 2017 TESTS 10 327 819200
234121367 PranavMare C Nov. 24, 2023, 4:51 p.m. OK PyPy 3 TESTS 10 280 20582400
234152285 Keramine C Nov. 24, 2023, 9:24 p.m. OK PyPy 3 TESTS 10 436 19558400
234152273 Keramine C Nov. 24, 2023, 9:23 p.m. OK PyPy 3 TESTS 10 436 20582400
234163991 kaiicheng C Nov. 25, 2023, 2 a.m. OK PyPy 3 TESTS 10 577 18227200
234137204 eanvarov09 C Nov. 24, 2023, 6:37 p.m. OK PyPy 3 TESTS 10 608 21094400
234115265 JustTheory C Nov. 24, 2023, 4:31 p.m. OK PyPy 3-64 TESTS 10 155 26624000
234169113 aaronhartono28 C Nov. 25, 2023, 3:33 a.m. OK PyPy 3-64 TESTS 10 155 27545600
234174210 vedantmishra69 C Nov. 25, 2023, 4:46 a.m. OK PyPy 3-64 TESTS 10 155 29388800
234129043 wish-nu C Nov. 24, 2023, 5:37 p.m. OK PyPy 3-64 TESTS 10 155 30924800
234167279 aaronhartono28 C Nov. 25, 2023, 3:01 a.m. OK PyPy 3-64 TESTS 10 156 27545600
234118828 hkwu6013 C Nov. 24, 2023, 4:39 p.m. OK PyPy 3-64 TESTS 10 186 27545600
234120102 peb C Nov. 24, 2023, 4:45 p.m. OK PyPy 3-64 TESTS 10 187 26624000
234115621 dirac_de C Nov. 24, 2023, 4:32 p.m. OK PyPy 3-64 TESTS 10 187 29184000
234116578 _M_H_M_ C Nov. 24, 2023, 4:33 p.m. OK PyPy 3-64 TESTS 10 202 20582400
234121173 trydiv2 C Nov. 24, 2023, 4:50 p.m. OK PyPy 3-64 TESTS 10 202 25088000
234128738 Niki_fx C Nov. 24, 2023, 5:35 p.m. OK Python 3 TESTS 10 202 26828800
234127622 Pavan_kumar_Jangam C Nov. 24, 2023, 5:27 p.m. OK Python 3 TESTS 10 217 26828800
234110526 itzme_dhruv C Nov. 24, 2023, 4:22 p.m. OK Python 3 TESTS 10 218 28979200
234142888 Surajk21 C Nov. 24, 2023, 7:29 p.m. OK Python 3 TESTS 10 249 26828800
234141497 Exyon75 C Nov. 24, 2023, 7:15 p.m. OK Python 3 TESTS 10 249 26828800
234121444 pauldubois98 C Nov. 24, 2023, 4:51 p.m. OK Python 3 TESTS 10 249 26828800
234114197 MinghengZhong C Nov. 24, 2023, 4:29 p.m. OK Python 3 TESTS 10 264 26828800
234112842 gotfried_leibniz C Nov. 24, 2023, 4:27 p.m. OK Python 3 TESTS 10 265 26828800
234173916 onelasttime99 C Nov. 25, 2023, 4:42 a.m. OK Python 3 TESTS 10 280 26828800
234167565 s2003 C Nov. 25, 2023, 3:06 a.m. OK Python 3 TESTS 10 295 26828800
234109599 points_engineering C Nov. 24, 2023, 4:20 p.m. OK Ruby 3 TESTS 10 826 23347200
234141643 randoguy C Nov. 24, 2023, 7:16 p.m. OK Rust 2021 TESTS 10 171 6246400
234141432 _a253 C Nov. 24, 2023, 7:14 p.m. OK Rust 2021 TESTS 10 202 17510400

remove filters

Back to search problems