結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2023-02-02 05:41:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,431 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 11,044 KB
実行使用メモリ 38,788 KB
最終ジャッジ日時 2023-09-14 14:10:32
合計ジャッジ時間 28,934 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
14,824 KB
testcase_01 AC 33 ms
10,348 KB
testcase_02 AC 33 ms
10,396 KB
testcase_03 AC 33 ms
10,356 KB
testcase_04 AC 33 ms
10,400 KB
testcase_05 AC 34 ms
10,476 KB
testcase_06 AC 33 ms
10,400 KB
testcase_07 AC 34 ms
10,476 KB
testcase_08 AC 34 ms
10,404 KB
testcase_09 AC 34 ms
10,436 KB
testcase_10 AC 33 ms
10,416 KB
testcase_11 AC 32 ms
10,388 KB
testcase_12 AC 33 ms
10,392 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
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 bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write

N,L,R=map(int,readline().split())
A=list(map(int,readline().split()))
X=[{0,1} for bit in range(61)]
for i in range(N-1):
    for bit in range(60,-1,-1):
        if A[i]&1<<bit!=A[i+1]&1<<bit:
            if A[i]&1<<bit:
                X[bit].discard(0)
            else:
                X[bit].discard(1)
            break
for bit in range(61):
    if not X[bit]:
        ans=0
        break
else:
    def solve(N):
        bl=(N>>60&1 in X[60])
        dp=0
        if N&1<<60 and 0 in X[60]:
            dp+=1
        for bit in range(59,-1,-1):
            dp*=len(X[bit])
            if bl and 0 in X[bit] and N&1<<bit:
                dp+=1
            bl&=(N>>bit&1 in X[bit])
        return dp
    ans=solve(R+1)-solve(L)
print(ans)
0