結果

問題 No.2061 XOR Sort
ユーザー shotoyooshotoyoo
提出日時 2022-08-26 22:20:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 856 ms / 2,000 ms
コード長 1,043 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 286,384 KB
最終ジャッジ日時 2023-08-04 01:52:04
合計ジャッジ時間 13,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
72,132 KB
testcase_01 AC 84 ms
72,072 KB
testcase_02 AC 84 ms
72,124 KB
testcase_03 AC 88 ms
76,748 KB
testcase_04 AC 82 ms
72,276 KB
testcase_05 AC 86 ms
76,848 KB
testcase_06 AC 86 ms
77,064 KB
testcase_07 AC 88 ms
76,940 KB
testcase_08 AC 84 ms
72,244 KB
testcase_09 AC 86 ms
74,936 KB
testcase_10 AC 85 ms
72,140 KB
testcase_11 AC 84 ms
72,456 KB
testcase_12 AC 87 ms
76,800 KB
testcase_13 AC 84 ms
72,228 KB
testcase_14 AC 483 ms
246,368 KB
testcase_15 AC 461 ms
234,332 KB
testcase_16 AC 821 ms
285,024 KB
testcase_17 AC 593 ms
286,276 KB
testcase_18 AC 603 ms
283,256 KB
testcase_19 AC 609 ms
286,384 KB
testcase_20 AC 148 ms
92,924 KB
testcase_21 AC 304 ms
167,604 KB
testcase_22 AC 464 ms
236,212 KB
testcase_23 AC 105 ms
78,308 KB
testcase_24 AC 843 ms
283,932 KB
testcase_25 AC 849 ms
283,008 KB
testcase_26 AC 856 ms
283,960 KB
testcase_27 AC 846 ms
286,052 KB
testcase_28 AC 854 ms
283,424 KB
testcase_29 AC 188 ms
156,552 KB
testcase_30 AC 85 ms
71,932 KB
testcase_31 AC 102 ms
78,244 KB
testcase_32 AC 86 ms
72,124 KB
testcase_33 AC 85 ms
72,136 KB
testcase_34 AC 86 ms
72,292 KB
testcase_35 AC 87 ms
72,092 KB
testcase_36 AC 86 ms
72,012 KB
testcase_37 AC 88 ms
72,164 KB
testcase_38 AC 86 ms
72,120 KB
testcase_39 AC 86 ms
72,508 KB
testcase_40 AC 85 ms
72,120 KB
testcase_41 AC 87 ms
72,120 KB
testcase_42 AC 84 ms
72,040 KB
testcase_43 AC 86 ms
72,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, random
input = lambda : sys.stdin.readline().rstrip()


write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input())
def debug(_l_):
    for s in _l_.split():
        print(f"{s}={eval(s)}", end=" ")
    print()
def dlist(*l, fill=0):
    if len(l)==1:
        return [fill]*l[0]
    ll = l[1:]
    return [dlist(*ll, fill=fill) for _ in range(l[0])]

n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
dp = [a]
ans = 1
M = 998244353
for b in range(32)[::-1]:
    ndp = []
    ok = 0
    for item in dp:
        vs = [[], []]
        for v in item:
            vs[v>>b&1].append(v)
        if vs[0] and vs[1]:
            ok = 1
        if vs[0]:
            ndp.append(vs[0])
        if vs[1]:
            ndp.append(vs[1])
    if ok:
        ans *= 2
        ans %= M
    dp = ndp
print(ans%M)
0