結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2023-02-02 05:41:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,431 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 124,004 KB
最終ジャッジ日時 2024-07-01 21:33:20
合計ジャッジ時間 12,693 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
89,344 KB
testcase_01 AC 148 ms
89,216 KB
testcase_02 AC 145 ms
89,472 KB
testcase_03 AC 143 ms
89,856 KB
testcase_04 AC 145 ms
89,600 KB
testcase_05 AC 142 ms
89,216 KB
testcase_06 AC 144 ms
89,704 KB
testcase_07 AC 144 ms
89,600 KB
testcase_08 AC 144 ms
89,216 KB
testcase_09 AC 144 ms
89,600 KB
testcase_10 AC 144 ms
89,472 KB
testcase_11 AC 145 ms
89,216 KB
testcase_12 AC 145 ms
89,856 KB
testcase_13 AC 297 ms
119,724 KB
testcase_14 AC 247 ms
120,440 KB
testcase_15 AC 241 ms
119,568 KB
testcase_16 AC 260 ms
123,708 KB
testcase_17 AC 257 ms
123,892 KB
testcase_18 AC 258 ms
124,004 KB
testcase_19 AC 250 ms
120,028 KB
testcase_20 AC 243 ms
119,344 KB
testcase_21 AC 263 ms
122,564 KB
testcase_22 AC 255 ms
119,840 KB
testcase_23 AC 248 ms
116,160 KB
testcase_24 AC 249 ms
113,536 KB
testcase_25 AC 204 ms
107,776 KB
testcase_26 AC 192 ms
102,400 KB
testcase_27 AC 169 ms
94,464 KB
testcase_28 AC 159 ms
90,752 KB
testcase_29 AC 149 ms
90,624 KB
testcase_30 AC 147 ms
90,752 KB
testcase_31 AC 142 ms
90,112 KB
testcase_32 AC 146 ms
89,600 KB
testcase_33 AC 147 ms
90,112 KB
testcase_34 AC 142 ms
89,600 KB
testcase_35 AC 145 ms
90,212 KB
testcase_36 AC 145 ms
89,600 KB
testcase_37 AC 145 ms
89,728 KB
testcase_38 AC 261 ms
123,712 KB
testcase_39 AC 267 ms
118,428 KB
testcase_40 AC 150 ms
90,368 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 249 ms
120,132 KB
testcase_44 AC 295 ms
119,984 KB
testcase_45 AC 256 ms
123,964 KB
testcase_46 AC 261 ms
123,548 KB
testcase_47 AC 238 ms
119,308 KB
testcase_48 AC 253 ms
119,612 KB
権限があれば一括ダウンロードができます

ソースコード

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