Codeforces Round 858 (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
1806 Codeforces Round 858 (Div. 2) FINISHED False 8100 58125262 March 18, 2023, 12:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7841 ) C Sequence Master PROGRAMMING brute force constructive algorithms math

B'For some positive integer m , YunQian considers an array q of 2m (possibly negative) integers good, if and only if for every possible subsequence of q that has length m , the product of the m elements in the subsequence is equal to the sum of the m elements that are not in the subsequence. Formally, let U= {1,2, ldots,2m } . For all sets S subseteq U such that |S|=m , prod limits_{i in S} q_i = sum limits_{i in U setminus S} q_i . Define the distance between two arrays a and b both of length k to be sum limits_{i=1}^k|a_i-b_i| . You are given a positive integer n and an array p of 2n integers. Find the minimum distance between p and q over all good arrays q of length 2n . It can be shown for all positive integers n , at least one good array exists. Note that you are not required to construct the array q that achieves this minimum distance. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 2 cdot10^5 ). The second line of each test case contains 2n integers p_1, p_2, ldots, p_{2n} ( |p_i| <= 10^9 ). It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output the minimum distance between p and a good q . In the first test case, it is optimal to let q=[6,6] . In the second test case, it is optimal to let q=[2,2,2,2] . '...

Tutorials

