結果

問題 No.2061 XOR Sort
ユーザー minimumminimum
提出日時 2022-08-26 23:19:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 102,324 KB
最終ジャッジ日時 2024-04-22 01:28:14
合計ジャッジ時間 3,877 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
52,696 KB
testcase_01 AC 32 ms
52,076 KB
testcase_02 AC 35 ms
52,740 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 34 ms
52,200 KB
testcase_06 AC 34 ms
53,252 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 37 ms
52,484 KB
testcase_10 AC 38 ms
53,128 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 36 ms
52,824 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 61 ms
76,472 KB
testcase_30 AC 33 ms
52,152 KB
testcase_31 AC 40 ms
61,988 KB
testcase_32 AC 34 ms
53,744 KB
testcase_33 AC 33 ms
52,644 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
N = int(input())
a = list(map(int, input().split()))
a.sort()
ls = [[0, N - 1]]
ans = 1

for k in range(32, -1, -1):
    flag = 0
    nls = []
    for l, r in ls:
        if (a[l] >> k) & 1:
            nls.append([l, r])
        elif (a[r] >> k) & 1 == 0:
            nls.append([l, r])
        else:
            for i in range(l + 1, r + 1):
                if (a[i] >> k) & 1:
                    flag = 1
                    if i - 1 > l:
                        nls.append([l, i - 1])
                    if i < r:
                        nls.append([i, r])
                if flag:
                    break
    if flag:
        ans = (ans * 2) % MOD
    ls = nls

print(ans)
0