結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-17 14:55:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 609 ms / 5,000 ms
コード長 592 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 260,216 KB
最終ジャッジ日時 2023-09-17 16:37:01
合計ジャッジ時間 14,069 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
70,956 KB
testcase_01 AC 75 ms
71,200 KB
testcase_02 AC 75 ms
71,232 KB
testcase_03 AC 75 ms
71,224 KB
testcase_04 AC 76 ms
71,156 KB
testcase_05 AC 76 ms
70,996 KB
testcase_06 AC 75 ms
71,160 KB
testcase_07 AC 75 ms
71,044 KB
testcase_08 AC 505 ms
259,080 KB
testcase_09 AC 151 ms
94,472 KB
testcase_10 AC 420 ms
250,852 KB
testcase_11 AC 292 ms
174,144 KB
testcase_12 AC 536 ms
259,332 KB
testcase_13 AC 570 ms
259,280 KB
testcase_14 AC 415 ms
247,176 KB
testcase_15 AC 585 ms
259,212 KB
testcase_16 AC 525 ms
260,216 KB
testcase_17 AC 548 ms
259,984 KB
testcase_18 AC 75 ms
71,108 KB
testcase_19 AC 74 ms
70,940 KB
testcase_20 AC 97 ms
88,164 KB
testcase_21 AC 609 ms
259,692 KB
testcase_22 AC 600 ms
259,988 KB
testcase_23 AC 76 ms
70,968 KB
testcase_24 AC 75 ms
71,212 KB
testcase_25 AC 75 ms
71,044 KB
testcase_26 AC 73 ms
71,252 KB
testcase_27 AC 74 ms
71,252 KB
testcase_28 AC 447 ms
259,340 KB
testcase_29 AC 523 ms
259,824 KB
testcase_30 AC 518 ms
259,544 KB
testcase_31 AC 451 ms
259,100 KB
testcase_32 AC 547 ms
259,744 KB
testcase_33 AC 602 ms
259,296 KB
testcase_34 AC 590 ms
258,968 KB
testcase_35 AC 598 ms
259,316 KB
testcase_36 AC 587 ms
259,680 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