Codeforces Global Round 8

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
1368 Codeforces Global Round 8 FINISHED False 9000 139331699 June 18, 2020, 2:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11943 ) D AND, OR and square sum PROGRAMMING bitmasks greedy math

B'Gottfried learned about binary number representation. He then came up with this task and presented it to you. You are given a collection of n non-negative integers a_1, ldots, a_n . You are allowed to perform the following operation: choose two distinct indices 1 <= q i, j <= q n . If before the operation a_i = x , a_j = y , then after the operation a_i = x~ mathsf{AND}~y , a_j = x~ mathsf{OR}~y , where mathsf{AND} and mathsf{OR} are bitwise AND and OR respectively (refer to the Notes section for formal description). The operation may be performed any number of times (possibly zero). After all operations are done, compute sum_{i=1}^n a_i^2 -- the sum of squares of all a_i . What is the largest sum of squares you can achieve? The first line contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ). The second line contains n integers a_1, ldots, a_n ( 0 <= q a_i < 2^{20} ). Print a single integer -- the largest possible sum of squares that can be achieved after several (possibly zero) operations. In the first sample no operation can be made, thus the answer is 123^2 . In the second sample we can obtain the collection 1, 1, 7 , and 1^2 + 1^2 + 7^2 = 51 . If x and y are represented in binary with equal number of bits (possibly with leading zeros), then each bit of x~ mathsf{AND}~y is set to 1 if and only if both corresponding bits of x and y are set to 1 . Similarly, each bit of x~ mathsf{OR}~y is set to 1 if and only if at least one of the corresponding bits of x and y are set to 1 . For example, x = 3 and y = 5 are represented as 011_2 and 101_2 (highest bit first). Then, x~ mathsf{AND}~y = 001_2 = 1 , and x~ mathsf{OR}~y = 111_2 = 7 . '...

Tutorials

