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 nonnegative integers. Let's define the prefix OR array b as the array b_i = a_1~ mathsf{OR}~a_2~ mathsf{OR}~ ... ~ mathsf{OR}~a_i , where mathsf{OR} represents the bitwise OR operation. In other words, the array b is formed by computing the mathsf{OR} of every prefix of a . You are asked to rearrange the elements of the array a in such a way that its prefix OR array is lexicographically maximum. An array x is lexicographically greater than an array y if in the first position where x and y differ, x_i > y_i . The first line of the input contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the length of the array a . The second line of each test case contains n nonnegative integers a_1, ldots, a_n ( 0 <= q a_i <= q 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 print n integers -- any rearrangement of the array a that obtains the lexicographically maximum prefix OR array. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
176085949 |
chrisfcoder |
G |
Oct. 14, 2022, 2:02 a.m. |
OK |
C# 10 |
TESTS |
23 |
109 |
39424000 |
|
|
176072495 |
alexhu |
G |
Oct. 13, 2022, 8:52 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
93 |
1843200 |
|
|
176068899 |
mahabub.rahman |
G |
Oct. 13, 2022, 8:02 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
93 |
1843200 |
|
|
176079505 |
omeganot |
G |
Oct. 13, 2022, 11:44 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
93 |
3481600 |
|
|
176074143 |
conexposys |
G |
Oct. 13, 2022, 9:20 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
93 |
5017600 |
|
|
176074031 |
conexposys |
G |
Oct. 13, 2022, 9:18 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
93 |
6041600 |
|
|
176099429 |
tushar217 |
G |
Oct. 14, 2022, 5:11 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
93 |
9625600 |
|
|
176089116 |
A_Big_Jiong |
G |
Oct. 14, 2022, 2:48 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
108 |
1024000 |
|
|
176068916 |
ReimuHakurei |
G |
Oct. 13, 2022, 8:02 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
108 |
1843200 |
|
|
176057315 |
Deft_t |
G |
Oct. 13, 2022, 6:08 p.m. |
OK |
GNU C++14 |
TESTS |
21 |
108 |
2048000 |
|
|
176071049 |
Msahilkumar |
G |
Oct. 13, 2022, 8:29 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
108 |
3276800 |
|
|
176088075 |
realcobb |
G |
Oct. 14, 2022, 2:33 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
93 |
1843200 |
|
|
176060483 |
NguyenYinder |
G |
Oct. 13, 2022, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
93 |
2252800 |
|
|
176063364 |
datdatdat035 |
G |
Oct. 13, 2022, 7 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
93 |
2662400 |
|
|
176103464 |
Sky_Warrior |
G |
Oct. 14, 2022, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
93 |
3584000 |
|
|
176076193 |
willwin4sure |
G |
Oct. 13, 2022, 10:02 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
93 |
4608000 |
|
|
176101827 |
ZXG_DZXX |
G |
Oct. 14, 2022, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
108 |
1024000 |
|
|
176078470 |
im_grooooot |
G |
Oct. 13, 2022, 11:09 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
108 |
1331200 |
|
|
176054671 |
iiJoe |
G |
Oct. 13, 2022, 5:48 p.m. |
OK |
GNU C++17 |
TESTS |
21 |
108 |
1843200 |
|
|
176086899 |
Mkswll |
G |
Oct. 14, 2022, 2:17 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
108 |
2048000 |
|
|
176062627 |
devlov |
G |
Oct. 13, 2022, 6:54 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
108 |
2457600 |
|
|
176101792 |
BlackGuy42 |
G |
Oct. 14, 2022, 5:37 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
77 |
1843200 |
|
|
176090426 |
Lycorisss |
G |
Oct. 14, 2022, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
77 |
2969600 |
|
|
176090220 |
Lycoriss |
G |
Oct. 14, 2022, 3:04 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
77 |
2969600 |
|
|
176074812 |
CIXTEEN |
G |
Oct. 13, 2022, 9:33 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
77 |
4300800 |
|
|
176066626 |
Mercersfire |
G |
Oct. 13, 2022, 7:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
77 |
4403200 |
|
|
176098522 |
Liam_Evander |
G |
Oct. 14, 2022, 5 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
78 |
1638400 |
|
|
176058561 |
katalonecfly |
G |
Oct. 13, 2022, 6:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
78 |
1843200 |
|
|
176072782 |
Malheiros |
G |
Oct. 13, 2022, 8:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
78 |
2048000 |
|
|
176094115 |
Time_JYF |
G |
Oct. 14, 2022, 3:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
78 |
2969600 |
|
|
176090177 |
Lycoriss |
G |
Oct. 14, 2022, 3:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
78 |
2969600 |
|
|
176061041 |
AdiCoder03 |
G |
Oct. 13, 2022, 6:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
46 |
2048000 |
|
|
176089002 |
xiaoru |
G |
Oct. 14, 2022, 2:46 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
2969600 |
|
|
176070878 |
EthanZhao1fan |
G |
Oct. 13, 2022, 8:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
22 |
46 |
4198400 |
|
|
176090755 |
166Kangkang |
G |
Oct. 14, 2022, 3:11 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
46 |
16076800 |
|
|
176103571 |
tox1c_kid |
G |
Oct. 14, 2022, 5:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
61 |
819200 |
|
|
176084540 |
CEH_Abanoub_Ashraf_1 |
G |
Oct. 14, 2022, 1:37 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
61 |
1843200 |
|
|
176088544 |
IoI.dream |
G |
Oct. 14, 2022, 2:40 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
61 |
1945600 |
|
|
176057646 |
Ghieath |
G |
Oct. 13, 2022, 6:11 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
61 |
2048000 |
|
|
176052996 |
esomer |
G |
Oct. 13, 2022, 5:38 p.m. |
OK |
GNU C++20 (64) |
TESTS |
21 |
61 |
2764800 |
|
|
176089585 |
GGeed |
G |
Oct. 14, 2022, 2:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
61 |
2867200 |
|
|
176078401 |
chenxiaoming |
G |
Oct. 13, 2022, 11:06 p.m. |
OK |
Java 11 |
TESTS |
23 |
296 |
25600000 |
|
|
176053319 |
kartik__sethi |
G |
Oct. 13, 2022, 5:40 p.m. |
OK |
Java 11 |
TESTS |
21 |
343 |
24985600 |
|
|
176071956 |
KnightKnight |
G |
Oct. 13, 2022, 8:43 p.m. |
OK |
Java 11 |
TESTS |
22 |
904 |
25190400 |
|
|
176061669 |
Eslam_Ahmed |
G |
Oct. 13, 2022, 6:45 p.m. |
OK |
Java 11 |
TESTS |
22 |
997 |
122572800 |
|
|
176057012 |
dhruv_07 |
G |
Oct. 13, 2022, 6:06 p.m. |
OK |
Java 11 |
TESTS |
21 |
1154 |
25600000 |
|
|
176092406 |
puneetgarg2601 |
G |
Oct. 14, 2022, 3:35 a.m. |
OK |
Java 11 |
TESTS |
23 |
1185 |
0 |
|
|
176057060 |
bigBull2 |
G |
Oct. 13, 2022, 6:06 p.m. |
OK |
Java 17 |
TESTS |
21 |
1248 |
40857600 |
|
|
176093796 |
frey4 |
G |
Oct. 14, 2022, 3:54 a.m. |
OK |
Java 8 |
TESTS |
23 |
171 |
2764800 |
|
|
176060315 |
sachinjaiswal |
G |
Oct. 13, 2022, 6:33 p.m. |
OK |
Java 8 |
TESTS |
22 |
218 |
24883200 |
|
|
176063647 |
vaibhav_1710 |
G |
Oct. 13, 2022, 7:04 p.m. |
OK |
Java 8 |
TESTS |
22 |
234 |
24371200 |
|
|
176068610 |
i_wanna_date_fishy15 |
G |
Oct. 13, 2022, 7:58 p.m. |
OK |
Java 8 |
TESTS |
22 |
389 |
21299200 |
|
|
176057412 |
Mohamed308 |
G |
Oct. 13, 2022, 6:09 p.m. |
OK |
Java 8 |
TESTS |
21 |
436 |
36249600 |
|
|
176077626 |
Sussykin |
G |
Oct. 13, 2022, 10:39 p.m. |
OK |
Java 8 |
TESTS |
23 |
451 |
26214400 |
|
|
176069182 |
Karakurik |
G |
Oct. 13, 2022, 8:05 p.m. |
OK |
Java 8 |
TESTS |
22 |
467 |
21504000 |
|
|
176069940 |
brain4real |
G |
Oct. 13, 2022, 8:15 p.m. |
OK |
Java 8 |
TESTS |
22 |
1029 |
19660800 |
|
|
176095449 |
JingNian |
G |
Oct. 14, 2022, 4:19 a.m. |
OK |
Java 8 |
TESTS |
23 |
1933 |
19353600 |
|
|
176096675 |
hash1025 |
G |
Oct. 14, 2022, 4:36 a.m. |
OK |
PyPy 3 |
TESTS |
23 |
296 |
26624000 |
|
|
176095977 |
hash1025 |
G |
Oct. 14, 2022, 4:26 a.m. |
OK |
PyPy 3 |
TESTS |
23 |
1123 |
56627200 |
|
|
176074616 |
McPqndq |
G |
Oct. 13, 2022, 9:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
156 |
57241600 |
|
|
176087157 |
bokunopicolo |
G |
Oct. 14, 2022, 2:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
170 |
27340800 |
|
|
176089361 |
mintplz |
G |
Oct. 14, 2022, 2:51 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
171 |
30310400 |
|
|
176086955 |
bokunopicolo |
G |
Oct. 14, 2022, 2:18 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
171 |
45260800 |
|
|
176059125 |
furiousteabag |
G |
Oct. 13, 2022, 6:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
171 |
56934400 |
|
|
176084342 |
ColterCodes |
G |
Oct. 14, 2022, 1:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
186 |
58470400 |
|
|
176087767 |
wwwwzhh |
G |
Oct. 14, 2022, 2:29 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
186 |
161996800 |
|
|
176096240 |
kwin |
G |
Oct. 14, 2022, 4:30 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
202 |
31539200 |
|
|
176071016 |
sohamm20 |
G |
Oct. 13, 2022, 8:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
202 |
49254400 |
|
|
176062270 |
del-user-774348 |
G |
Oct. 13, 2022, 6:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
22 |
202 |
50278400 |
|
|
176060496 |
saini.laxman2002 |
G |
Oct. 13, 2022, 6:34 p.m. |
OK |
Python 3 |
TESTS |
22 |
467 |
20480000 |
|
|
176096541 |
2000030977cse |
G |
Oct. 14, 2022, 4:34 a.m. |
OK |
Python 3 |
TESTS |
23 |
545 |
15769600 |
|
|
176061295 |
yogiswarvvs |
G |
Oct. 13, 2022, 6:41 p.m. |
OK |
Python 3 |
TESTS |
22 |
546 |
17100800 |
|
|
176088697 |
2000030671cse |
G |
Oct. 14, 2022, 2:42 a.m. |
OK |
Python 3 |
TESTS |
23 |
561 |
15974400 |
|
|
176089398 |
liut |
G |
Oct. 14, 2022, 2:51 a.m. |
OK |
Rust 2021 |
TESTS |
23 |
46 |
819200 |
|
|
remove filters
Back to search problems