結果
問題 | No.911 ラッキーソート |
ユーザー | vwxyz |
提出日時 | 2023-02-02 06:14:13 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 369 ms / 2,000 ms |
コード長 | 1,427 bytes |
コンパイル時間 | 273 ms |
コンパイル使用メモリ | 87,012 KB |
実行使用メモリ | 137,484 KB |
最終ジャッジ日時 | 2023-09-14 14:44:40 |
合計ジャッジ時間 | 18,147 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 242 ms
91,004 KB |
testcase_01 | AC | 242 ms
91,052 KB |
testcase_02 | AC | 241 ms
90,692 KB |
testcase_03 | AC | 240 ms
90,980 KB |
testcase_04 | AC | 240 ms
91,124 KB |
testcase_05 | AC | 244 ms
91,076 KB |
testcase_06 | AC | 243 ms
91,124 KB |
testcase_07 | AC | 244 ms
90,960 KB |
testcase_08 | AC | 245 ms
90,712 KB |
testcase_09 | AC | 240 ms
90,704 KB |
testcase_10 | AC | 242 ms
91,240 KB |
testcase_11 | AC | 243 ms
91,056 KB |
testcase_12 | AC | 242 ms
90,660 KB |
testcase_13 | AC | 346 ms
137,188 KB |
testcase_14 | AC | 364 ms
127,304 KB |
testcase_15 | AC | 348 ms
124,844 KB |
testcase_16 | AC | 360 ms
123,928 KB |
testcase_17 | AC | 357 ms
126,612 KB |
testcase_18 | AC | 364 ms
127,260 KB |
testcase_19 | AC | 354 ms
124,096 KB |
testcase_20 | AC | 352 ms
133,120 KB |
testcase_21 | AC | 362 ms
123,900 KB |
testcase_22 | AC | 369 ms
123,836 KB |
testcase_23 | AC | 351 ms
122,232 KB |
testcase_24 | AC | 350 ms
126,016 KB |
testcase_25 | AC | 308 ms
112,140 KB |
testcase_26 | AC | 294 ms
106,464 KB |
testcase_27 | AC | 273 ms
98,972 KB |
testcase_28 | AC | 263 ms
95,472 KB |
testcase_29 | AC | 264 ms
94,240 KB |
testcase_30 | AC | 249 ms
94,284 KB |
testcase_31 | AC | 242 ms
91,552 KB |
testcase_32 | AC | 242 ms
90,916 KB |
testcase_33 | AC | 248 ms
91,860 KB |
testcase_34 | AC | 239 ms
90,940 KB |
testcase_35 | AC | 241 ms
91,480 KB |
testcase_36 | AC | 242 ms
90,944 KB |
testcase_37 | AC | 244 ms
91,592 KB |
testcase_38 | AC | 359 ms
124,160 KB |
testcase_39 | AC | 366 ms
121,724 KB |
testcase_40 | AC | 252 ms
94,544 KB |
testcase_41 | AC | 357 ms
124,212 KB |
testcase_42 | AC | 314 ms
114,472 KB |
testcase_43 | AC | 352 ms
124,268 KB |
testcase_44 | AC | 343 ms
137,484 KB |
testcase_45 | AC | 358 ms
130,448 KB |
testcase_46 | AC | 353 ms
126,784 KB |
testcase_47 | AC | 340 ms
123,996 KB |
testcase_48 | AC | 360 ms
130,232 KB |
ソースコード
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(62)] for i in range(N-1): for bit in range(61,-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(62): if not sum(X[bit]): ans=0 break else: def solve(N): bl=True dp=0 for bit in range(61,-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+1)-solve(max(L,1)) if L==0 and all(A[i]<A[i+1] for i in range(N-1)): ans+=1 print(ans)