結果
| 問題 |
No.911 ラッキーソート
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-04-11 17:22:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 448 ms / 2,000 ms |
| コード長 | 750 bytes |
| コンパイル時間 | 230 ms |
| コンパイル使用メモリ | 82,024 KB |
| 実行使用メモリ | 181,752 KB |
| 最終ジャッジ日時 | 2024-06-27 12:04:15 |
| 合計ジャッジ時間 | 13,897 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 46 |
ソースコード
n,L,R = map(int,input().split())
*a, = map(int,input().split())
res = [3]*62
q = [a]
for i in range(62)[::-1]:
#print(q)
nq = []
c = 3
for lst in q:
q0 = []
q1 = []
for x in lst:
if x>>i&1:
q1.append(x)
if q0: c &= 1
else:
q0.append(x)
if q1: c &= 2
if len(q0) >= 2: nq.append(q0)
if len(q1) >= 2: nq.append(q1)
res[i] = c
q = nq
d = {}
def f(x,i):
if (x,i) in d:
return d[x,i]
if x < 0: return 0
if i==62: return 1
c = 0
if res[i]&1:
c += f(x//2,i+1)
if res[i]&2:
c += f((x-1)//2,i+1)
d[x,i] = c
return c
p = f(R,0)
q = f(L-1,0)
print(p-q)
convexineq