結果
問題 | No.911 ラッキーソート |
ユーザー | vwxyz |
提出日時 | 2023-02-02 05:58:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,437 bytes |
コンパイル時間 | 368 ms |
コンパイル使用メモリ | 86,580 KB |
実行使用メモリ | 137,600 KB |
最終ジャッジ日時 | 2023-09-14 14:26:10 |
合計ジャッジ時間 | 18,147 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 251 ms
90,928 KB |
testcase_01 | AC | 247 ms
91,160 KB |
testcase_02 | AC | 244 ms
90,644 KB |
testcase_03 | AC | 251 ms
90,924 KB |
testcase_04 | AC | 244 ms
90,916 KB |
testcase_05 | AC | 243 ms
90,756 KB |
testcase_06 | AC | 242 ms
90,968 KB |
testcase_07 | AC | 248 ms
90,896 KB |
testcase_08 | AC | 248 ms
90,956 KB |
testcase_09 | AC | 246 ms
90,916 KB |
testcase_10 | AC | 254 ms
90,964 KB |
testcase_11 | AC | 245 ms
90,972 KB |
testcase_12 | AC | 246 ms
90,928 KB |
testcase_13 | AC | 399 ms
137,588 KB |
testcase_14 | AC | 362 ms
127,164 KB |
testcase_15 | AC | 359 ms
124,852 KB |
testcase_16 | AC | 379 ms
123,960 KB |
testcase_17 | AC | 369 ms
126,256 KB |
testcase_18 | AC | 369 ms
127,012 KB |
testcase_19 | AC | 369 ms
124,184 KB |
testcase_20 | AC | 360 ms
133,268 KB |
testcase_21 | AC | 376 ms
124,100 KB |
testcase_22 | AC | 372 ms
123,712 KB |
testcase_23 | AC | 356 ms
122,184 KB |
testcase_24 | AC | 361 ms
125,964 KB |
testcase_25 | AC | 316 ms
112,100 KB |
testcase_26 | AC | 297 ms
106,572 KB |
testcase_27 | AC | 280 ms
99,020 KB |
testcase_28 | AC | 270 ms
95,312 KB |
testcase_29 | AC | 258 ms
94,504 KB |
testcase_30 | AC | 266 ms
94,304 KB |
testcase_31 | AC | 267 ms
91,480 KB |
testcase_32 | AC | 255 ms
91,144 KB |
testcase_33 | AC | 264 ms
91,708 KB |
testcase_34 | AC | 258 ms
90,976 KB |
testcase_35 | AC | 259 ms
91,388 KB |
testcase_36 | AC | 254 ms
90,972 KB |
testcase_37 | AC | 259 ms
91,668 KB |
testcase_38 | AC | 376 ms
124,132 KB |
testcase_39 | AC | 379 ms
121,860 KB |
testcase_40 | AC | 262 ms
94,660 KB |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 361 ms
124,180 KB |
testcase_44 | AC | 409 ms
137,600 KB |
testcase_45 | AC | 370 ms
130,064 KB |
testcase_46 | AC | 365 ms
126,368 KB |
testcase_47 | AC | 353 ms
124,040 KB |
testcase_48 | AC | 370 ms
130,340 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(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+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)