結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,808 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 AC 16 ms
7,764 KB
testcase_03 AC 17 ms
7,852 KB
testcase_04 AC 16 ms
7,896 KB
testcase_05 AC 16 ms
7,796 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 16 ms
7,856 KB
testcase_08 AC 660 ms
19,304 KB
testcase_09 AC 133 ms
10,468 KB
testcase_10 AC 515 ms
17,348 KB
testcase_11 AC 350 ms
15,460 KB
testcase_12 AC 792 ms
24,688 KB
testcase_13 AC 861 ms
25,372 KB
testcase_14 AC 482 ms
16,764 KB
testcase_15 AC 894 ms
26,988 KB
testcase_16 AC 729 ms
25,164 KB
testcase_17 AC 825 ms
25,128 KB
testcase_18 AC 16 ms
7,852 KB
testcase_19 AC 16 ms
7,808 KB
testcase_20 AC 32 ms
9,352 KB
testcase_21 AC 995 ms
26,192 KB
testcase_22 AC 1,035 ms
26,196 KB
testcase_23 AC 16 ms
7,788 KB
testcase_24 AC 16 ms
7,780 KB
testcase_25 AC 16 ms
7,716 KB
testcase_26 AC 16 ms
7,880 KB
testcase_27 AC 16 ms
7,856 KB
testcase_28 AC 558 ms
18,436 KB
testcase_29 AC 798 ms
25,024 KB
testcase_30 AC 680 ms
20,448 KB
testcase_31 AC 582 ms
18,592 KB
testcase_32 AC 694 ms
25,468 KB
testcase_33 AC 960 ms
27,100 KB
testcase_34 AC 926 ms
25,852 KB
testcase_35 AC 1,017 ms
26,116 KB
testcase_36 AC 1,006 ms
26,140 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):
        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
    if A[rank]:
        rank += 1
    return 1 << rank

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