Codeforces Global Round 8: editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
84226809 daut-dlang D June 18, 2020, 4:03 p.m. OK D TESTS 17 78 13516800
84259406 ano_nymous D June 18, 2020, 5:14 p.m. OK GNU C11 TESTS 17 62 1843200
84257173 CaptainShammer D June 18, 2020, 5:11 p.m. OK GNU C11 TESTS 17 78 1638400
84230906 yhc19990202 D June 18, 2020, 4:12 p.m. OK GNU C11 TESTS 17 342 1638400
84285513 EncodeTalker D June 19, 2020, 2:54 a.m. OK GNU C++11 TESTS 17 31 307200
84231692 Thomasguo666 D June 18, 2020, 4:13 p.m. OK GNU C++11 TESTS 17 31 3174400
84227323 jiedai D June 18, 2020, 4:04 p.m. OK GNU C++11 TESTS 17 31 11980800
84291813 jeffyang D June 19, 2020, 5:10 a.m. OK GNU C++11 TESTS 17 46 0
84283782 Frame233 D June 19, 2020, 2:04 a.m. OK GNU C++11 TESTS 17 46 0
84221664 jeffyang D June 18, 2020, 3:52 p.m. OK GNU C++11 TESTS 17 46 0
84290234 Hosea D June 19, 2020, 4:37 a.m. OK GNU C++11 TESTS 17 46 819200
84285617 hunxuewangzi D June 19, 2020, 2:56 a.m. OK GNU C++11 TESTS 17 46 819200
84285491 Juanzhang D June 19, 2020, 2:54 a.m. OK GNU C++11 TESTS 17 46 819200
84233697 clfzs D June 18, 2020, 4:18 p.m. OK GNU C++11 TESTS 17 46 1024000
84225950 EntityIT D June 18, 2020, 4:01 p.m. OK GNU C++14 TESTS 17 62 0
84225602 minchae D June 18, 2020, 4 p.m. OK GNU C++14 TESTS 17 62 0
84225026 Kira_1234 D June 18, 2020, 3:59 p.m. OK GNU C++14 TESTS 17 62 0
84221925 Radon12 D June 18, 2020, 3:53 p.m. OK GNU C++14 TESTS 17 62 0
84236725 violet72 D June 18, 2020, 4:24 p.m. OK GNU C++14 TESTS 17 62 0
84280045 angrysp D June 18, 2020, 11:17 p.m. OK GNU C++14 TESTS 17 62 0
84284419 Best_Darius_VN D June 19, 2020, 2:23 a.m. OK GNU C++14 TESTS 17 62 0
84253579 m.mahdi2414 D June 18, 2020, 5:04 p.m. OK GNU C++14 TESTS 17 62 819200
84225083 JioFell D June 18, 2020, 3:59 p.m. OK GNU C++14 TESTS 17 62 1638400
84228678 NamSPro D June 18, 2020, 4:07 p.m. OK GNU C++14 TESTS 17 62 1638400
84244883 june_waves D June 18, 2020, 4:43 p.m. OK GNU C++17 TESTS 17 62 0
84283126 LZFeng D June 19, 2020, 1:37 a.m. OK GNU C++17 TESTS 17 62 0
84260738 Tuff1aha D June 18, 2020, 5:55 p.m. OK GNU C++17 TESTS 17 62 0
84247515 JuYangskr D June 18, 2020, 4:50 p.m. OK GNU C++17 TESTS 17 62 0
84269807 cc15 D June 18, 2020, 7:07 p.m. OK GNU C++17 TESTS 17 62 819200
84286759 Sweet_Gift D June 19, 2020, 3:27 a.m. OK GNU C++17 TESTS 17 62 2457600
84287246 Sweet_Gift D June 19, 2020, 3:39 a.m. OK GNU C++17 TESTS 17 62 2662400
84276876 Incognito_Mode_On D June 18, 2020, 9:25 p.m. OK GNU C++17 TESTS 17 77 0
84272639 shubham107 D June 18, 2020, 7:54 p.m. OK GNU C++17 TESTS 17 77 0
84271332 CODE4H4 D June 18, 2020, 7:32 p.m. OK GNU C++17 TESTS 17 77 0
84225941 hello_codeforces D June 18, 2020, 4:01 p.m. OK GNU C++17 (64) TESTS 17 46 0
84225024 Georgiy_Ulanov D June 18, 2020, 3:59 p.m. OK GNU C++17 (64) TESTS 17 46 0
84224263 jayeshaw D June 18, 2020, 3:58 p.m. OK GNU C++17 (64) TESTS 17 46 0
84224040 KhaledRezk D June 18, 2020, 3:57 p.m. OK GNU C++17 (64) TESTS 17 46 0
84257823 sirswaginson D June 18, 2020, 5:12 p.m. OK GNU C++17 (64) TESTS 17 46 0
84249082 huzaifa242 D June 18, 2020, 4:54 p.m. OK GNU C++17 (64) TESTS 17 46 0
84242020 _Helix_ D June 18, 2020, 4:36 p.m. OK GNU C++17 (64) TESTS 17 46 0
84244715 AMO5 D June 18, 2020, 4:43 p.m. OK GNU C++17 (64) TESTS 17 46 819200
84262078 hello_codeforces D June 18, 2020, 6:04 p.m. OK GNU C++17 (64) TESTS 17 46 819200
84283036 generic_placeholder_name D June 19, 2020, 1:34 a.m. OK GNU C++17 (64) TESTS 17 46 819200
84271657 Russell_Emerine D June 18, 2020, 7:38 p.m. OK Haskell TESTS 17 670 36761600
84229171 buj D June 18, 2020, 4:08 p.m. OK Haskell TESTS 17 982 163942400
84254705 blackBird D June 18, 2020, 5:07 p.m. OK Java 11 TESTS 17 187 0
84281256 AshrafEzz D June 19, 2020, 12:18 a.m. OK Java 11 TESTS 17 202 0
84248868 sf14t D June 18, 2020, 4:53 p.m. OK Java 11 TESTS 17 202 0
84219249 derrick20 D June 18, 2020, 3:48 p.m. OK Java 11 TESTS 17 202 102400
84290032 ritik_16 D June 19, 2020, 4:34 a.m. OK Java 11 TESTS 17 218 0
84277212 pikapika00 D June 18, 2020, 9:34 p.m. OK Java 11 TESTS 17 218 0
84262142 egaeus.code D June 18, 2020, 6:05 p.m. OK Java 11 TESTS 17 233 0
84228686 Giantpizzahead D June 18, 2020, 4:07 p.m. OK Java 11 TESTS 17 233 0
84261119 vivek21 D June 18, 2020, 5:57 p.m. OK Java 11 TESTS 17 234 0
84247543 hiromi_ayase D June 18, 2020, 4:50 p.m. OK Java 11 TESTS 17 248 0
84222822 iceburst D June 18, 2020, 3:55 p.m. OK Java 8 TESTS 17 124 0
84278877 bluesky111 D June 18, 2020, 10:25 p.m. OK Java 8 TESTS 17 124 0
84294491 Faizan D June 19, 2020, 6:01 a.m. OK Java 8 TESTS 17 139 0
84234960 narushima D June 18, 2020, 4:20 p.m. OK Java 8 TESTS 17 139 0
84223785 barakraganosungam D June 18, 2020, 3:57 p.m. OK Java 8 TESTS 17 139 0
84293958 Keyur21 D June 19, 2020, 5:45 a.m. OK Java 8 TESTS 17 140 0
84258042 Naman_123 D June 18, 2020, 5:13 p.m. OK Java 8 TESTS 17 140 0
84291631 abc_000 D June 19, 2020, 5:07 a.m. OK Java 8 TESTS 17 155 0
84243102 out_of_the_box D June 18, 2020, 4:39 p.m. OK Java 8 TESTS 17 155 0
84238880 saurabhs9913 D June 18, 2020, 4:29 p.m. OK Java 8 TESTS 17 155 0
84248343 abdukodir D June 18, 2020, 4:52 p.m. OK Kotlin TESTS 17 342 39116800
84245961 MaxPylypovych D June 18, 2020, 4:46 p.m. OK Kotlin TESTS 17 405 16793600
84238128 sergmel D June 18, 2020, 4:27 p.m. OK Kotlin TESTS 17 530 16998400
84222480 batkhuyag D June 18, 2020, 3:54 p.m. OK Kotlin TESTS 17 717 16793600
84253539 Kolyanich D June 18, 2020, 5:04 p.m. OK Mono C# TESTS 17 140 0
84234130 mban259 D June 18, 2020, 4:19 p.m. OK Mono C# TESTS 17 202 26624000
84248105 _Trung_Nguyen D June 18, 2020, 4:51 p.m. OK Mono C# TESTS 17 779 59289600
84222141 lxhgww D June 18, 2020, 3:53 p.m. OK MS C++ TESTS 17 62 0
84270787 xsc D June 18, 2020, 7:23 p.m. OK MS C++ 2017 TESTS 17 78 0
84224833 P___ D June 18, 2020, 3:59 p.m. OK MS C++ 2017 TESTS 17 93 0
84222250 pichulia D June 18, 2020, 3:54 p.m. OK MS C++ 2017 TESTS 17 93 16076800
84281127 ningBr D June 19, 2020, 12:13 a.m. OK MS C++ 2017 TESTS 17 108 3481600
84249161 dbsthdud918 D June 18, 2020, 4:54 p.m. OK MS C++ 2017 TESTS 17 171 0
84262241 BpeMeHHa91_TryDHocTb D June 18, 2020, 6:06 p.m. OK MS C++ 2017 TESTS 17 171 0
84287284 duaduadua D June 19, 2020, 3:40 a.m. OK MS C++ 2017 TESTS 17 171 1638400
84237308 JulesIMF D June 18, 2020, 4:26 p.m. OK MS C++ 2017 TESTS 17 186 0
84238908 Awerar D June 18, 2020, 4:29 p.m. OK MS C++ 2017 TESTS 17 187 0
84218803 nns2009 D June 18, 2020, 3:47 p.m. OK MS C++ 2017 TESTS 17 187 819200
84223406 harttle D June 18, 2020, 3:56 p.m. OK Node.js TESTS 17 187 25292800
84248610 wolffd D June 18, 2020, 4:53 p.m. OK PyPy 2 TESTS 17 233 11468800
84219821 ap1008 D June 18, 2020, 3:49 p.m. OK PyPy 2 TESTS 17 248 11468800
84232246 shehebe D June 18, 2020, 4:15 p.m. OK PyPy 2 TESTS 17 280 12902400
84278770 chris-md D June 18, 2020, 10:21 p.m. OK PyPy 2 TESTS 17 296 12595200
84237339 Hitikkumar D June 18, 2020, 4:26 p.m. OK PyPy 2 TESTS 17 436 11468800
84267103 beethoven97 D June 18, 2020, 6:35 p.m. OK PyPy 2 TESTS 17 452 15052800
84241530 chris-md D June 18, 2020, 4:35 p.m. OK PyPy 2 TESTS 17 623 13107200
84269243 UTMoonlight D June 18, 2020, 6:59 p.m. OK PyPy 3 TESTS 17 233 11571200
84257489 ulyabelyaeva D June 18, 2020, 5:12 p.m. OK PyPy 3 TESTS 17 295 16384000
84229989 aberent D June 18, 2020, 4:10 p.m. OK PyPy 3 TESTS 17 296 16281600
84278059 srkvrm D June 18, 2020, 9:59 p.m. OK PyPy 3 TESTS 17 327 16281600
84252600 KA_Rma D June 18, 2020, 5:02 p.m. OK PyPy 3 TESTS 17 327 16281600
84287561 sul3 D June 19, 2020, 3:46 a.m. OK PyPy 3 TESTS 17 327 16384000
84219069 ilia-ivanov D June 18, 2020, 3:48 p.m. OK PyPy 3 TESTS 17 327 16384000
84241182 joe_joe D June 18, 2020, 4:35 p.m. OK PyPy 3 TESTS 17 342 16281600
84245652 eepsilon D June 18, 2020, 4:45 p.m. OK PyPy 3 TESTS 17 342 16384000
84293266 akifpathan D June 19, 2020, 5:35 a.m. OK PyPy 3 TESTS 17 343 15564800
84277608 old_boo D June 18, 2020, 9:44 p.m. OK Python 3 TESTS 17 1575 14745600
84280318 _Fizzz_ D June 18, 2020, 11:30 p.m. OK Python 3 TESTS 17 1591 14233600
84267938 jai_dewani D June 18, 2020, 6:43 p.m. OK Python 3 TESTS 17 1933 17408000
84268115 sh1194 D June 18, 2020, 6:45 p.m. OK Python 3 TESTS 17 1934 17305600
84219135 robostac D June 18, 2020, 3:48 p.m. OK Rust TESTS 17 46 7065600
84242343 GeoffreyY D June 18, 2020, 4:37 p.m. OK Rust TESTS 17 61 5529600
84245390 macho_uno D June 18, 2020, 4:45 p.m. OK Rust TESTS 17 77 25600000

remove filters

Back to search problems