結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2021-10-14 23:48:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 876 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,040 KB
実行使用メモリ 36,228 KB
最終ジャッジ日時 2023-10-17 19:27:13
合計ジャッジ時間 7,931 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
17,044 KB
testcase_01 AC 30 ms
10,172 KB
testcase_02 AC 30 ms
10,036 KB
testcase_03 AC 30 ms
10,104 KB
testcase_04 AC 30 ms
10,104 KB
testcase_05 AC 30 ms
10,104 KB
testcase_06 AC 30 ms
10,104 KB
testcase_07 AC 30 ms
10,104 KB
testcase_08 AC 29 ms
10,104 KB
testcase_09 AC 30 ms
10,104 KB
testcase_10 AC 30 ms
10,100 KB
testcase_11 AC 29 ms
10,104 KB
testcase_12 AC 29 ms
10,104 KB
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=[None 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:
            if bit_lst[bit]==0:
                print(0)
                exit()
            bit_lst[bit]=1
            break
        elif not A[i-1]>>bit&1 and A[i]>>bit&1:
            if bit_lst[bit]==1:
                print(0)
                exit()
            bit_lst[bit]=0
            break
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)
0