結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-17 14:53:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,184 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 22,444 KB
最終ジャッジ日時 2023-09-17 16:33:22
合計ジャッジ時間 20,794 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,760 KB
testcase_01 AC 16 ms
7,800 KB
testcase_02 AC 16 ms
7,856 KB
testcase_03 AC 16 ms
7,856 KB
testcase_04 AC 17 ms
7,776 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 16 ms
7,876 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 783 ms
17,256 KB
testcase_09 AC 160 ms
10,416 KB
testcase_10 AC 587 ms
15,488 KB
testcase_11 AC 406 ms
14,612 KB
testcase_12 AC 968 ms
20,600 KB
testcase_13 AC 1,059 ms
20,392 KB
testcase_14 AC 564 ms
14,936 KB
testcase_15 AC 1,136 ms
22,444 KB
testcase_16 AC 887 ms
21,256 KB
testcase_17 AC 1,003 ms
21,180 KB
testcase_18 AC 16 ms
7,812 KB
testcase_19 AC 16 ms
7,936 KB
testcase_20 AC 35 ms
9,900 KB
testcase_21 AC 1,173 ms
21,916 KB
testcase_22 AC 1,121 ms
21,884 KB
testcase_23 AC 16 ms
7,832 KB
testcase_24 AC 16 ms
7,788 KB
testcase_25 AC 16 ms
7,764 KB
testcase_26 AC 16 ms
7,828 KB
testcase_27 AC 16 ms
7,928 KB
testcase_28 AC 643 ms
16,524 KB
testcase_29 AC 940 ms
21,060 KB
testcase_30 AC 802 ms
18,604 KB
testcase_31 AC 680 ms
16,496 KB
testcase_32 AC 883 ms
21,344 KB
testcase_33 AC 1,159 ms
21,420 KB
testcase_34 AC 1,150 ms
21,276 KB
testcase_35 AC 1,184 ms
21,676 KB
testcase_36 AC 1,157 ms
21,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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