結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-17 15:03:24
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 584 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 106,132 KB
最終ジャッジ日時 2023-09-17 16:35:23
合計ジャッジ時間 9,468 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,588 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 76 ms
71,188 KB
testcase_05 AC 77 ms
71,152 KB
testcase_06 RE -
testcase_07 AC 77 ms
71,344 KB
testcase_08 AC 218 ms
103,464 KB
testcase_09 AC 106 ms
78,204 KB
testcase_10 AC 195 ms
100,000 KB
testcase_11 AC 161 ms
93,744 KB
testcase_12 AC 250 ms
105,008 KB
testcase_13 AC 263 ms
102,280 KB
testcase_14 AC 191 ms
99,680 KB
testcase_15 AC 280 ms
105,368 KB
testcase_16 AC 238 ms
103,212 KB
testcase_17 AC 250 ms
103,192 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 298 ms
106,132 KB
testcase_22 AC 290 ms
105,904 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 203 ms
102,004 KB
testcase_29 AC 256 ms
101,252 KB
testcase_30 AC 222 ms
104,848 KB
testcase_31 AC 209 ms
103,372 KB
testcase_32 AC 239 ms
104,544 KB
testcase_33 AC 281 ms
105,012 KB
testcase_34 AC 276 ms
104,788 KB
testcase_35 AC 283 ms
105,632 KB
testcase_36 AC 289 ms
105,556 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
    rank_upper_bound = min(digits, N)
    for rank in range(rank_upper_bound + 1):
        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, N):
            if not A[i] & index:
                break
            A[i] ^= Ar
    return 1 << rank

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