結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-17 14:55:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,882 ms / 5,000 ms
コード長 592 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,868 KB
実行使用メモリ 23,496 KB
最終ジャッジ日時 2023-09-17 16:38:08
合計ジャッジ時間 45,787 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,812 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 17 ms
7,816 KB
testcase_03 AC 17 ms
7,864 KB
testcase_04 AC 17 ms
7,744 KB
testcase_05 AC 16 ms
7,864 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,800 KB
testcase_08 AC 1,780 ms
17,204 KB
testcase_09 AC 316 ms
10,708 KB
testcase_10 AC 1,293 ms
16,452 KB
testcase_11 AC 898 ms
15,576 KB
testcase_12 AC 2,216 ms
22,080 KB
testcase_13 AC 2,415 ms
22,104 KB
testcase_14 AC 1,214 ms
15,876 KB
testcase_15 AC 2,745 ms
22,816 KB
testcase_16 AC 2,200 ms
21,488 KB
testcase_17 AC 2,362 ms
22,076 KB
testcase_18 AC 17 ms
7,872 KB
testcase_19 AC 15 ms
7,820 KB
testcase_20 AC 37 ms
9,968 KB
testcase_21 AC 2,837 ms
23,496 KB
testcase_22 AC 2,882 ms
23,368 KB
testcase_23 AC 17 ms
7,852 KB
testcase_24 AC 16 ms
7,800 KB
testcase_25 AC 16 ms
7,864 KB
testcase_26 AC 17 ms
7,864 KB
testcase_27 AC 17 ms
7,816 KB
testcase_28 AC 1,431 ms
17,116 KB
testcase_29 AC 2,321 ms
21,992 KB
testcase_30 AC 1,896 ms
17,692 KB
testcase_31 AC 1,457 ms
17,052 KB
testcase_32 AC 2,102 ms
22,180 KB
testcase_33 AC 2,708 ms
22,768 KB
testcase_34 AC 2,633 ms
22,648 KB
testcase_35 AC 2,813 ms
23,400 KB
testcase_36 AC 2,851 ms
23,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def read_data():
    N = int(input())
    A = list(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 = list(set(A))
        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