結果
| 問題 |
No.2977 Kth Xor Pair
|
| コンテスト | |
| ユーザー |
むつある
|
| 提出日時 | 2024-12-01 02:18:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 847 bytes |
| コンパイル時間 | 379 ms |
| コンパイル使用メモリ | 82,272 KB |
| 実行使用メモリ | 489,740 KB |
| 最終ジャッジ日時 | 2024-12-01 02:19:22 |
| 合計ジャッジ時間 | 34,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 TLE * 4 |
ソースコード
n,k=map(int,input().split())
k*=2
k+=n-1
a=list(map(int,input().split()))
now=[[a,a]]
ans=0
cnt=0
for i in range(30)[::-1]:
xx=[]
yy=[]
c=0
for x,y in now:
now_xx=[[],[]]
now_yy=[[],[]]
for v in x:
now_xx[bool(v&1<<i)].append(v)
for v in y:
now_yy[bool(v&1<<i)].append(v)
xx.append(now_xx)
yy.append(now_yy)
c+=len(now_xx[0])*len(now_yy[0])+len(now_xx[1])*len(now_yy[1])
now=[]
if cnt+c>k:
for v in range(len(xx)):
if xx[v][0] and yy[v][0]:
now.append([xx[v][0],yy[v][0]])
if xx[v][1] and yy[v][1]:
now.append([xx[v][1],yy[v][1]])
else:
cnt+=c
for v in range(len(xx)):
if xx[v][0] and yy[v][1]:
now.append([xx[v][0],yy[v][1]])
if xx[v][1] and yy[v][0]:
now.append([xx[v][1],yy[v][0]])
print(now[0][0][0]^now[0][1][0])
むつある