結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-17 15:11:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 582 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 27,048 KB
最終ジャッジ日時 2023-09-17 16:39:35
合計ジャッジ時間 17,832 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,880 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 16 ms
7,744 KB
testcase_06 RE -
testcase_07 AC 16 ms
7,820 KB
testcase_08 AC 658 ms
19,756 KB
testcase_09 AC 132 ms
10,396 KB
testcase_10 AC 487 ms
17,332 KB
testcase_11 AC 343 ms
15,460 KB
testcase_12 AC 777 ms
25,456 KB
testcase_13 AC 861 ms
25,212 KB
testcase_14 AC 487 ms
16,776 KB
testcase_15 AC 960 ms
27,048 KB
testcase_16 AC 762 ms
25,156 KB
testcase_17 AC 867 ms
24,996 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 1,012 ms
26,196 KB
testcase_22 AC 1,010 ms
26,140 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 550 ms
18,436 KB
testcase_29 AC 809 ms
24,856 KB
testcase_30 AC 686 ms
20,304 KB
testcase_31 AC 585 ms
18,456 KB
testcase_32 AC 725 ms
25,440 KB
testcase_33 AC 963 ms
27,044 KB
testcase_34 AC 947 ms
25,784 KB
testcase_35 AC 990 ms
26,120 KB
testcase_36 AC 977 ms
26,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def read_data():
    N = int(input())
    A = list(set(map(int, input().split())))
    return A

def solve(A):
    digits = len(bin(max(A))) - 2
    index = 1 << digits
    rank_upper_bound = min(digits, len(A))
    for rank in range(rank_upper_bound + 1):
        A.sort(reverse=True)
        Ar = A[rank]
        if Ar == 0:
            break
        while index and not Ar & index:
            index >>= 1
        for i in range(rank + 1, len(A)):
            if not A[i] & index:
                break
            A[i] ^= Ar
    return 1 << rank

A = read_data()
print(solve(A))
0