結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2021-10-14 23:44:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,062 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 11,740 KB
実行使用メモリ 40,432 KB
最終ジャッジ日時 2023-10-17 19:26:38
合計ジャッジ時間 8,784 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
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 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,L,R=map(int,readline().split())
A=list(map(int,readline().split()))
bit_lst=[set() for bit in range(62)]
for i in range(1,N):
    for bit in range(61,-1,-1):
        if A[i-1]>>bit&1 and not A[i]>>bit&1:
            bit_lst[bit].add(1)
            break
        elif not A[i-1]>>bit&1 and A[i]>>bit&1:
            bit_lst[bit].add(0)
            break
for bit in range(62):
    if len(bit_lst[bit])>=2:
        ans=0
        break
else:
    for bit in range(62):
        if bit_lst[bit]=={0}:
            bit_lst[bit]=0
        elif bit_lst[bit]=={1}:
            bit_lst[bit]=1
        else:
            bit_lst[bit]=None
    def cnt(N):
        retu=0
        for bit in range(62):
            if N>>bit&1 and bit_lst[bit]!=1:
                for i in range(bit+1,62):
                    if bit_lst[i]!=None and bit_lst[i]!=N>>i&1:
                        break
                else:
                    retu+=pow(2,bit_lst[:bit].count(None))
        return retu
    ans=cnt(R+1)-cnt(L)
print(ans)
print(bit)
bin(R-1)
0