結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー mkawa2mkawa2
提出日時 2020-01-27 12:12:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,069 ms / 5,000 ms
コード長 1,084 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 22,268 KB
最終ジャッジ日時 2023-09-17 18:10:37
合計ジャッジ時間 48,150 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,552 KB
testcase_01 AC 20 ms
8,744 KB
testcase_02 AC 20 ms
8,584 KB
testcase_03 AC 20 ms
8,752 KB
testcase_04 AC 20 ms
8,688 KB
testcase_05 AC 20 ms
8,616 KB
testcase_06 AC 19 ms
8,636 KB
testcase_07 AC 20 ms
8,636 KB
testcase_08 AC 1,880 ms
17,988 KB
testcase_09 AC 337 ms
10,888 KB
testcase_10 AC 1,391 ms
16,296 KB
testcase_11 AC 956 ms
15,240 KB
testcase_12 AC 2,285 ms
21,296 KB
testcase_13 AC 2,503 ms
20,928 KB
testcase_14 AC 1,297 ms
15,812 KB
testcase_15 AC 2,949 ms
22,144 KB
testcase_16 AC 2,323 ms
21,220 KB
testcase_17 AC 2,534 ms
19,880 KB
testcase_18 AC 20 ms
8,684 KB
testcase_19 AC 20 ms
8,564 KB
testcase_20 AC 37 ms
10,516 KB
testcase_21 AC 3,069 ms
21,356 KB
testcase_22 AC 3,006 ms
21,320 KB
testcase_23 AC 19 ms
8,752 KB
testcase_24 AC 20 ms
8,736 KB
testcase_25 AC 19 ms
8,632 KB
testcase_26 AC 19 ms
8,784 KB
testcase_27 AC 20 ms
8,648 KB
testcase_28 AC 1,565 ms
16,896 KB
testcase_29 AC 2,308 ms
20,628 KB
testcase_30 AC 2,009 ms
18,376 KB
testcase_31 AC 1,619 ms
16,760 KB
testcase_32 AC 2,114 ms
21,128 KB
testcase_33 AC 2,888 ms
22,268 KB
testcase_34 AC 2,803 ms
21,700 KB
testcase_35 AC 2,855 ms
21,376 KB
testcase_36 AC 2,958 ms
21,076 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline()[:-1]
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

from heapq import *
def main():
    n = II()
    xx = LI()
    xx=set(xx)
    hp=[]
    for x in xx:heappush(hp,-x)
    pre=0
    cnt=0
    while hp:
        x=-heappop(hp)
        if x==0:break
        if x.bit_length()==pre.bit_length():
            heappush(hp,-(x^pre))
        else:
            pre=x
            cnt+=1
    print(pow(2,cnt))

main()
0