結果

問題 No.2061 XOR Sort
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-08-12 08:25:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 353 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 81,608 KB
実行使用メモリ 197,804 KB
最終ジャッジ日時 2023-10-23 19:27:21
合計ジャッジ時間 10,830 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,284 KB
testcase_01 AC 36 ms
53,284 KB
testcase_02 AC 36 ms
53,284 KB
testcase_03 AC 36 ms
53,284 KB
testcase_04 AC 36 ms
53,284 KB
testcase_05 AC 37 ms
53,284 KB
testcase_06 AC 37 ms
53,284 KB
testcase_07 AC 37 ms
53,284 KB
testcase_08 AC 36 ms
53,284 KB
testcase_09 AC 36 ms
53,284 KB
testcase_10 AC 37 ms
53,284 KB
testcase_11 AC 36 ms
53,284 KB
testcase_12 AC 37 ms
53,284 KB
testcase_13 AC 36 ms
53,284 KB
testcase_14 AC 199 ms
130,548 KB
testcase_15 AC 191 ms
136,880 KB
testcase_16 AC 340 ms
189,528 KB
testcase_17 AC 231 ms
149,424 KB
testcase_18 AC 229 ms
150,256 KB
testcase_19 AC 235 ms
151,324 KB
testcase_20 AC 84 ms
81,060 KB
testcase_21 AC 133 ms
111,580 KB
testcase_22 AC 196 ms
130,748 KB
testcase_23 AC 50 ms
66,272 KB
testcase_24 AC 340 ms
197,804 KB
testcase_25 AC 350 ms
195,640 KB
testcase_26 AC 343 ms
194,264 KB
testcase_27 AC 351 ms
195,712 KB
testcase_28 AC 353 ms
194,044 KB
testcase_29 AC 85 ms
84,896 KB
testcase_30 AC 37 ms
53,284 KB
testcase_31 AC 49 ms
66,244 KB
testcase_32 AC 36 ms
53,284 KB
testcase_33 AC 36 ms
53,284 KB
testcase_34 AC 36 ms
53,284 KB
testcase_35 AC 36 ms
53,284 KB
testcase_36 AC 37 ms
53,284 KB
testcase_37 AC 37 ms
53,284 KB
testcase_38 AC 38 ms
53,284 KB
testcase_39 AC 39 ms
53,284 KB
testcase_40 AC 36 ms
53,284 KB
testcase_41 AC 37 ms
53,284 KB
testcase_42 AC 36 ms
53,284 KB
testcase_43 AC 37 ms
53,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #



mod=998244353
def sol1(A):
    a=A[:]
    n=len(a)
    a.sort()
    ans=1
    block=[(0,n-1)]
    for j in range(32,-1,-1):
        res=1
        new=[]
        for l,r in block:
            if (a[l]>>j)&1==(a[r]>>j)&1:
                new.append((l,r))
                continue
            mid=-1
            for i in range(l,r):
                if (a[i]>>j)&1<(a[i+1]>>j)&1:
                    mid=i
                    break
            res=2
            new.append((l,mid))
            new.append((mid+1,r))
        ans*=res
        block=new[:]
    return ans%mod

n=int(input())
a=list(map(int,input().split()))
print(sol1(a))
0