結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,808 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 16 ms
7,928 KB
testcase_03 AC 17 ms
7,940 KB
testcase_04 AC 16 ms
7,740 KB
testcase_05 AC 16 ms
7,824 KB
testcase_06 AC 16 ms
7,772 KB
testcase_07 AC 16 ms
7,852 KB
testcase_08 AC 810 ms
19,296 KB
testcase_09 AC 162 ms
10,496 KB
testcase_10 AC 593 ms
17,292 KB
testcase_11 AC 422 ms
15,504 KB
testcase_12 AC 931 ms
24,640 KB
testcase_13 AC 1,012 ms
25,300 KB
testcase_14 AC 573 ms
16,796 KB
testcase_15 AC 1,138 ms
27,136 KB
testcase_16 AC 942 ms
25,084 KB
testcase_17 AC 997 ms
25,096 KB
testcase_18 AC 16 ms
7,816 KB
testcase_19 AC 16 ms
7,808 KB
testcase_20 AC 33 ms
9,432 KB
testcase_21 AC 1,175 ms
26,120 KB
testcase_22 AC 1,182 ms
26,148 KB
testcase_23 AC 16 ms
7,808 KB
testcase_24 AC 16 ms
7,816 KB
testcase_25 AC 16 ms
7,848 KB
testcase_26 AC 16 ms
7,824 KB
testcase_27 AC 16 ms
7,764 KB
testcase_28 AC 665 ms
18,452 KB
testcase_29 AC 941 ms
24,968 KB
testcase_30 AC 788 ms
20,376 KB
testcase_31 AC 697 ms
18,648 KB
testcase_32 AC 900 ms
25,360 KB
testcase_33 AC 1,180 ms
25,984 KB
testcase_34 AC 1,165 ms
25,888 KB
testcase_35 AC 1,198 ms
26,164 KB
testcase_36 AC 1,159 ms
26,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def solve(N, 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