結果

問題 No.911 ラッキーソート
ユーザー vwxyzvwxyz
提出日時 2023-02-02 06:04:07
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,432 bytes
コンパイル時間 1,118 ms
コンパイル使用メモリ 86,616 KB
実行使用メモリ 137,828 KB
最終ジャッジ日時 2023-09-14 14:31:51
合計ジャッジ時間 19,566 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
91,296 KB
testcase_01 AC 253 ms
90,976 KB
testcase_02 AC 250 ms
91,144 KB
testcase_03 WA -
testcase_04 AC 250 ms
91,280 KB
testcase_05 WA -
testcase_06 AC 251 ms
91,240 KB
testcase_07 AC 246 ms
91,016 KB
testcase_08 AC 252 ms
91,140 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 257 ms
91,064 KB
testcase_12 AC 254 ms
91,132 KB
testcase_13 WA -
testcase_14 AC 367 ms
127,692 KB
testcase_15 AC 363 ms
125,112 KB
testcase_16 AC 378 ms
124,292 KB
testcase_17 AC 377 ms
126,468 KB
testcase_18 AC 375 ms
127,540 KB
testcase_19 AC 367 ms
124,400 KB
testcase_20 AC 366 ms
133,344 KB
testcase_21 AC 379 ms
124,124 KB
testcase_22 AC 378 ms
124,124 KB
testcase_23 AC 360 ms
122,228 KB
testcase_24 AC 361 ms
126,096 KB
testcase_25 AC 324 ms
112,512 KB
testcase_26 AC 307 ms
106,848 KB
testcase_27 AC 287 ms
99,404 KB
testcase_28 AC 274 ms
95,880 KB
testcase_29 AC 266 ms
94,488 KB
testcase_30 AC 260 ms
94,584 KB
testcase_31 AC 252 ms
92,092 KB
testcase_32 AC 253 ms
91,104 KB
testcase_33 AC 259 ms
92,240 KB
testcase_34 AC 254 ms
91,220 KB
testcase_35 AC 258 ms
92,088 KB
testcase_36 AC 251 ms
91,180 KB
testcase_37 AC 250 ms
92,184 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 263 ms
94,532 KB
testcase_41 AC 375 ms
124,272 KB
testcase_42 AC 327 ms
114,620 KB
testcase_43 WA -
testcase_44 AC 411 ms
137,608 KB
testcase_45 AC 371 ms
130,756 KB
testcase_46 AC 374 ms
127,016 KB
testcase_47 AC 358 ms
124,380 KB
testcase_48 AC 376 ms
130,724 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=[[1,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][0]=0
            else:
                X[bit][1]=0
            break
for bit in range(61):
    if not sum(X[bit]):
        ans=0
        break
else:
    def solve(N):
        bl=X[60][N>>60&1]
        dp=0
        for bit in range(60,-1,-1):
            dp*=sum(X[bit])
            if bl and X[bit][0] and N&1<<bit:
                dp+=1
            bl&=X[bit][N>>bit&1]
        return dp
    ans=solve(R)-solve(L)
    if L==0 and all(A[i]^R<A[i+1]^R for i in range(N-1)):
        ans+=1
print(ans)
0