結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2021-10-14 23:29:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 112,028 KB
最終ジャッジ日時 2023-10-17 19:26:10
合計ジャッジ時間 8,222 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 46 ms
59,424 KB
testcase_04 AC 39 ms
59,172 KB
testcase_05 AC 42 ms
59,428 KB
testcase_06 AC 37 ms
53,460 KB
testcase_07 AC 38 ms
53,460 KB
testcase_08 AC 38 ms
53,460 KB
testcase_09 AC 41 ms
59,240 KB
testcase_10 AC 40 ms
59,240 KB
testcase_11 AC 37 ms
53,460 KB
testcase_12 AC 38 ms
53,460 KB
testcase_13 AC 199 ms
105,656 KB
testcase_14 AC 173 ms
111,312 KB
testcase_15 AC 160 ms
105,876 KB
testcase_16 AC 187 ms
111,936 KB
testcase_17 AC 183 ms
111,928 KB
testcase_18 AC 184 ms
112,028 KB
testcase_19 AC 178 ms
111,296 KB
testcase_20 AC 181 ms
105,924 KB
testcase_21 AC 192 ms
111,052 KB
testcase_22 AC 192 ms
110,052 KB
testcase_23 AC 176 ms
102,016 KB
testcase_24 AC 170 ms
97,736 KB
testcase_25 AC 120 ms
92,836 KB
testcase_26 AC 108 ms
86,856 KB
testcase_27 AC 76 ms
77,104 KB
testcase_28 AC 62 ms
69,456 KB
testcase_29 AC 52 ms
64,348 KB
testcase_30 AC 48 ms
62,220 KB
testcase_31 AC 44 ms
59,516 KB
testcase_32 AC 38 ms
53,464 KB
testcase_33 AC 44 ms
60,180 KB
testcase_34 AC 40 ms
59,736 KB
testcase_35 AC 40 ms
59,500 KB
testcase_36 AC 37 ms
53,464 KB
testcase_37 AC 40 ms
59,500 KB
testcase_38 AC 182 ms
111,932 KB
testcase_39 AC 195 ms
106,456 KB
testcase_40 AC 51 ms
64,348 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 172 ms
111,340 KB
testcase_44 AC 202 ms
106,004 KB
testcase_45 AC 175 ms
111,336 KB
testcase_46 AC 180 ms
111,988 KB
testcase_47 AC 162 ms
105,860 KB
testcase_48 AC 185 ms
109,616 KB
権限があれば一括ダウンロードができます

ソースコード

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(61)]
for i in range(1,N):
    for bit in range(60,-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(61):
    if len(bit_lst[bit])>=2:
        ans=0
        break
else:
    for bit in range(61):
        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(61):
            if N>>bit&1 and bit_lst[bit]!=1:
                for i in range(bit+1,61):
                    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