結果

問題 No.2061 XOR Sort
ユーザー minimumminimum
提出日時 2022-08-26 23:13:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 615 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 28,456 KB
最終ジャッジ日時 2024-04-22 01:18:10
合計ジャッジ時間 5,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
17,952 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 56 ms
10,752 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 501 ms
10,752 KB
testcase_06 AC 579 ms
10,880 KB
testcase_07 AC 52 ms
10,752 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 80 ms
10,880 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 36 ms
10,752 KB
testcase_12 AC 362 ms
10,752 KB
testcase_13 AC 25 ms
10,880 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import setrecursionlimit
setrecursionlimit(10 ** 5)
MOD = 998244353

flag = [0] * 32

def slv(a, k):
    if len(a) <= 1 or k < 0:
        pass
    else:
        if ((a[0] >> k) & 1) or ((a[-1] >> k) & 1 == 0):
            slv(a, k - 1)
        else:
            flag[k] = 1
            for i in range(1, len(a)):
                if (a[i] >> k) & 1:
                    slv(a[:i], k - 1)
                    slv(a[i:], k - 1)

N = int(input())
a = list(map(int, input().split()))
a.sort()
b = [a[0]]
for i in range(1, N):
    if b[-1] != a[i]:
        b.append(a[i])
slv(b, 32)
print(pow(2, sum(flag), MOD))
0