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.
Problems
B"You are given an array a consisting of n distinct elements and an integer k . Each element in the array is a non-negative integer not exceeding 2^k-1 . Let's define the XOR distance for a number x as the value of f(x) = min limits_{i = 1}^{n} min limits_{j = i + 1}^{n} |(a_i oplus x) - (a_j oplus x)|, where oplus denotes the bitwise XOR operation. For every integer x from 0 to 2^k-1 , you have to calculate f(x) . The first line contains two integers n and k ( 1 <= k <= 19 ; 2 <= n <= 2^k ). The second line contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 2^k-1 ). All these integers are distinct. Print 2^k integers. The i -th of them should be equal to f(i-1) . Consider the first example: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
123381347 |
Comet_Honeymoon |
H |
July 23, 2021, 2:39 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
202 |
10240000 |
|
|
123383884 |
nantf |
H |
July 23, 2021, 3:16 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
888 |
207974400 |
|
|
123385489 |
iqx37f |
H |
July 23, 2021, 3:38 a.m. |
OK |
GNU C++11 |
TESTS |
33 |
904 |
52019200 |
|
|
123346257 |
Subconscious |
H |
July 22, 2021, 4:47 p.m. |
OK |
GNU C++14 |
TESTS |
31 |
249 |
12185600 |
|
|
123388887 |
tzc_wk |
H |
July 23, 2021, 4:27 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
467 |
215449600 |
|
|
123389471 |
Potassium |
H |
July 23, 2021, 4:35 a.m. |
OK |
GNU C++14 |
TESTS |
34 |
483 |
20582400 |
|
|
123380792 |
Comet_Honeymoon |
H |
July 23, 2021, 2:31 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
233 |
10035200 |
|
|
123357199 |
Golovanov399 |
H |
July 22, 2021, 6:44 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
358 |
127692800 |
|
|
123352038 |
BalintR |
H |
July 22, 2021, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
451 |
21811200 |
|
|
123373351 |
Gom |
H |
July 22, 2021, 11:52 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
467 |
54476800 |
|
|
123356616 |
jtnydv25 |
H |
July 22, 2021, 6:41 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
498 |
116531200 |
|
|
123376729 |
sam.rei |
H |
July 23, 2021, 1:23 a.m. |
OK |
GNU C++17 |
TESTS |
33 |
545 |
8089600 |
|
|
123355898 |
fanache99 |
H |
July 22, 2021, 6:37 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
592 |
39628800 |
|
|
123356279 |
Namnamseo |
H |
July 22, 2021, 6:38 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
592 |
408780800 |
|
|
123371940 |
definitelynotmee |
H |
July 22, 2021, 10:58 p.m. |
OK |
GNU C++17 |
TESTS |
33 |
670 |
33177600 |
|
|
123352133 |
Endagorion |
H |
July 22, 2021, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
31 |
685 |
194867200 |
|
|
123379718 |
1021839 |
H |
July 23, 2021, 2:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
171 |
10649600 |
|
|
123356818 |
rainboy |
H |
July 22, 2021, 6:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
171 |
11059200 |
|
|
123383256 |
1021839 |
H |
July 23, 2021, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
186 |
10649600 |
|
|
123379764 |
OIerwanhong |
H |
July 23, 2021, 2:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
234 |
10649600 |
|
|
123356193 |
negiizhao |
H |
July 22, 2021, 6:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
249 |
12595200 |
|
|
123358581 |
Geothermal |
H |
July 22, 2021, 6:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
249 |
28569600 |
|
|
123384387 |
yfhuang |
H |
July 23, 2021, 3:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
264 |
60416000 |
|
|
123355588 |
risujiroh |
H |
July 22, 2021, 6:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
31 |
311 |
44339200 |
|
|
123373535 |
edenooo |
H |
July 22, 2021, 11:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
404 |
33792000 |
|
|
123380395 |
OIerwanhong |
H |
July 23, 2021, 2:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
33 |
405 |
10547200 |
|
|
123386578 |
dalt |
H |
July 23, 2021, 3:53 a.m. |
OK |
Java 11 |
TESTS |
33 |
545 |
41164800 |
|
|
remove filters
Back to search problems