結果

問題 No.2061 XOR Sort
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-08-12 08:23:59
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 618 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 81,484 KB
実行使用メモリ 198,936 KB
最終ジャッジ日時 2023-10-23 19:27:51
合計ジャッジ時間 6,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,248 KB
testcase_01 AC 37 ms
53,248 KB
testcase_02 AC 40 ms
53,248 KB
testcase_03 AC 38 ms
53,248 KB
testcase_04 AC 37 ms
53,248 KB
testcase_05 AC 37 ms
53,248 KB
testcase_06 AC 39 ms
53,248 KB
testcase_07 AC 38 ms
53,248 KB
testcase_08 AC 37 ms
53,248 KB
testcase_09 AC 37 ms
53,248 KB
testcase_10 AC 37 ms
53,248 KB
testcase_11 AC 37 ms
53,248 KB
testcase_12 AC 37 ms
53,248 KB
testcase_13 AC 37 ms
53,248 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 77 ms
82,116 KB
testcase_21 AC 133 ms
111,496 KB
testcase_22 WA -
testcase_23 AC 52 ms
68,308 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 85 ms
84,864 KB
testcase_30 AC 36 ms
53,264 KB
testcase_31 AC 49 ms
66,212 KB
testcase_32 AC 36 ms
53,264 KB
testcase_33 AC 36 ms
53,264 KB
testcase_34 AC 38 ms
53,264 KB
testcase_35 AC 37 ms
53,264 KB
testcase_36 AC 36 ms
53,264 KB
testcase_37 AC 36 ms
53,264 KB
testcase_38 AC 36 ms
53,264 KB
testcase_39 AC 37 ms
53,264 KB
testcase_40 AC 37 ms
53,264 KB
testcase_41 AC 36 ms
53,264 KB
testcase_42 AC 37 ms
53,264 KB
testcase_43 AC 37 ms
53,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


def sol1(A):
    a=A[:]
    n=len(a)
    a.sort()
    ans=1
    block=[(0,n-1)]
    for j in range(65,-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

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