Codeforces Round #858 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
198030926 FST_Forces C March 19, 2023, 1:01 a.m. OK FPC TESTS 28 171 6451200
197998905 ruban C March 18, 2023, 5:23 p.m. OK FPC TESTS 28 374 155648000
198044747 jack.murphy.mydays C March 19, 2023, 5:27 a.m. OK GNU C11 TESTS 28 109 0
198042322 jack.murphy.mydays C March 19, 2023, 4:57 a.m. OK GNU C11 TESTS 28 109 0
198044506 jack.murphy.mydays C March 19, 2023, 5:25 a.m. OK GNU C11 TESTS 28 109 0
198044603 jack.murphy.mydays C March 19, 2023, 5:26 a.m. OK GNU C11 TESTS 28 124 0
197980306 Blackening C March 18, 2023, 3:09 p.m. OK GNU C++14 TESTS 28 109 0
198035232 b___ C March 19, 2023, 2:43 a.m. OK GNU C++14 TESTS 28 109 1536000
198032384 lllei C March 19, 2023, 1:39 a.m. OK GNU C++14 TESTS 28 109 1638400
198028561 tx344 C March 18, 2023, 11:47 p.m. OK GNU C++14 TESTS 28 109 1638400
197987603 confidencemen7 C March 18, 2023, 3:56 p.m. OK GNU C++14 TESTS 28 109 1638400
198045487 lizsen C March 19, 2023, 5:35 a.m. OK GNU C++14 TESTS 28 109 1638400
198037799 zhuoxingmu C March 19, 2023, 3:37 a.m. OK GNU C++14 TESTS 28 109 3993600
197979327 wuhudsm C March 18, 2023, 3:03 p.m. OK GNU C++14 TESTS 28 109 3993600
197988986 xx001 C March 18, 2023, 4:06 p.m. OK GNU C++14 TESTS 28 124 0
198034239 lycc C March 19, 2023, 2:23 a.m. OK GNU C++14 TESTS 28 124 1638400
198001283 GonFreecss2830 C March 18, 2023, 5:42 p.m. OK GNU C++17 TESTS 28 109 1638400
197980574 TimDSF C March 18, 2023, 3:11 p.m. OK GNU C++17 TESTS 28 124 1536000
198036137 xyh_522 C March 19, 2023, 3:02 a.m. OK GNU C++17 TESTS 28 124 1638400
198034597 CtrlACtrlV C March 19, 2023, 2:30 a.m. OK GNU C++17 TESTS 28 124 1638400
198034196 whutzym C March 19, 2023, 2:22 a.m. OK GNU C++17 TESTS 28 124 1638400
198030017 EvitFan C March 19, 2023, 12:32 a.m. OK GNU C++17 TESTS 28 124 1638400
198038377 ZXG_DZXX C March 19, 2023, 3:48 a.m. OK GNU C++17 TESTS 28 124 1638400
198045933 hanchangseo C March 19, 2023, 5:40 a.m. OK GNU C++17 TESTS 28 124 1638400
198047520 Ausert C March 19, 2023, 5:56 a.m. OK GNU C++17 TESTS 28 124 1638400
198038621 flame_sabber C March 19, 2023, 3:54 a.m. OK GNU C++17 TESTS 28 124 1638400
198031683 JWRuixi C March 19, 2023, 1:21 a.m. OK GNU C++17 (64) TESTS 28 46 2662400
198014515 Vedant_05 C March 18, 2023, 7:43 p.m. OK GNU C++17 (64) TESTS 28 77 3174400
198045649 hnust_chenwanjun C March 19, 2023, 5:37 a.m. OK GNU C++17 (64) TESTS 28 77 3993600
197976574 chiruno233 C March 18, 2023, 2:50 p.m. OK GNU C++17 (64) TESTS 28 78 1638400
198040666 iamone C March 19, 2023, 4:31 a.m. OK GNU C++17 (64) TESTS 28 93 1638400
198040695 iamone C March 19, 2023, 4:31 a.m. OK GNU C++17 (64) TESTS 28 93 1638400
197976449 fexla C March 18, 2023, 2:50 p.m. OK GNU C++17 (64) TESTS 28 93 1638400
197992953 LoppA C March 18, 2023, 4:37 p.m. OK GNU C++17 (64) TESTS 28 93 1638400
198045623 Njaso C March 19, 2023, 5:37 a.m. OK GNU C++17 (64) TESTS 28 93 3174400
198039827 umamaheswarareddygoda C March 19, 2023, 4:17 a.m. OK GNU C++17 (64) TESTS 28 93 3174400
197977799 balakrishnan C March 18, 2023, 2:56 p.m. OK GNU C++20 (64) TESTS 28 31 61440000
198019509 SAYANJIT7 C March 18, 2023, 8:43 p.m. OK GNU C++20 (64) TESTS 28 61 3276800
198027052 SCORPION101 C March 18, 2023, 11:04 p.m. OK GNU C++20 (64) TESTS 28 62 1638400
198040647 xzx_123 C March 19, 2023, 4:31 a.m. OK GNU C++20 (64) TESTS 28 62 1638400
198040347 emoreira C March 19, 2023, 4:26 a.m. OK GNU C++20 (64) TESTS 28 62 1638400
198039234 yngxwu C March 19, 2023, 4:06 a.m. OK GNU C++20 (64) TESTS 28 62 1638400
198036817 gugg C March 19, 2023, 3:17 a.m. OK GNU C++20 (64) TESTS 28 62 1638400
198027609 GALA C March 18, 2023, 11:20 p.m. OK GNU C++20 (64) TESTS 28 62 1638400
198018988 3abqreno C March 18, 2023, 8:36 p.m. OK GNU C++20 (64) TESTS 28 62 1638400
198006112 Rising-coder C March 18, 2023, 6:21 p.m. OK GNU C++20 (64) TESTS 28 62 1638400
198008165 PrincessParsley C March 18, 2023, 6:39 p.m. OK Java 11 TESTS 28 280 5529600
197991069 princeayush04 C March 18, 2023, 4:22 p.m. OK Java 11 TESTS 28 296 8806400
197995151 leoncn C March 18, 2023, 4:54 p.m. OK Java 11 TESTS 28 373 16281600
197994499 leoncn C March 18, 2023, 4:49 p.m. OK Java 11 TESTS 28 389 16281600
197985809 xmqsysd C March 18, 2023, 3:43 p.m. OK Java 11 TESTS 28 405 41267200
197976197 kamranm C March 18, 2023, 2:49 p.m. OK Java 11 TESTS 28 421 227020800
197984423 Yousef_Badr C March 18, 2023, 3:34 p.m. OK Java 11 TESTS 28 436 8601600
197980027 xmqsysd C March 18, 2023, 3:07 p.m. OK Java 11 TESTS 28 467 41062400
198037227 PRAJYESH C March 19, 2023, 3:26 a.m. OK Java 11 TESTS 28 716 4505600
197987624 HeXecutor C March 18, 2023, 3:57 p.m. OK Java 11 TESTS 28 748 1228800
198016646 LucunJi C March 18, 2023, 8:07 p.m. OK Java 17 TESTS 28 202 2150400
197978224 john9999911 C March 18, 2023, 2:58 p.m. OK Java 17 TESTS 28 342 2252800
198038867 ICYWONS_K C March 19, 2023, 3:58 a.m. OK Java 17 TESTS 28 811 3993600
198033161 Suraj1607 C March 19, 2023, 1:58 a.m. OK Java 17 TESTS 28 888 2662400
197983326 Two_piece C March 18, 2023, 3:27 p.m. OK Java 8 TESTS 28 295 12800000
197984216 priyaroy3370 C March 18, 2023, 3:33 p.m. OK Java 8 TESTS 28 311 17817600
197987962 xmqsysd C March 18, 2023, 3:59 p.m. OK Java 8 TESTS 28 311 35840000
197987871 xmqsysd C March 18, 2023, 3:58 p.m. OK Java 8 TESTS 28 311 35840000
198037049 amit_roy C March 19, 2023, 3:22 a.m. OK Java 8 TESTS 28 623 102400
197972221 aditya888 C March 18, 2023, 2:17 p.m. OK Java 8 TESTS 28 717 307200
198019137 sachinjaiswal C March 18, 2023, 8:38 p.m. OK Java 8 TESTS 28 780 24985600
197976274 aadrito C March 18, 2023, 2:49 p.m. OK MS C++ 2017 TESTS 28 390 3174400
198035993 1434314294 C March 19, 2023, 2:59 a.m. OK MS C++ 2017 TESTS 28 421 1638400
197971382 Shkiper C March 18, 2023, 2:15 p.m. OK MS C++ 2017 TESTS 28 421 1638400
198041566 EtherealMidnight C March 19, 2023, 4:45 a.m. OK MS C++ 2017 TESTS 28 421 3174400
198029312 AadiS C March 19, 2023, 12:12 a.m. OK PyPy 3 TESTS 28 327 38195200
197990217 dipakgupta007 C March 18, 2023, 4:16 p.m. OK PyPy 3 TESTS 28 514 35328000
197976459 C01V3RT C March 18, 2023, 2:50 p.m. OK PyPy 3 TESTS 28 546 28672000
197988443 Red_eye_ C March 18, 2023, 4:02 p.m. OK PyPy 3 TESTS 28 561 29388800
198033080 bpdolson C March 19, 2023, 1:56 a.m. OK PyPy 3 TESTS 28 576 28467200
197976725 torqueaj C March 18, 2023, 2:51 p.m. OK PyPy 3 TESTS 28 592 29286400
198039263 Youarenotgood C March 19, 2023, 4:06 a.m. OK PyPy 3-64 TESTS 28 186 45465600
198021264 poornaTheja C March 18, 2023, 9:09 p.m. OK PyPy 3-64 TESTS 28 187 38297600
198036103 RobinFromTheHood C March 19, 2023, 3:02 a.m. OK PyPy 3-64 TESTS 28 202 50278400
197978175 SeanInAction C March 18, 2023, 2:57 p.m. OK PyPy 3-64 TESTS 28 218 42086400
198030124 kavorka C March 19, 2023, 12:36 a.m. OK PyPy 3-64 TESTS 28 218 46899200
197992954 rmr C March 18, 2023, 4:37 p.m. OK PyPy 3-64 TESTS 28 233 38604800
198043146 sushmanth.dampur8780 C March 19, 2023, 5:08 a.m. OK PyPy 3-64 TESTS 28 233 45772800
198007568 aman_m42 C March 18, 2023, 6:34 p.m. OK PyPy 3-64 TESTS 28 233 47104000
197992187 rmr C March 18, 2023, 4:31 p.m. OK PyPy 3-64 TESTS 28 249 39628800
197986112 sr_hossain C March 18, 2023, 3:46 p.m. OK PyPy 3-64 TESTS 28 264 53862400
197987017 Lailailai C March 18, 2023, 3:52 p.m. OK Python 3 TESTS 28 483 28262400
198000828 gOeL_CoDeR30 C March 18, 2023, 5:38 p.m. OK Python 3 TESTS 28 514 28467200
198040600 sahil45 C March 19, 2023, 4:30 a.m. OK Python 3 TESTS 28 561 28262400
198000485 mdshadesh C March 18, 2023, 5:35 p.m. OK Python 3 TESTS 28 592 28262400
197973220 arunkart156 C March 18, 2023, 2:19 p.m. OK Python 3 TESTS 28 654 28160000
198017765 MohmadZaid._. C March 18, 2023, 8:20 p.m. OK Python 3 TESTS 28 654 28262400
197981931 MattMcGuire C March 18, 2023, 3:19 p.m. OK Python 3 TESTS 28 748 28262400
197999057 Block_Cipher C March 18, 2023, 5:24 p.m. OK Python 3 TESTS 28 764 28262400
198021744 mxst3r C March 18, 2023, 9:17 p.m. OK Python 3 TESTS 28 764 28774400
198023937 A1mless C March 18, 2023, 9:53 p.m. OK Python 3 TESTS 28 982 28262400
197988540 0npata C March 18, 2023, 4:03 p.m. OK Rust 2021 TESTS 28 93 9625600

remove filters

Back to search problems